ERIS Pipeline Reference Manual 1.8.15
sc_specdiss.c File Reference

programme to find emission lines in spectra More...

#include <sc_specdiss.h>

Go to the source code of this file.

cpl_error_code sc_specdiss_find_emissionlines (cpl_table *input_spectrum, cpl_table *linetab, cpl_parameterlist *parlist, const cpl_table *groups)
 
cpl_error_code sc_specdiss_find_isolatedlines (cpl_table *linetab, cpl_table *input_spectrum, cpl_parameterlist *parlist)
 
cpl_error_code sc_specdiss_find_localmaxima (cpl_table *input_table, char *newcolname, char *colname, const double lower_threshold, const double upper_threshold)
 
cpl_error_code sc_specdiss_find_valuesoutside (cpl_table *input_table, char *newcolname, char *colname, const double lowlim, const double uplim)
 
int sc_specdiss_count_lines (const cpl_table *intable)
 
cpl_error_code sc_specdiss_create_hist (cpl_table *hist, const cpl_table *input_table, char *col_name, const int n_bins)
 
void sc_specdiss_init_linetab (cpl_table *linetab)
 
cpl_error_code sc_specdiss_merge_speclinelist (cpl_table *spec, const cpl_table *groups, const cpl_parameterlist *parlist)
 
cpl_error_code sc_specdiss_identify_airglowlines (cpl_table *spec)
 
cpl_error_code sc_specdiss_find_valuesabove (cpl_table *input_table, char *newcolname, char *colname, const double lowlim)
 

Detailed Description

programme to find emission lines in spectra

Author
Wolfgang Kausch, Stefan Noll, & ESO In-Kind Team Innsbruck
Since
01 Feb 2011
Date
17 Sep 2013

Definition in file sc_specdiss.c.

Function Documentation

◆ sc_specdiss_count_lines()

int sc_specdiss_count_lines ( const cpl_table *  intable)

Routine to count detected line peaks, i.e. counting the # of rows flagged with a value > 0 in column "peaks" of intable

INPUT:

Parameters
intableinput CPL table

OUTPUT:

Returns
number of detected line peaks

Definition at line 866 of file sc_specdiss.c.

◆ sc_specdiss_create_hist()

cpl_error_code sc_specdiss_create_hist ( cpl_table *  hist,
const cpl_table *  input_table,
char *  col_name,
const int  n_bins 
)

Routine to create a histogram binning with n_bins from a choosable column of an input CPL table. The histogram data is stored into a CPL table

INPUT:

Parameters
histCPL table to be filled with histogram information
input_tabletable containing column "col_name"
col_namecolumn of input table to be used for binning
n_bins# of histogram bins

OUTPUT:

Parameters
histCPL table with histogram information (bins/counts)

ERRORS:

  • CPL_ERROR_NONE: no error occurred

Definition at line 894 of file sc_specdiss.c.

◆ sc_specdiss_find_emissionlines()

cpl_error_code sc_specdiss_find_emissionlines ( cpl_table *  input_spectrum,
cpl_table *  linetab,
cpl_parameterlist *  parlist,
const cpl_table *  groups 
)

This routine is aimed to detect line peaks in an input spectrum to separate pixels belonging to lines and to the continuum. The lines are finally separated in isolated/blended lines, the first being used to determine a rough estimate of the FWHM of the spectrum.

The input spectrum has to be a CPL table containing (at least) the following columns:

 col #1: lambda
 col #2: flux

The wavelength dimension must be [micron], the flux is arbitrary. An additional column labelled "class" is added to the spectrum table, which is used to classify the single pixels in the following way:

 0 = Continuum
 1 = Line pixel
 2 = Line peak
 3 = Isolated line peak

The second input parameter must be an empty CPL table, but already initialised with sc_specdiss_init_linetab(). This table is filled with information about the detected lines (see sc_specdiss_find_isolatedlines).

INPUT:

Parameters
input_spectrumtable containing input spectra
linetabempty table to be filled with line information
parlistCPL parameter list containing information of the parameter file
groupsCPL table with airglow line information

OUTPUT:

