convertwaiveredfits: Convert a waivered FITS file to various other formats.
License: | |
---|---|
http://www.stsci.edu/resources/software_hardware/pyraf/LICENSE | |
Syntax From the command line: | |
convertwaiveredfits.py [-hm] [-o <outputFileName>,...] FILE ... |
Convert the waivered FITS files (FILEs) to various formats. The default conversion format is multi-extension FITS.
Options: | |
---|---|
-h, --help | print this help message and exit |
-v, --verbose | turn on verbose output |
-m, --multiExtensionConversion | |
convert to multi-extension FITS format (Default) | |
-o, --outputFileName | |
comma separated list of output file specifications one per input FILE Default: input file specification with the last character of the base name changed to h in multi-extension FITS format |
Conversion of a WFPC2 waivered FITS file obtained from the HST archive:
convertwaiveredfits u9zh010bm_c0f.fits
This will convert the waivered FITS file u9zh010bm_c0f.fits to multi-extension FITS format and generate the output file u9zh010bm_c0h.fits.
Conversion of multiple FITS files can be done using:
convertwaiveredfits -o out1.fits,out2.fits
u9zh010bm_c0f.fits u9zh010bm_c1f.fits
This will convert the waivered FITS files u9zh010bm_c0f.fits and u9zh010bm_c1f.fits to multi-extension FITS format and generate the output files out1.fits and out2.fits
Python Syntax: | |
---|---|
You can run this code interactively from within Python using the syntax: >>> from pytools import convertwaiveredfits
>>> fobj = convertwaiveredfits.convertwaiveredfits(waiveredObject,
>>> outputFileName=None,
>>> forceFileOutput=False,
>>> convertTo='multiExtension',
>>> verbose=False)
|
The returned object fobj is a PyFITS object using the multi-extension FITS format.
force the generation of an output file when the outputFileName parameter is None; the output file specification will be the same as the input file specification with the last character of the base name replaced with the character h in multi-extension FITS format.
Default: False
>>> import convertwaiveredfits
>>> hdulist = convertwaiveredfits.convertwaiveredfits('u9zh010bm_c0f.fits',
forceFileOutput=True)
this will convert the waivered FITS file u9zh010bm_c0f.fits to multi-extension FITS format and write the output to the file u9zh010bm_c0h.fits; the returned HDUList is in multi-extension FITS format
>>> import convertwaiveredfits
>>> inFile = open('u9zh010bm_c0f.fits',mode='rb')
>>> hdulist = convertwaiveredfits.convertwaiveredfits(inFile,
'out.fits')
this will convert the waivered FITS file u9zh010bm_c0f.fits to multi-extension FITS format and write the output to the file out.fits; the returned HDUList is in multi-extension FITS format
>>> import pyfits
>>> import convertwaiveredfits
>>> inHdul = pyfits.open('u9zh010bm_c0f.fits')
>>> hdulist = convertwaiveredfits.convertwaiveredfits(inHdul)
this will convert the waivered FITS file u9zh010bm_c0f.fits to multi-extension FITS format; no output file is generated; the returned HDUList is in multi-extension format
Convert the input waivered FITS object to various formats. The default conversion format is multi-extension FITS. Generate an output file in the desired format if requested.
Parameters:
- waiveredObject input object representing a waivered FITS file;
- either a pyfits.HDUList object, a file object, or a file specification
- outputFileName file specification for the output file
- Default: None - do not generate an output file
- forceFileOutput force the generation of an output file when the
outputFileName parameter is None; the output file specification will be the same as the input file specification with the last character of the base name replaced with the character h in multi-extension FITS format.
Default: False
- convertTo target conversion type
- Default: ‘multiExtension’
- verbose provide verbose output
- Default: False
Returns:
hdul an HDUList object in the requested format.
Exceptions:
ValueError Conversion type is unknown
Convert the input waivered FITS object to a multi-extension FITS HDUList object. Generate an output multi-extension FITS file if requested.
Parameters:
- waiveredObject input object representing a waivered FITS file;
- either a pyfits.HDUList object, a file object, or a file specification
- outputFileName file specification for the output file
- Default: None - do not generate an output file
- forceFileOutput force the generation of an output file when the
- outputFileName parameter is None; the output file specification will be the same as the input file specification with the last character of the base name replaced with the character ‘h’. Default: False
- verbose provide verbose output
- Default: False
Returns:
mhdul an HDUList object in multi-extension FITS format.
Exceptions:
- TypeError Input object is not a HDUList, a file object or a
- file name
readgeis: Read GEIS file and convert it to a FITS extension file.
License: http://www.stsci.edu/resources/software_hardware/pyraf/LICENSE
Usage:
readgeis.py [options] GEISname FITSname
GEISname is the input GEIS file in GEIS format, and FITSname is the output file in FITS format. GEISname can be a directory name. In this case, it will try to use all *.??h files as input file names.
If FITSname is omitted or is a directory name, this task will try to construct the output names from the input names, i.e.:
abc.xyh will have an output name of abc_xyf.fits
Options: | |
---|---|
-h | print the help (this text) |
Example: | |
---|---|
If used in Pythons script, a user can, e. g.:
>>> import readgeis
>>> hdulist = readgeis.readgeis(GEISFileName)
(do whatever with hdulist)
>>> hdulist.writeto(FITSFileName)
The most basic usage from the command line:
readgeis.py test1.hhh test1.fits
This command will convert the input GEIS file test1.hhh to a FITS file test1.fits.
From the command line:
readgeis.py .
this will convert all *.??h files in the current directory to FITS files (of corresponding names) and write them in the current directory.
Another example of usage from the command line:
readgeis.py "u*" "*"
this will convert all u*.??h files in the current directory to FITS files (of corresponding names) and write them in the current directory. Note that when using wild cards, it is necessary to put them in quotes.
Parse two input arguments and return two lists of file names
Input GEIS files “input” will be read and a HDUList object will be returned.
The user can use the writeto method to write the HDUList object to a FITS file.
For STScI GEIS files, need to do extra steps.
For STScI GEIS files, need to do extra steps.
The check_files module provides functions to perform verification of input file formats for use in betadrizzle. This set of functions also includes format conversion functions to convert GEIS or waiver-FITS HST images into multi-extension FITS (MEF) files.
The list of science files should match the list of ivm files at the end.
Only for ACS, and STIS, check NGOODPIX If all pixels are ‘bad’ on all chips, exclude this image from further processing. Similar checks requiring comparing ‘driz_sep_bits’ against WFPC2 c1f.fits arrays and NICMOS DQ arrays will need to be done separately (and later).
Insure that the SCI headers contains all the necessary photometry keywords, moving them into the extension header if necessary. This only moves keywords from the PRIMARY header if the keywords do not already exist in the SCI header.
Removes files with EXPTIME==0 from filelist.
Checks if a file is in WAIVER of GEIS format and converts it to MEF
Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image.
Purpose : | |
---|---|
Split a STIS association file into multiple imset MEF files. |
Split the corresponding spt file if present into single spt files. If an spt file can’t be split or is missing a Warning is printed.
Returns : | |
---|---|
names: list :
|
Several kw which are usuall yin the primary header are in the extension header for STIS. They are copied to the primary header for convenience. List if kw: ‘DATE-OBS’, ‘EXPEND’, ‘EXPSTART’, ‘EXPTIME’
Input: A stis multiextension file Output: Number of stis science extensions in input
Removes files flagged to be removed from the input filelist. Removes the corresponding ivm files if present.
Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image.