Tools for FITS files

Sometimes a FITS file does not conform with BBarolo or keywords in the FITS header can not be understood by the code. A few utilities to easily modify a FITS file and its header are now included in the latest versions of BBarolo. These tools are based on or developed from the NASA’s FITS utilities.

A list of implemented tools can be obtained with BBarolo --fitsutils. Four utilities are currently available. Each tool is promptly accessible from the command line through BBarolo --UTILNAME, where UTILNAME is one of the utilities listed below:

modhead. Modify or add a keyword to a FITS header. Type BBarolo --modhead for help:

$$ BBarolo --modhead

 BBarolo's MODHEAD FITS utility: 

 Write or modify the value of a header keyword.
 If a newvalue is not specified, just print the current value.

 Usage:
   BBarolo --modhead filename[ext] keyword [newvalue]

 Examples: 
   BBarolo --modhead in.fits cunit1      (list the CUNIT1 keyword)
   BBarolo --modhead in.fits cunit1 deg  (set CUNIT1 = 'deg')

 NOTE: it may be necessary to enclose the input file name in single 
 quote characters on some Unix shells.

remhead. Remove a keyword from a FITS header. Type BBarolo --remhead for help:

$$ BBarolo --remhead

 BBarolo's REMHEAD FITS utility: 

 Delete a header keyword from a FITS file.

 Usage:
   BBarolo --remhead filename[ext] keyword 

 Examples: 
   BBarolo --remhead in.fits object      (remove the OBJECT keyword)

 NOTE: it may be necessary to enclose the input file name in single 
 quote characters on some Unix shells.

listhead. List all keywords in a FITS header. Type BBarolo --listhead for help.

$$ BBarolo --listhead

 BBarolo's LISTHEAD FITS utility: 

 List the FITS header keywords in a single extension, or, if [ext] is
 not given, list the keywords in all the extensions.

 Usage:
   BBarolo --listhead filename[ext] 

 Examples: 
   BBarolo --listhead file.fits      (list every header in the file) 
   BBarolo --listhead file.fits[0]   (list primary array header) 
   BBarolo --listhead file.fits[2]   (list header of 2nd extension) 
   BBarolo --listhead file.fits[GTI] (list header of GTI extension) 

 NOTE: it may be necessary to enclose the input file name in single 
 quote characters on some Unix shells.

fitscopy. Make a copy of a FITS file, optionally selecting a subset. Type BBarolo --fitscopy for help:

$$ BBarolo --fitscopy

 BBarolo's FITSCOPY FITS utility: 

 Copy an input file to an output file, optionally filtering the file in the 
 process. Filters may be used to extract a subimage from a larger image, 
 select rows from a table, filter a table with a GTI time extension or a SAO
 region file, create or delete columns in a table, create an image by binning
 2 table columns, and convert IRAF format .imh or raw binary data files into 
 FITS images (see CFITSIO User's Guide for filtering syntax).

 Usage:
   BBarolo --fitscopy inputfile[filter] outputfile 

 Examples: 
   BBarolo --fitscopy in.fits out.fits                   (simple file copy)
   BBarolo --fitscopy in.fits[11:50,21:60] out.fits      (copy a subimage)
   BBarolo --fitscopy in.fits[-*,*] out.fits             (mirror reverse axis 0)
   BBarolo --fitscopy iniraf.imh out.fits                (IRAF image to FITS)
   BBarolo --fitscopy in.dat[i512,512] out.fit           (binary file to FITS)
   BBarolo --fitscopy in.fits[events][pi>35] out.fits    (copy rows with pi>35)
   BBarolo --fitscopy in.fits[events][bin X,Y] out.fits  (bin an image)

 NOTE: it may be necessary to enclose the input file name in single quote
 characters on some Unix shells.

fitsarith. Perform arithmetic operations between two FITS files or on a single FITS file. Type BBarolo --fitsarith for help:

$$ BBarolo --fitsarith

 BBarolo's FITSARITH FITS utility: 

 Perform an operation between two images or between an image and a number. 
 Supported operators are add, sub, mul, div (first character required). 

 Usage:
   BBarolo --fitsarith image1 { image2 | value } oper outimage 

 Examples: 
   BBarolo --fitsarith in1.fits in2.fits add out.fits  (add the 2 files)
   BBarolo --fitsarith in1.fits 1000.0 mul out.fits    (mult in1 by 1000)

 NOTE: it may be necessary to enclose the file names in single quote
 characters on some Unix shells.