ERIS Pipeline Reference Manual 1.8.15
sc_skycorr.c File Reference
#include <sc_skycorr.h>

Go to the source code of this file.

Functions

cpl_error_code sc_skycorr (cpl_parameterlist *parlist, cpl_table *scispec, cpl_table *skyspec, int product_depth)
 
cpl_error_code sc_skycorr_subcont (cpl_table *spec, cpl_table *linetab, cpl_parameterlist *parlist, const cpl_table *groups)
 
cpl_error_code sc_skycorr_fit (cpl_table *scispec, cpl_table *skyspec, cpl_table *groups, cpl_parameterlist *parlist, int product_depth)
 
cpl_error_code sc_skycorr_subsky (cpl_table *scispec)
 

Detailed Description

Routines for handling CMPFIT

Author
Stefan Noll & ESO In-Kind Team Innsbruck
Since
18 Feb 2011
Date
08 Sep 2013

Definition in file sc_skycorr.c.

Function Documentation

◆ sc_skycorr()

cpl_error_code sc_skycorr ( cpl_parameterlist *  parlist,
cpl_table *  scispec,
cpl_table *  skyspec,
int  product_depth 
)

This is the top-level routine of the sky correction code that subtracts an optimised 1D sky spectrum from an 1D science spectrum. The optimisation process is a CMPFIT-based fitting procedure that adapts airglow lines in the sky spectrum to those in the science spectrum. Object-related lines in the science spectrum should not be affected by this procedure. The sky continuum is taken from the sky spectrum without optimisation, since a separation of object and sky continuum in the science spectrum is not possible. All required information for the sky correction procedure is provided by an input ASCII parameter file.

INPUT:

Parameters
parfile_inname of parameter file

ERRORS:

  • Error in subroutine
  • see subroutines

Definition at line 48 of file sc_skycorr.c.

References sc_lines(), SC_MAXLEN, sc_skycorr_fit(), sc_skycorr_subcont(), sc_skycorr_subsky(), and sc_specdiss_init_linetab().

Referenced by eris_ifu_jitter_process_cubes().

◆ sc_skycorr_fit()

cpl_error_code sc_skycorr_fit ( cpl_table *  scispec,
cpl_table *  skyspec,
cpl_table *  groups,
cpl_parameterlist *  parlist,
int  product_depth 
)

CMPFIT-based fitting procedure to adapt the sky line spectrum to the science line spectrum.

INPUT:

Parameters
scispecCPL table with science spectrum
skyspecCPL table with sky spectrum
groupsCPL table with airglow line information
parlistgeneral CPL parameter list

OUTPUT:

Parameters
scispecscience and best-fit modified sky spectrum
skyspecsky spectrum with line group weights
groupsmodified line table
parlistparameter list with additional entries

ERRORS:

Definition at line 330 of file sc_skycorr.c.

References sc_mpfit(), sc_mpfit_freememresult(), and sc_weights().

Referenced by sc_skycorr().

◆ sc_skycorr_subcont()

cpl_error_code sc_skycorr_subcont ( cpl_table *  spec,
cpl_table *  linetab,
cpl_parameterlist *  parlist,
const cpl_table *  groups 
)

Subtracts continuum from a spectrum and derives FWHM of spectral lines in this spectrum.

The FWHM is derived by an iterative procedure that identifies isolated lines, subtracts the continuum from these lines, and derives a clipped mean FWHM. Then, the resulting line width is used for another line search and so on. The procedure stops either if the relative change of the FWHM between two iterations is below the 'ltol' value from the input parameter list or after the 10th iteration.

The list of line pixels identified by means of the first derivative of the line flux is supplemented by pixels belonging to lines taken from the airglow line lists. The number of pixels per line depends on the FWHM derived before. Only lines are considered that have peak fluxes above a threshold. If desired (parameter 'fluxlim' = -1), the flux limit will be searched by an iterative procedure which tries to find the best compromise between sufficient continuum pixels and a high number of considered lines. In the case of a positive value for 'fluxlim', this value is multiplied by the median flux of the already identified lines in order to obtain the actual threshold. Factors in the order of 0.01 are expected to work for most kind of spectra.

INPUT:

Parameters
specCPL table with spectrum
linetabCPL table for information on detected lines
parlistgeneral CPL parameter list
groupsCPL table with airglow line information

OUTPUT:

Parameters
specspectrum with separation of lines and continuum
linetabCPL table with information on detected lines
parlistparameter list with updated line FWHM and relative line flux limit

ERRORS:

  • see subroutines

Definition at line 134 of file sc_skycorr.c.

References sc_basic_arr2col(), sc_basic_col2arr(), sc_contsub(), sc_contsub_check(), sc_contsub_identcont(), sc_contsub_skipthermir(), sc_fwhmest(), and sc_specdiss_find_emissionlines().

Referenced by sc_skycorr().

◆ sc_skycorr_subsky()

cpl_error_code sc_skycorr_subsky ( cpl_table *  scispec)

Subtracts sky continuum and fit-optimised sky line flux from science spectrum. The resulting sky-corrected flux is written into the new column "scflux". If an error occurred before, the flux correction is not carried out. If flux error and mask column exist in the input spectra, the effect of sky subtraction on these columns is also considered. The resulting columns are labelled "scdflux" and "scmask" in this case.

INPUT:

Parameters
scispecCPL table with science spectrum and best-fit modified sky spectrum

OUTPUT:

Parameters
scispecdata table with column for sky-subtracted flux

ERRORS:

  • none

Definition at line 450 of file sc_skycorr.c.

Referenced by sc_skycorr().