Package ivs :: Package inout :: Module fits
[hide private]
[frames] | no frames]

Module fits

source code

Read and write FITS files.

Functions [hide private]
    Input
array, array(, dict)
read_spectrum(filename, return_header=False)
Read a standard 1D spectrum from the primary HDU of a FITS file.
source code
array, array, array, array(, header)
read_corot(fits_file, return_header=False, type_data='hel', remove_flagged=True)
Read CoRoT data from a CoRoT FITS file.
source code
 
read_fuse(ff, combine=True, return_header=False)
Read FUSE spectrum.
source code
 
read_iue(filename, return_header=False)
Read IUE spectrum
source code
    Generic reading
 
read2recarray(fits_file, ext=1, return_header=False)
Read the contents of a FITS file to a record array.
source code
    Output
 
write_primary(filename, data=None, header_dict={})
Initiate a FITS file by writing to the primary HDU.
source code
 
write_recarray(recarr, filename, header_dict={}, units={}, ext='new', close=True)
Write or add a record array to a FITS file.
source code
 
write_array(arr, filename, names=(), units=(), header_dict={}, ext='new', close=True)
Write or add an array to a FITS file.
source code
Variables [hide private]
  logger = logging.getLogger("IO.FITS")
Function Details [hide private]

read_spectrum(filename, return_header=False)

source code 

Read a standard 1D spectrum from the primary HDU of a FITS file.

Parameters:
  • filename (str) - FITS filename
  • return_header (bool) - return header information as dictionary
Returns: array, array(, dict)
wavelength, flux(, header)

read_corot(fits_file, return_header=False, type_data='hel', remove_flagged=True)

source code 

Read CoRoT data from a CoRoT FITS file.

Both SISMO and EXO data are recognised and extracted accordingly.

type_data is one of:

  • type_data='raw'
  • type_data='hel': heliocentric unequidistant
  • type_data='helreg': heliocentric equidistant
Parameters:
  • fits_file (string) - CoRoT FITS file name
  • return_header (bool) - return header information as dictionary
  • type_data (string (one of 'raw','hel' or 'helreg')) - type of data to return
  • remove_flagged (True) - remove flagged datapoints
Returns: array, array, array, array(, header)
CoRoT data (times, flux, error, flags)

read_fuse(ff, combine=True, return_header=False)

source code 

Read FUSE spectrum.

Modified JD: JD-2400000.5.

Do 'EXPEND'-'EXPSTART'

V_GEOCEN,V_HELIO

ANO: all night only: data obtained during orbital night (highest SNR when airglow is not an issue) ALL: all: highest SNR with minimal airglow contamination

Preference of ANO over ALL for science purpose.

Use TTAGfcal files.

read_iue(filename, return_header=False)

source code 

Read IUE spectrum

Instrumental profiles: http://starbrite.jpl.nasa.gov/pds/viewInstrumentProfile.jsp?INSTRUMENT_ID=LWR&INSTRUMENT_HOST_ID=IUE

Better only use .mxlo for reliable absolute calibration!!

LWP

- Large-aperture spectral resolution is best between 2700 and 2900 A
with an average FWHM of 5.2 A and decreases to approximately 8.0 A on
either side of this range. Small-aperture resolution is optimal
between 2400 and 3000 A with an average FWHM of 5.5 A and decreases to
8.1 A at the extreme wavelengths.

SWP

- The best resolution occurs around 1200 A, with a FWHM of 4.6 A in the
large aperture and 3.0 A in the small aperture, and gradually worsens
towards longer wavelengths: 6.7 A at 1900 A in the large aperture and
6.3 A in the small. On average, the small-aperture resolution is
approximately 10% better than the large-aperture resolution.

read2recarray(fits_file, ext=1, return_header=False)

source code 

Read the contents of a FITS file to a record array.

Should add a test that the strings were not chopped of...

write_primary(filename, data=None, header_dict={})

source code 

Initiate a FITS file by writing to the primary HDU.

If data is not given, a 1x1 zero array will be added.

write_recarray(recarr, filename, header_dict={}, units={}, ext='new', close=True)

source code 

Write or add a record array to a FITS file.

If 'filename' refers to an existing file, the record array will be added (ext='new') to the HDUlist or replace an existing HDU (ext=integer). Else, a new file will be created.

Units can be given as a dictionary with keys the same names as the column names of the record array.

A header_dictionary can be given, it is used to update an existing header or create a new one if the extension is new.

write_array(arr, filename, names=(), units=(), header_dict={}, ext='new', close=True)

source code 

Write or add an array to a FITS file.

If 'filename' refers to an existing file, the list of arrays will be added (ext='new') to the HDUlist or replace an existing HDU (ext=integer). Else, a new file will be created.

Names and units should be given as a list of strings, in the same order as the list of arrays.

A header_dictionary can be given, it is used to update an existing header or create a new one if the extension is new.

Instead of writing the file, you can give a hdulist and append to it. Supply a HDUList for 'filename', and set close=False