Skip to content

A simple, robust command-line tool for viewing and editing FITS file headers.

License

Notifications You must be signed in to change notification settings

AmberLee2427/CLFits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

CLFits: FITS Header Editor

A command-line tool for viewing and editing the headers of FITS files.

PyPI Version Test Coverage CI Status License

Installation

pip install clfits

Quick Start

View a Header

To view the primary header of a FITS file:

clfits view my_image.fits

To view the header of a specific extension (e.g., the second HDU, index 1):

clfits view my_image.fits --hdu 1

Or view an extension by name:

clfits view my_image.fits --hdu "OBSERVATIONS"

Get, Set, and Delete Keywords

# Get the value of a keyword
clfits get my_image.fits OBJECT

# Set a new value for a keyword
clfits set my_image.fits OBJECT "NGC 42"

# Set a keyword with a comment
clfits set my_image.fits OBSERVER "Webb" --comment "James Webb Space Telescope"

# Delete a keyword from the first extension's header
clfits del my_image.fits --hdu 1 TFORM1

Search and Filter Keywords

Find all keywords starting with "NAXIS":

clfits search my_image.fits --key "NAXIS*"

Find all keywords in the "EVENTS" extension where the value is a specific string:

clfits search my_image.fits --hdu "EVENTS" --value "GTI"

Export Headers

Export the primary header to a JSON file:

clfits export my_image.fits --output header.json

Export the header of the second HDU to YAML, printing to the console:

clfits export my_image.fits --hdu 1 --format yaml

Documentation

Full documentation is available at clfits.readthedocs.io.