shift_spectra

ndmapper.lib.gmos.spec.shift_spectra(*args, **kwargs)[source] [edit on github]

Apply a zero-point shift to the wavelength calibrations of the input spectra, eg. to correct the solution from a day-time arc spectrum for flexure with respect to science exposures, as determined from sky lines.

Currently, this is a bit of a placeholder step that just corrects zero points in an IRAF database and must be run prior to rectify_wavelength. This is useful for making a first-order correction to the arc, eg. so that QE correction will be performed accurately. It may additionally be necessary to correct for (a smaller amount of) mutual flexure between science exposures; at some point, this function will likely be generalized to allow adjusting the WCS as well, after rectification to linear wavelength.

The database file(s) to which the shifts are added will be those corresponding to the ‘REFSPEC1’ header keyword, if present, otherwise each database file is expected to have the same name as the input file, prefixed with ‘id’ and with its filename extension replaced by a 3-digit integer suffix (eg. ‘_001’), corresponding to the slit number. Where a reference spectrum is defined, corrections can be applied to it via any spectra that reference it, but doing so will overwrite any shift applied previously for other spectra that reference the same arc.

[To do: consider having this clone the solution and use the copy?]

Parameters:

inputs : DataFileList or DataFile

Spectra on which calibrate_wavelength (or IRAF gswavelength) has been run, to generate a wavelength database file.

shift : float or None, optional

Shift to apply to each aperture, in the units of the database file (normally Angstroms). If None, the ‘shift’ value from each input’s cals dictionary is used, where present, otherwise the value defaults to 0.

Returns:

DataFileList

The inputs, with adjusted wavelength zero points (currently just in the IRAF database).