ERRORS:

  • CPL_ERROR_NONE: no error occurred
  • CPL_ERROR_ILLEGAL_INPUT: missing column "lambda" or "flux" in input spectrum, zero length input spectrum

Definition at line 59 of file sc_specdiss.c.

References SC_MAXLEN, sc_specdiss_find_isolatedlines(), sc_specdiss_find_localmaxima(), sc_specdiss_identify_airglowlines(), sc_specdiss_merge_speclinelist(), and SC_THERMIRLIM.

Referenced by sc_skycorr_subcont().

◆ sc_specdiss_find_isolatedlines()

cpl_error_code sc_specdiss_find_isolatedlines ( cpl_table *  linetab,
cpl_table *  input_spectrum,
cpl_parameterlist *  parlist 
)

This programme searches for isolated lines (required for determining the FWHM) in an input spectrum.

The following two criteria to identify an isolated line are applied:

 (1) Distance to neighbouring line: larger / equal
         [min_line_dist_fac] * [measured FWHM] (in px);
     For first line: = distance to spectrum start (in px),
         last  line: = distance to spec end
 (2) Symmetry of line shape: # pixels left of peak = # pixels on
     the right hand side (+/- 1 px)

The input spectrum must be a CPL table containing (at least) the following columns:

 col #1: lambda
 col #2: flux
 col #3: class

The column "class" finally contains information on the pixel type in following way:

 0 = Continuum
 1 = Line pixel
 2 = Line peak
 3 = Isolated line peak (used for FWHM determination)

Additionally, the CPL table linetab is filled with the following information:

 col #1:  width          - line width [pixels]
 col #2:  peak_loc       - Peak location [pixels]
 col #3:  peak_lam       - Peak location [wavelength]
 col #4:  peak_flux      - Flux of line peak pixel
 col #5:  px_bef         - number of line pixels before line peak
 col #6:  px_aft         - number of line pixels after line peak
 col #7:  line_px_start  - first pixel of line
 col #8:  line_px_end    - last pixel of line
 col #9:  dist_bef       - distance to previous line [pixel]
 col #10: dist_aft       - distance to subsequent line [pixels]
 col #11: isol_flag      - flag indicating an isol. line
                           (0=no / 1=yes)
 col #12: fwhm           - Full Width Half Maximum column (to be
                           filled later)
 col #13: line_list      - Line list value:
                                 =0 : not present
                                 >0 : # of linelist lines in pixel
Note
In the case of a wavelength-dependent line width (varfwhm = 1), the measured fwhm and peak_flux are modified in the way as the line would be moved to the centre of the wavelength range of the input spectrum.

INPUT:

Parameters
linetabtable to be filled with information on the lines
input_spectrumtable containing input spectra
parlistCPL parameter list containing information of the parameter file

OUTPUT:

Parameters
linetabinformation about the detected lines is stored to this table
input_spectrumspectrum table col "class" is filled

ERRORS:

  • CPL_ERROR_NONE: no error occurred

Definition at line 346 of file sc_specdiss.c.

Referenced by sc_specdiss_find_emissionlines().

◆ sc_specdiss_find_localmaxima()

cpl_error_code sc_specdiss_find_localmaxima ( cpl_table *  input_table,
char *  newcolname,
char *  colname,
const double  lower_threshold,
const double  upper_threshold 
)

Routine to search for local maxima below and above two thresholds within a column table. It is used to identify line peaks within a range of pixels belonging to a single line.

INPUT:

Parameters
input_tabletable containing input spectra
newcolnametable column to be added to input_table
colnamename of column to be used for search
lower_thresholdlower threshold for search
upper_thresholdupper threshold for search

OUTPUT:

Parameters
input_tablean additional column is added to the input table
newcolnametable column to be added to input_table containing search results

ERRORS:

  • CPL_ERROR_NONE: no error occurred

Definition at line 634 of file sc_specdiss.c.

References SC_MAXLEN, sc_specdiss_find_valuesoutside(), and SC_THERMIRLIM.

Referenced by sc_specdiss_find_emissionlines().

◆ sc_specdiss_find_valuesabove()

cpl_error_code sc_specdiss_find_valuesabove ( cpl_table *  input_table,
char *  newcolname,
char *  colname,
const double  lowlim 
)

