telluric_correct#

sofia_redux.instruments.fifi_ls.telluric_correct.telluric_correct(filename, atran_dir=None, atran_file=None, cutoff=0.6, skip_corr=False, write=False, outdir=None, narrow=False, hdr_ovr=True, restwav=0.0, redshift=0.0, use_ecmwf=True, ecmwf_dir=None, ozone_model=39, interpolated=True)[source]#

Correct spectra for atmospheric absorption features.

The procedure is:

  1. Identify ATRAN file to use based on altitude, zenith angle, and water vapor. If use_ecmwf is set, water vapor is retrieved from ECMWF reanalysis data. Otherwise header values are used. Smooth the ATRAN data to the spectral resolution of the input.

  2. Interpolate the atmospheric transmission data onto the wavelength value of each spexel. Divide the data at each point by the transmission value.

  3. Create FITS file and (optionally) write results to disk.

The output FITS file contains FLUX, STDDEV, LAMBDA, XS, YS, RA, and DEC arrays in the same dimensions as the input. Additionally, UNCORRECTED_FLUX and UNCORRECTED_STDDEV image extensions are appended, containing a copy of the input FLUX and STDDEV arrays. An interpolated ATRAN extension is also appended, matching the dimensions of LAMBDA. The full unsmoothed transmission data is also appended as an image extension, in a n_atran x 2 array, for reference.

Parameters:
filenamestr

FITS file to be telluric corrected. Should have been generated by fifi_ls.combine_grating_scans.

atran_dirstr, optional

Path to a directory containing ATRAN reference FITS files. If not provided, the default set of files packaged with the pipeline will be used.

atran_filestr, optional

Exact path to an ATRAN file to use directly. If provided, the normal file selection is skipped.

cutofffloat, optional

Used as the fractional transmission below which data will be set to NaN. Set to 0 to keep all data.

skip_corrbool, optional

If set, telluric correction will not be applied, but ATRAN spectra will still be attached to the output file.

writebool, optional

If True, write to disk and return the path to the output file. If False, return the HDUL. The output filename is created from the input filename, with the suffix ‘SCM’ replaced with ‘TEL’.

outdirstr, optional

Directory path to write output. If None, output files will be written to the same directory as the input files.

narrowbool, optional

The telluric correction value at the rest wavelength will be used for the complete cube. Only suitable for certain observations.

hdr_ovrbool, optional

If set, rest wavelength and redshift are not taken from the FITS header but provided manually via restwav and redshift.

restwavfloat, optional

Rest wavelength of the observed line for narrow line mode. Only used if hdr_ovr is set.

redshiftfloat, optional

Redshift z of the observed line for narrow line mode. Only used if hdr_ovr is set.

use_ecmwfbool, optional

If set, water vapor values will be retrieved from ECMWF reanalysis files instead of the header.

ecmwf_dirstr, optional

Path to directory containing ECMWF FITS files.

interpolatedbool, optional

If True (default), linearly interpolate between the four ATRAN files bracketing the observed ZA and WV. If False, use the single nearest-matching file.

Returns:
fits.HDUList or str

Either the HDU (if write is False) or the filename of the output file (if write is True)