lambda_calibrate

sofia_redux.instruments.fifi_ls.lambda_calibrate.lambda_calibrate(filename, obsdate=None, outdir=None, write=False, wavecal=None)[source]

Apply spectral calibration.

The procedure is:

  1. Read input file.

  2. Call fifi_ls.wave to calculate wavelength values and spectral widths in microns for each spexel.

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

The generated FITS file contains n_scan * 3 image extensions: DATA, STDDEV, and LAMBDA for each scan, named with a ‘_G{i}’ suffix for each grating scan index i. The LAMBDA arrays are always 25 x 16. The DATA and STDDEV arrays are 25 x 16 x n_ramp for OTF mode A nods, and 25 x 16 otherwise. If a SCANPOS_G{i} table is present in the input, it will also be attached unmodified to the output.

Parameters:
filenamestr

File to be wavelength-calibrated. Should have been generated by fifi_ls.combine_nods.

obsdatearray_like of int, optional

Date of observation. Intended for files that do not have the DATE-OBS keyword (and value) in the FITS primary header (early files do not). Format is [YYYY,MM,DD].

outdirstr, optional

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

writebool, optional

If True, write to disk and return the path to the output file. If False, return the HDUList. The output directory is the same as the directory of the input file.

wavecalpd.DataFrame, optional

DataFrame containing wave calibration data. May be supplied in order to remove the overhead of reading the FIFI_LS_WaveCal_Coeffs.txt file every iteration of this function.

Returns:
fits.HDUList or str

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