Routine to search for values within a column table: lowlim <= VALUES

An additional column (2nd input parameter) is added to the input table, rows fulfilling the condition are flagged (value=1, =0 otherwise).

INPUT:

Parameters
input_tabletable containing input spectra
newcolnamecolumn to be added to input table containing search results
lowlimlower threshold
colnamecolumn to be used for search

OUTPUT:

Parameters
input_tablean additional column is added to the input table
newcolnametable column to be added to input_table containing search results

ERRORS:

  • CPL_ERROR_NONE: no error occurred

Definition at line 1234 of file sc_specdiss.c.

◆ sc_specdiss_find_valuesoutside()

cpl_error_code sc_specdiss_find_valuesoutside ( cpl_table *  input_table,
char *  newcolname,
char *  colname,
const double  lowlim,
const double  uplim 
)

Routine to search for entries in a table column fulfilling the following criteria:

 entry <= lowlim && entry >= uplim

An additional column (2nd input parameter) is added to the input table, rows fulfilling the condition are flagged:

 value = -1,  if entry <= lowlim
 value =  1,  if entry >= uplim
 value =  0,  otherwise

INPUT:

Parameters
input_tabletable containing input spectra
newcolnamecolumn to be added to input table containing search results
lowlimlower threshold
uplimupper threshold
colnamecolumn to be used for search

OUTPUT:

Parameters
input_tablean additional column is added to the input table
newcolnametable column to be added to input_table containing search results

ERRORS:

  • CPL_ERROR_NONE: no error occurred

Definition at line 802 of file sc_specdiss.c.

Referenced by sc_specdiss_find_localmaxima().

◆ sc_specdiss_identify_airglowlines()

cpl_error_code sc_specdiss_identify_airglowlines ( cpl_table *  spec)

Identifies airglow lines in spectrum and updates 'linelist' column

INPUT:

Parameters
specCPL table with spectrum

OUTPUT:

Parameters
specspectrum table with updated 'linelist' column

Definition at line 1202 of file sc_specdiss.c.

Referenced by sc_specdiss_find_emissionlines().

◆ sc_specdiss_init_linetab()

void sc_specdiss_init_linetab ( cpl_table *  linetab)

Routine to initialise CPL table containing all information about the detected lines. The following columns are added:

 col #1:  width          - line width [pixels]
 col #2:  peak_loc       - Peak location [pixels]
 col #3:  peak_lam       - Peak location [wavelength]
 col #4:  peak_flux      - Flux of line peak pixel
 col #5:  px_bef         - number of line pixels before line peak
 col #6:  px_aft         - number of line pixels after line peak
 col #7:  line_px_start  - first pixel of line
 col #8:  line_px_end    - last pixel of line
 col #9:  dist_bef       - distance to previous line [pixel]
 col #10: dist_aft       - distance to subsequent line [pixels]
 col #11: isol_flag      - flag indicating an isol. line
                           (0=no / 1=yes)
 col #12: fwhm           - Full Width Half Maximum column
 col #13: line_list      - Line list value:
                                 =0 : not present
                                 >0 : # of linelist lines in pixel

INPUT:

Parameters
linetabempty CPL table

OUTPUT:

Parameters
linetabtable with initialised columns for information on detected lines

Definition at line 974 of file sc_specdiss.c.

Referenced by sc_skycorr().

◆ sc_specdiss_merge_speclinelist()

cpl_error_code sc_specdiss_merge_speclinelist ( cpl_table *  spec,
const cpl_table *  groups,
const cpl_parameterlist *  parlist 
)

Routine to read line list and merge line list with input spectrum. The line list is read from a file, all lines of the list are marked in the column "linelist" of the input spectrum table in the following way:

 1 = line list pixel
 2 = line list peak

INPUT:

Parameters
specCPL table with input spectrum
groupsCPL table with airglow line information
parlistparameter list containing file name of line list

OUTPUT:

Parameters
specCPL table with initialised columns for information on detected lines

Definition at line 1023 of file sc_specdiss.c.

Referenced by sc_specdiss_find_emissionlines().