extract_spectra

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

Extract one spectrum per IFU fibre from each 2D spectrogram to produce row-stacked 1D spectra, mosaicking the separate GMOS CCDs beforehand and adding an approximate wavelength solution to the headers afterwards. The results are also divided by any associated flat spectra, where available.

The combination of multiple operations here is a side effect of wrapping gfextract; at least the mosaicking & flat fielding are likely to be separated into their own steps in a later version.

Parameters:

inputs : DataFileList or DataFile

Input images from which to extract spectra (in which the individual detectors are not yet mosaicked). If flat fielding is to be performed, every input DataFile must already have an entry named ‘flat’ in its cals dictionary, corresponding to a processed detector+IFU flat (otherwise, flat fielding is omitted if there are no such associations). Likewise, if the fibre traces are to be taken from one or more reference files(s) (usually flats), rather than re-measured, every input must have an entry named ‘trace’ in its cals dictionary, pointing to a previous output file from this step.

out_names : str-like or list of str-like, optional

Names of output files containing extracted & flat-fielded spectra. If None (default), the names of the DataFile instances returned will be constructed from those of the input files, prefixed with ‘e’ as in the Gemini IRAF package.

startpos : int, optional

Starting column in which the peaks corresponding to each fibre are identified (when not using a reference image), before tracing the corresponding spectra in either direction along the wavelength axis. This is defined relative to the equally-sized sub-region(s) cut out by gfextract for the IFU slits (see the log file), rather than the full input image. The default is the middle column of each region (ie. of the useful wavelength range). This parameter is typically useful for avoiding localized artifacts, such as cosmic rays, that can be mistaken by apall for fibres when bright enough. The definition of this parameter is likely to change in a future version, such that the value will be an offset relative to the default column (currently awkward to implement, as the regions cut out by gfextract are unknown beforehand).

threshold : float, optional

Feature detection threshold for centring around initial peak positions. This is the minimum difference required between the lowest & highest pixel values in the surrounding region in order for the peak to be considered a feature (see IRAF center1d).

order : int, optional

Order of the fit used to trace each fibre centre as a function of position along the dispersion axis.

overlap_buffer : float, optional

Amount by which to extend the removal of any region where the slits overlap in 2-slit mode, as a fraction of the overlap (gfextract perovlap parameter). The default of 0.1 will remove 110% of the nominal overlap, while negative values will include some of the overlap region.

interact : bool, None

Identify the fibres interactively in IRAF? If None (default), interactivity is instead controlled by the package configuration dictionary (see below).

See “help gfextract” in IRAF for more detailed information. Note that the

behaviour of this step can depend on whether an IRAF database file already

exists from a previous run, causing the earlier results to be re-used.

Returns:

outimage : DataFileList

The extracted spectra produced by gfextract.