Source code for casatasks.data.importfits

#
# stub function definition file for docstring parsing
#

[docs]def importfits(fitsimage, imagename='', whichrep=0, whichhdu=-1, zeroblanks=True, overwrite=False, defaultaxes=False, defaultaxesvalues='[]', beam='[]'): r""" Convert an image FITS file into a CASA image [`Description`_] [`Examples`_] [`Development`_] [`Details`_] Parameters - fitsimage_ (path) - Name of input image FITS file - imagename_ (string='') - Name of output CASA image - whichrep_ (int=0) - If fits image has multiple coordinate reps, choose one. - whichhdu_ (int=-1) - If fits file contains multiple images, choose one (0 = first HDU, -1 = first valid image). - zeroblanks_ (bool=True) - Set blanked pixels to zero (not NaN) - overwrite_ (bool=False) - Overwrite output file if it exists? - defaultaxes_ (bool=False) - Add the default 4D coordinate axes where they are missing; value True requires setting defaultaxesvalues - defaultaxesvalues_ (variant='[]') - List of values to assign to added degenerate axes when defaultaxes==True (ra,dec,freq,stokes) - beam_ (variant='[]') - List of values to be used to define the synthesized beam [BMAJ,BMIN,BPA] (as in the FITS keywords) .. _Description: Description You can use the **importfits** task to import a FITS image into CASA image format. Note, the CASA viewer can read FITS images so you don’t need to do this if you just want to look at the image. The CASA FITS reader uses wcslib by Mark Calabretta and thus implements the latest FITS standard (3.0). The intention of both wcslib and the added CASA code is to accommodate certain common deviations from the standard and be forgiving rather than pedantic. In some cases, however, images deviating too far from the standard will not be readable and you might see error messages. Read these carefully and try to consult the FITS documentation ( https://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf ) to see how you have to change the header of your FITS image to make it sufficiently compliant with the standard. The inputs for **importfits** are: :: # importfits :: Convert an image FITS file into a CASA image fitsimage = '' # Name of input image FITS file imagename = '' # Name of output CASA image whichrep = 0 # If fits image has multiple coordinate reps, choose one. whichhdu = -1 # If its file contains multiple images, choose one # (0 = first HDU, -1 = first valid image). zeroblanks = True # Set blanked pixels to zero (not NaN) overwrite = False # Overwrite pre-existing imagename defaultaxes = False # Add the default 4D coordinate axes where they are missing; # value True requires setting defaultaxesvalues defaultaxesvalues = [] # List of values to assign to added degenerate axes when # defaultaxes==True (ra,dec,freq,stokes) beam = [] # List of values to be used to define the synthesized beam # [BMAJ,BMIN,BPA] (as in the FITS keywords) Here a description of the non-self-explanatory parameters: *whichrep* -- If the FITS image has multiple coordinate representations, this parameter lets you choose which one to use (numbering starts at 0). Example: whichrep=1 . *whichhdu* -- If the fits file contains multiple images, you can choose the header data unit by number. The value "-1" (default) chooses the first valid one. CASA images by default have a 4D coordinate system (ra, dec, stokes, freq). Your input image may not have that. Setting the parameter *defaultaxes* to True, will make **importfits** add the missing axes as degenerate (one-pixel) axes and will take the coordinate values for these axes from the list in the parameter *defaultaxesvalues* (ra,dec,stokes, freq). For existing axes, empty strings can be given as values. For the directions and spectral values, any valid angle/frequency expressions can be given. Example: defaultaxesvalues=['19h30m00', '-02d30m00', '88.5GHz', 'Q']. If the order of the fits files ins not ra, dec, stokes, freq, **imtrans** can be used to change the order. If your input image does not provide a beam or you want to override it, you can provde a list of values to be used to define the synthesized beam [BMAJ,BMIN,BPA] (as in the FITS keywords) in the parameter *beam*. Note that the FITS keywords typically list the BMAJ, BMIN and BPA in degrees, but they can be specified with other units in importfits. Example: beam=['0.35arcsec', '0.24arcsec', '25deg'] .. _Examples: Examples A straightforward implementation of **importfits**: :: importfits(fitsimage='ngc3256.fits', imagename='ngc3256.im', overwrite=True) Though the user may wish to explicitly set (or re-set), for example, the beam characteristics: :: importfits(fitsimage='ngc3256.fits', imagename='ngc3256.im', overwrite=True, beam=['0.35arcsec', '0.24arcsec', '25deg']) Which will force the BMIN, BMAX and BPA parameters to be 0.35", 0.24" and 25 degrees, respectively. .. _Development: Development No additional development details .. _Details: Parameter Details Detailed descriptions of each function parameter .. _fitsimage: | ``fitsimage (path)`` - Name of input image FITS file | Default: none | Example: fitsimage='3C273XC1.fits' .. _imagename: | ``imagename (string='')`` - Name of output CASA image | Default: none | Example: fitsimage='3C273XC1.image' .. _whichrep: | ``whichrep (int=0)`` - If fits image has multiple coordinate reps, choose one. | Default: 0 (means first) | Example: whichrep=1 .. _whichhdu: | ``whichhdu (int=-1)`` - If fits file contains multiple images, choose one | Default: -1 (use the first valid one) | NOTE: 0 = first HDU, -1 = first valid image | Example: whichhdu=1 .. _zeroblanks: | ``zeroblanks (bool=True)`` - Set blanked pixels to zero (not NaN) | Default: True | Options: True|False .. _overwrite: | ``overwrite (bool=False)`` - Overwrite output file if it exists? | Default: False | Options: False|True .. _defaultaxes: | ``defaultaxes (bool=False)`` - Add the default 4D coordinate axes where they are | missing | Default: False | Options: False|True | IMPORTANT: value True requires setting defaultaxesvalues .. _defaultaxesvalues: | ``defaultaxesvalues (variant='[]')`` - List of values to assign to added degenerate axes when | defaultaxes==True (ra,dec,freq,stokes) | Default: [] | For existing axes, empty strings can be given as | values. For the directions and spectral values, | any valid angle/frequency expressions can be | given. | Example: defaultaxesvalues=['19h30m00', | '-02d30m00', '88.5GHz', 'Q'] .. _beam: | ``beam (variant='[]')`` - List of values to be used to define the synthesized beam | [BMAJ,BMIN,BPA] (as in the FITS keywords) | Default: [] (i.e.take from FITS file) | Example: beam=['0.35arcsec', '0.24arcsec', | '25deg'] """ pass