X-shooter Pipeline Reference Manual 3.8.15
Macros | Functions
xsh_eqwidth_lib.h File Reference
#include <cpl.h>
#include <gsl/gsl_multifit.h>
#include <gsl/gsl_interp.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_multifit_nlin.h>
#include <gsl/gsl_sf_bessel.h>
#include "xsh_ngaussfdf.h"

Go to the source code of this file.

Macros

#define max(a, b)   (((a)>(b))?(a):(b))
 

Functions

cpl_error_code select_local_spec (cpl_table *spec_total, double ew_space, double lambda, cpl_table **spec_region)
 Select_local_spec.
 
cpl_size get_nm_to_index_scale (cpl_table *spec_total, double nm)
 
cpl_error_code esp_fit_lcont (cpl_table *spec_region, double cont_rejt, int cont_iter)
 Performs a local normalization of the spectrum region.
 
cpl_error_code esp_det_line (cpl_table *spec_region, double det_line_thres, double det_line_resol, int det_line_smwidth, cpl_table **line_table)
 Performs a local normalization of the spectrum region.
 
void find_left_right_continuum_pos (int *xind1, int *xind2, cpl_table *spec_region, double cont_rejt, double line)
 
void smooth (double vec[], long n, int w, double svec[])
 
double maxele_vec (double vec[], long nvec)
 
cpl_error_code esp_fit_ngauss (cpl_table *spec_cont_region, cpl_table *line_table, double fit_ngauss_width)
 Fit a list of absorption lines with n Gaussian profiles and compute the equivalent width of each line from the fit.
 
double check_ew (cpl_table *line_table, double line, double det_line_resol, int *index_line, int *n_lines, double *ew_error)
 
void deriv (double x[], double y[], double dy[], long n)
 
void fitngauss (double t[], double y[], double sigma[], long nvec, double acoef[], double acoef_er[], int para, int *status2)
 
cpl_error_code espda_create_line_table (cpl_table **tab, cpl_size size)
 Create a LINE table with a given row size.
 

Macro Definition Documentation

◆ max

#define max (   a,
 
)    (((a)>(b))?(a):(b))

Definition at line 24 of file xsh_eqwidth_lib.h.

Function Documentation

◆ check_ew()

double check_ew ( cpl_table *  line_table,
double  line,
double  det_line_resol,
int *  index_line,
int *  n_lines,
double *  ew_error 
)

Definition at line 403 of file xsh_eqwidth_lib.c.

◆ deriv()

void deriv ( double  x[],
double  y[],
double  dy[],
long  n 
)

Definition at line 476 of file xsh_eqwidth_lib.c.

References n, x, and y.

Referenced by esp_spec_deriv().

◆ esp_det_line()

cpl_error_code esp_det_line ( cpl_table *  spec_cont_region,
double  det_line_thres,
double  det_line_resol,
int  det_line_smwidth,
cpl_table **  line_table 
)

Performs a local normalization of the spectrum region.

Parameters
spec_cont_regionspectrum region table (normalized)
det_line_thresNormalized threshold for line acceptance The default value is 0.02
det_line_resolMinimum accepted separation between two lines (in Angstrom)
det_line_smwidthNumber of pixels in the boxcar to be averaged
Returns
CPL_ERROR_NONE if OK

This function detects absorption lines in a spectrum after normalizing it.

Definition at line 775 of file xsh_eqwidth_lib.c.

References esp_spec_deriv(), esp_spec_smooth(), espda_create_line_table(), n, x, y, and zeroscenterfind().

Referenced by test_spectrum_detect_lines().

◆ esp_fit_lcont()

cpl_error_code esp_fit_lcont ( cpl_table *  spec_region,
double  cont_rejt,
int  cont_iter 
)

Performs a local normalization of the spectrum region.

Parameters
spec_regionspectrum region table
cont-rejtRejection threshold for the continuum determination. The default value depends on the signal-to­-noise parameter for the interval around the line
cont-iterNumber of iterations to fit the continuum
Returns
CPL_ERROR_NONE if OK

This function updates the region of the spectra for the calculations with the normalization

Definition at line 671 of file xsh_eqwidth_lib.c.

References n, order, poly_fitn(), x, and y.

Referenced by test_spectrum_detect_lines().

◆ esp_fit_ngauss()

cpl_error_code esp_fit_ngauss ( cpl_table *  spec_cont_region,
cpl_table *  line_table,
double  fit_ngauss_width 
)

Fit a list of absorption lines with n Gaussian profiles and compute the equivalent width of each line from the fit.

Parameters
spec_cont_regionspectrum region table (normalized)
line_tabletable with the lines to be fitted
fit_ngauss_widthWidth of the interval used for fitting (nm)??? Currently being used as the guess sigma for the gaussian fitting
Returns
CPL_ERROR_NONE if OK

This function detects absorption lines in a spectrum after normalizing it.

Definition at line 332 of file xsh_eqwidth_lib.c.

References fitngauss(), and sigma.

◆ espda_create_line_table()

cpl_error_code espda_create_line_table ( cpl_table **  tab,
cpl_size  size 
)

Create a LINE table with a given row size.

Parameters
tabNew table
sizeRow size
Returns
CPL_ERROR_NONE ff OK

This functions creates a CPL table with structure LINE and a given row size.

Definition at line 588 of file xsh_eqwidth_lib.c.

References size.

Referenced by esp_det_line().

◆ find_left_right_continuum_pos()

void find_left_right_continuum_pos ( int *  xind1,
int *  xind2,
cpl_table *  spec_region,
double  cont_rejt,
double  line 
)

Definition at line 162 of file xsh_eqwidth_lib.c.

References n, x, and y.

◆ fitngauss()

void fitngauss ( double  t[],
double  y[],
double  sigma[],
long  nvec,
double  acoef[],
double  acoef_er[],
int  para,
int *  status2 
)

Definition at line 490 of file xsh_eqwidth_lib.c.

References ERR, expb_df(), expb_f(), expb_fdf(), FIT, N, n, data::para, s, sigma, data::t, x, SimAnneal::x, and y.

Referenced by esp_fit_ngauss().

◆ get_nm_to_index_scale()

cpl_size get_nm_to_index_scale ( cpl_table *  spec_total,
double  nm 
)

◆ maxele_vec()

double maxele_vec ( double  vec[],
long  nvec 
)

Definition at line 304 of file xsh_eqwidth_lib.c.

References max.

Referenced by zeroscenterfind().

◆ select_local_spec()

cpl_error_code select_local_spec ( cpl_table *  spec_total,
double  ew_space,
double  lambda,
cpl_table **  spec_region 
)

Select_local_spec.

Parameters
spec_1dspectrum table
ew_spaceparameter for the interval around the line
lineline center for the spectral region
spec_1d_outNumber of frames in the new frameset
Returns
CPL_ERROR_NONE if OK

This function returns a region of the spectra for the calculations

Definition at line 126 of file xsh_eqwidth_lib.c.

References get_index_from_spec(), and get_pixel_to_nm_scale().

Referenced by test_spectrum_detect_lines().

◆ smooth()

void smooth ( double  vec[],
long  n,
int  w,
double  svec[] 
)

Definition at line 243 of file xsh_eqwidth_lib.c.

References n.

Referenced by esp_spec_smooth(), and xsh_atrous().