NRAO Home > CASA > CASA Toolkit Reference Manual
image.fromfits - Function

1.1.1 Construct a CASA image by conversion from a FITS image file


Description

This function is used to convert a FITS disk image file (Float, Double, Short, Long are supported) to an CASA image file. If outfile is given, the image is written to the specified disk file. If outfile is unset, the Image tool is associated with a temporary image. This temporary image may be in memory or on disk, depending on its size. When you close the Image tool (with the close function) this temporary image is deleted.

This function reads from the FITS primary array (when the image is at the beginning of the FITS file; whichhdu=0), or an image extension (when the image is elsewhere in the FITS file, whichhdu > 0).

By default, any blanked pixels will be converted to a mask value which is false, and a pixel value that is NaN. If you set zeroblanks=T then the pixel value will be zero rather than NaN. The mask will still be set to false. See the function replacemaskedpixels if you need to replace masked pixel values after you have created the image.

Arguments





Inputs

outfile

Output image file name. Default is unset.

allowed:

string

Default:

infile

Input FITS disk file name. Must be specified.

allowed:

string

Default:

whichrep

If this FITS file contains multiple coordinate representations, which one should we read (0-based)

allowed:

int

Default:

0

whichhdu

If this FITS file contains multiple images, which one should we read (0-based).

allowed:

int

Default:

0

zeroblanks

If there are blanked pixels, set them to zero instead of NaN

allowed:

bool

Default:

false

overwrite

Overwrite (unprompted) pre-existing output file?

allowed:

bool

Default:

false

Returns
bool

Example

 
 
"""  
#  
print "\t----\t fromfits Ex 1 \t----"  
datapath=pathname+’/data/demo/Images/imagetestimage.fits’  
ia.fromfits(’./myimage’, datapath, overwrite=true)  
print ia.summary()  
s = ia.miscinfo()  
print s.keys()  #  prints any unrecognized field names  
ia.close()  
#  
"""  
 
 
The FITS image is converted to a \casa\ \imagefile\ and access is  
provided via the default \imagetool\ called {\stf ia}.  Any FITS  
header keywords which were not recognized or used are put in the  
miscellaneous information bucket accessible with the miscinfo function.  In  
the example we list the names of the fields in this record.  
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search