A command-line tool for viewing and editing the headers of FITS files.
pip install clfitsTo view the primary header of a FITS file:
clfits view my_image.fitsTo view the header of a specific extension (e.g., the second HDU, index 1):
clfits view my_image.fits --hdu 1Or view an extension by name:
clfits view my_image.fits --hdu "OBSERVATIONS"# 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 TFORM1Find 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 the primary header to a JSON file:
clfits export my_image.fits --output header.jsonExport the header of the second HDU to YAML, printing to the console:
clfits export my_image.fits --hdu 1 --format yamlFull documentation is available at clfits.readthedocs.io.
