CR2RE Pipeline Reference Manual 1.6.7
Functions
Etalon related

Functions

cpl_vector * cr2res_etalon_get_local_maxima (const cpl_vector *in, cpl_vector **left_edges, cpl_vector **right_edges)
 Find local maxima in a 1D array. This function finds all local maxima in a 1D array and returns the indices for their edges and midpoints (rounded down for even plateau sizes).
 
cpl_vector * cr2res_etalon_select_by_peak_distance (const cpl_vector *peaks, const cpl_vector *peak_heights, float distance)
 Selects the highest peaks that are atleast distance pixel apart.
 
cpl_vector * cr2res_etalon_find_peaks (const cpl_vector *in, double height, double distance)
 Detect peaks from a 1d periodic signal and store their positions.
 
cpl_polynomial * cr2res_etalon_wave_2d (cpl_bivector **spectra, cpl_bivector **spectra_err, cpl_polynomial **wavesol_init, cpl_array **wavesol_init_err, int *orders, int *traces_nb, int ninputs, cpl_size degree_x, cpl_size degree_y, int zp_order, int display, cpl_array **wavelength_error, cpl_table **line_diagnostics)
 Create the 2d wavecal fit using etalon peaks.
 

Detailed Description

Function Documentation

◆ cr2res_etalon_find_peaks()

cpl_vector * cr2res_etalon_find_peaks ( const cpl_vector *  in,
double  height,
double  distance 
)

Detect peaks from a 1d periodic signal and store their positions.

Parameters
inThe 1d signal as a vector
heightThe minimum height of each peak
distanceThe minimum distance between peaks
Returns
The vector with the maxima positions

Loosely based on scipy.signal.find_peaks

Definition at line 466 of file cr2res_etalon.c.

References cr2res_etalon_get_local_maxima(), and cr2res_etalon_select_by_peak_distance().

Referenced by cr2res_etalon_wave_2d(), and cr2res_slit_curv_compute_order_trace().

◆ cr2res_etalon_get_local_maxima()

cpl_vector * cr2res_etalon_get_local_maxima ( const cpl_vector *  in,
cpl_vector **  left_edges,
cpl_vector **  right_edges 
)

Find local maxima in a 1D array. This function finds all local maxima in a 1D array and returns the indices for their edges and midpoints (rounded down for even plateau sizes).

Parameters
inThe 1d signal as a vector
left_edges[out] left edge positions of the peaks
right_edges[out] right edge positions of the peaks
Returns
The vector with the maxima positions

The left_edge and right_edge vectors need to be deleted afterwards Note that the edges here refer to points with exactly the same value, not the width of the gaussian peak

Definition at line 278 of file cr2res_etalon.c.

Referenced by cr2res_etalon_find_peaks().

◆ cr2res_etalon_select_by_peak_distance()

cpl_vector * cr2res_etalon_select_by_peak_distance ( const cpl_vector *  peaks,
const cpl_vector *  peak_heights,
float  distance 
)

Selects the highest peaks that are atleast distance pixel apart.

Parameters
peaksThe 1d signal as a vector
peak_heightsThe heights (priority) of each peak
distanceThe minimum distance between peaks to keep
Returns
A boolean vector where 1 means to keep the peak, or 0 to discard it

Definition at line 369 of file cr2res_etalon.c.

Referenced by cr2res_etalon_find_peaks().

◆ cr2res_etalon_wave_2d()

cpl_polynomial * cr2res_etalon_wave_2d ( cpl_bivector **  spectra,
cpl_bivector **  spectra_err,
cpl_polynomial **  wavesol_init,
cpl_array **  wavesol_init_err,
int *  orders,
int *  traces_nb,
int  ninputs,
cpl_size  degree_x,
cpl_size  degree_y,
int  zp_order,
int  display,
cpl_array **  wavelength_error,
cpl_table **  line_diagnostics 
)

Create the 2d wavecal fit using etalon peaks.

Parameters
spectraList of extracted spectra
spectra_errList of extracted spectra errors
wavesol_initList of Initial wavelength solutions
wavesol_init_errList of Initial wavelength error (can be NULL)
ordersList of orders of the various spectra
ninputsNumber of entries in the previous parameters
degree_xThe polynomial degree in x
degree_yThe polynomial degree in y
Returns
Wavelength solution, i.e. polynomial that translates pixel values to wavelength.

Definition at line 741 of file cr2res_etalon.c.

References cr2res_dfs_create_lines_diagnostics_table(), cr2res_etalon_find_peaks(), and cr2res_wave_poly_2d_to_1d().

Referenced by cr2res_wave_apply().