|
ERIS Pipeline Reference Manual 1.9.2
|
#include <sc_basic.h>Go to the source code of this file.
| #define | SC_COLDEPTH 10 |
| #define | SC_EXTRACOVER 5 |
| #define | SC_SAMPFAC 5. |
| #define | SC_LIMRELLAMVAR 0.01 |
| #define | SC_BINS_PER_FWHM 200. |
| #define | SC_KERNFAC 3. |
| cpl_error_code | sc_weights (cpl_table *skyspec, cpl_table *fitpar, cpl_table *groups, cpl_parameterlist *parlist) |
| cpl_error_code | sc_weights_initfitpar (cpl_table *fitpar, cpl_parameterlist *parlist, const cpl_table *groups) |
| cpl_error_code | sc_weights_getpixcontrib (cpl_table *skyspec, cpl_table *fitpar, cpl_table *groups, const cpl_parameterlist *parlist) |
| cpl_error_code | sc_weights_createwavegrid (cpl_table *groupspec, const cpl_table *skyspec) |
| cpl_error_code | sc_weights_getgrouplines (cpl_table *groupspec, cpl_table *fitpar, cpl_table *groups, const cpl_parameterlist *parlist, const char grouptype, const int group) |
| cpl_error_code | sc_weights_convolve (cpl_table *groupspec, const double fwhm, const double reflam, const double speedpar) |
| cpl_error_code | sc_weights_calckernel (cpl_array *kernel, const double fwhm) |
| cpl_error_code | sc_weights_rebinspec (cpl_table *skyspec, const cpl_table *groupspec) |
| cpl_error_code | sc_weights_fillgrouparrays (cpl_table *skyspec, const char grouptype, const int group) |
| cpl_error_code | sc_weights_normpixcontrib (cpl_table *skyspec, const char grouptype) |
| cpl_error_code | sc_weights_getdomgroups (cpl_table *skyspec, const cpl_parameterlist *parlist, const char grouptype) |
Header for library for preparing the line group weights of each pixel of the input sky spectrum
Definition in file sc_weights.h.
| #define SC_BINS_PER_FWHM 200. |
Bins per FWHM for integral of Gaussian
Definition at line 74 of file sc_weights.h.
| #define SC_COLDEPTH 10 |
Initial depth of array columns for line group weights
Definition at line 64 of file sc_weights.h.
| #define SC_EXTRACOVER 5 |
Extra pixels at both sides of the airglow model spectrum (pixel scale of input sky spectrum)
Definition at line 67 of file sc_weights.h.
| #define SC_KERNFAC 3. |
Radius of Gaussian kernel in FWHM/2
Definition at line 76 of file sc_weights.h.
| #define SC_LIMRELLAMVAR 0.01 |
Threshold for recalculation of kernel depending on relative change of wavelength
Definition at line 72 of file sc_weights.h.
| #define SC_SAMPFAC 5. |
Oversampling factor for airglow model spectrum
Definition at line 69 of file sc_weights.h.
| cpl_error_code sc_weights | ( | cpl_table * | skyspec, |
| cpl_table * | fitpar, | ||
| cpl_table * | groups, | ||
| cpl_parameterlist * | parlist | ||
| ) |
Derives line group weights for each pixel of the input sky spectrum.
INPUT:
| skyspec | CPL table with sky spectrum |
| groups | CPL table with airglow line information |
| parlist | input CPL parameter list |
OUTPUT:
| skyspec | sky spectrum with line group weights |
| fitpar | CPL table of fit parameters |
| groups | modified line table |
| parlist | parameter list complemented by weight-specific parameters |
ERRORS:
Definition at line 49 of file sc_weights.c.
References sc_weights_getpixcontrib(), and sc_weights_initfitpar().
Referenced by sc_skycorr_fit().
| cpl_error_code sc_weights_calckernel | ( | cpl_array * | kernel, |
| const double | fwhm | ||
| ) |
Calculates Gaussian kernel depending on the FWHM provided by the general parameter list. The number of kernel pixels is the upper odd integer number of the input FWHM times SC_KERNFAC. The sum of the kernel values is normalised to 1.
INPUT:
| fwhm | FWHM of Gaussian in pixels |
OUTPUT:
| kernel | CPL array with convolution kernel elements |
ERRORS:
Definition at line 755 of file sc_weights.c.
References SC_BINS_PER_FWHM, SC_KERNFAC, and SC_MAXLEN.
Referenced by sc_weights_convolve().
| cpl_error_code sc_weights_convolve | ( | cpl_table * | groupspec, |
| const double | fwhm, | ||
| const double | reflam, | ||
| const double | speedpar | ||
| ) |
Convolves line group spectrum with a wavelength-dependent Gaussian kernel. The scaling of the kernel width is forced by the assumption of constant resolution. The speedpar parameter rules the number of kernel calculations. It provides the relative wavelength change that causes a recalculation. If a constant kernel is desired, speedpar has to be set to HUGE_VAL.
INPUT:
| groupspec | CPL table with input line group spectrum |
| fwhm | width of Gaussian in pixels |
| reflam | reference wavelength for fwhm |
| speedpar | criterion for recalculation of kernel (relative change of kernel width) |
OUTPUT:
| groupspec | convolved spectrum |
ERRORS:
Definition at line 620 of file sc_weights.c.
References sc_basic_convolvewindow(), SC_MAXLEN, and sc_weights_calckernel().
Referenced by sc_weights_getpixcontrib().
| cpl_error_code sc_weights_createwavegrid | ( | cpl_table * | groupspec, |
| const cpl_table * | skyspec | ||
| ) |
Creates a wavelength grid for line group spectra. The original grid of the input sky spectrum is extended by SC_EXTRACOVER pixels on each margin and split up in SC_SAMPFAC smaller pixels for a better sampling. The output spectrum consists of three columns that provide the central wavelength, the lower wavelength limit, and the flux for each pixel. The latter is always zero.
INPUT:
| skyspec | CPL table with sky spectrum |
OUTPUT:
| groupspec | CPL table with wavelength grid for line group spectra |
ERRORS:
Definition at line 416 of file sc_weights.c.
References SC_EXTRACOVER, and SC_SAMPFAC.
Referenced by sc_weights_getpixcontrib().
| cpl_error_code sc_weights_fillgrouparrays | ( | cpl_table * | skyspec, |
| const char | grouptype, | ||
| const int | group | ||
| ) |
Writes ID and flux contribution of the provided group into pixel-specific arrays of the sky spectrum columns belonging to the given group type. The array size depends on the pixel with the highest number of contributing line groups. Unused array elements remain invalid.
INPUT:
| skyspec | CPL table with sky and line group spectrum |
| grouptype | line group type (either 'A' or 'B') |
| group | number of line group |
OUTPUT:
| skyspec | sky spectrum with updated pixel-specific group flux arrays |
ERRORS:
Definition at line 936 of file sc_weights.c.
References SC_LENLINE.
Referenced by sc_weights_getpixcontrib().
| cpl_error_code sc_weights_getdomgroups | ( | cpl_table * | skyspec, |
| const cpl_parameterlist * | parlist, | ||
| const char | grouptype | ||
| ) |
Gets the IDs of the dominating line group of each pixel and writes them into the sky spectrum table. A line group is only considered if it has a minimum weight of weightlim which is provided by the general parameter list. If such a group does not exist for a pixel, -99 is written.
INPUT:
| skyspec | CPL table of sky spectrum with pixel-specific group weight arrays |
| parlist | input CPL parameter list |
| grouptype | line group type (either 'A' or 'B') |
OUTPUT:
| skyspec | sky spectrum table with column of dominating groups |
ERRORS:
Definition at line 1089 of file sc_weights.c.
References SC_LENLINE.
Referenced by sc_weights_getpixcontrib().
| cpl_error_code sc_weights_getgrouplines | ( | cpl_table * | groupspec, |
| cpl_table * | fitpar, | ||
| cpl_table * | groups, | ||
| const cpl_parameterlist * | parlist, | ||
| const char | grouptype, | ||
| const int | group | ||
| ) |
Writes line fluxes of a selected group into line group spectrum if the group can be found in the wavelength range covered by the output spectrum. Moreover, for missing groups the relevance and fit flags in the fit parameter table are set to 0.
INPUT:
| groupspec | CPL table with wavelength grid for line group spectra |
| fitpar | CPL table of fit parameters |
| groups | CPL table with lines and group classification |
| parlist | input CPL parameter list |
| grouptype | line group type (either 'A' or 'B') |
| group | number of line group |
OUTPUT:
| groupspec | spectrum with the fluxes of a single line group |
| fitpar | table of fit parameters with updated fit flags |
ERRORS:
Definition at line 528 of file sc_weights.c.
References SC_LENLINE.
Referenced by sc_weights_getpixcontrib().
| cpl_error_code sc_weights_getpixcontrib | ( | cpl_table * | skyspec, |
| cpl_table * | fitpar, | ||
| cpl_table * | groups, | ||
| const cpl_parameterlist * | parlist | ||
| ) |
Calculates spectrum for each line group and gets group contributions to each pixel of the input sky spectrum. Depending on the parameter varfwhm, the line widths are constant or linearly-increasing with wavelength.
INPUT:
| skyspec | CPL table with sky spectrum |
| fitpar | CPL table of fit parameters |
| groups | CPL table with airglow line information |
| parlist | input CPL parameter list |
OUTPUT:
| skyspec | sky spectrum with line group weights |
| fitpar | table of fit parameters with adapted fit flags |
| groups | line list for wavelength range of sky spectrum only |
ERRORS:
Definition at line 253 of file sc_weights.c.
References SC_COLDEPTH, SC_LENLINE, SC_LIMRELLAMVAR, SC_SAMPFAC, sc_weights_convolve(), sc_weights_createwavegrid(), sc_weights_fillgrouparrays(), sc_weights_getdomgroups(), sc_weights_getgrouplines(), sc_weights_normpixcontrib(), and sc_weights_rebinspec().
Referenced by sc_weights().
| cpl_error_code sc_weights_initfitpar | ( | cpl_table * | fitpar, |
| cpl_parameterlist * | parlist, | ||
| const cpl_table * | groups | ||
| ) |
Creates table of fit parameters. There are table columns for parameter type, ID number, system flag, relevance flag, fit flag, value, fit error, estimate error, and number of lines. The parameter types are either the line groups 'A' and 'B' or 'w' for the coefficients of the Chebyshev polynomial for the wavelength grid correction. The number N is a counter that starts with 1 in the case of the line groups and with 0 in the case of the polynomial and the 
INPUT:
| parlist | input CPL parameter list |
| groups | CPL table with airglow line information |
OUTPUT:
| fitpar | CPL table of fit parameters |
| parlist | parameter list complemented by line group counts |
ERRORS:
Definition at line 88 of file sc_weights.c.
Referenced by sc_weights().
| cpl_error_code sc_weights_normpixcontrib | ( | cpl_table * | skyspec, |
| const char | grouptype | ||
| ) |
Divides group flux by flux sum for each pixel to get weights. The operation is performed for the sky spectrum group-weight column belonging to the given group type.
INPUT:
| skyspec | CPL table of sky spectrum with pixel-specific group flux arrays |
| grouptype | line group type (either 'A' or 'B') |
OUTPUT:
| skyspec | sky spectrum with pixel-specific group weight arrays |
ERRORS:
Definition at line 1027 of file sc_weights.c.
References SC_LENLINE.
Referenced by sc_weights_getpixcontrib().
| cpl_error_code sc_weights_rebinspec | ( | cpl_table * | skyspec, |
| const cpl_table * | groupspec | ||
| ) |
Rebins line group spectrum to wavelength grid of input sky spectrum. The resulting fluxes are written in two temporary columns in the sky spectrum: "f_group" for the selected group and "f_all" for the sum flux of all groups. This routine reverses the operations performed in sc_weights_createwavegrid.
INPUT:
| skyspec | CPL table with sky spectrum |
| groupspec | CPL table with line group spectrum |
OUTPUT:
| skyspec | CPL table with sky and rebinned line group spectrum |
ERRORS:
Definition at line 871 of file sc_weights.c.
References SC_EXTRACOVER, SC_MAXLEN, and SC_SAMPFAC.
Referenced by sc_weights_getpixcontrib().