|
CR2RE Pipeline Reference Manual 1.6.2
|
This module defines the hdrl_spectrum1D data structure, provides basic functionalities for it (constructors, destructor, operators). More...
Functions | |
| hdrl_error_t | estimate_noise_window (const hdrl_data_t *flux, const cpl_binary *msk, cpl_size start, cpl_size stop, const cpl_size sz) |
| Estimate the noise in the pixels between [start, stop]. The noise calculation is done using the formula from: Stoehr, F. et al. DER SNR: A Simple & General Spectroscopic Signal-to-Noise Measurement Algorithm. | |
| cpl_image * | estimate_noise_DER_SNR (const hdrl_data_t *flux_in, const cpl_binary *msk_in, const cpl_array *wavelengths, const cpl_size length, const cpl_size half_window) |
| For every pixel in position i in img_arg, the function estimates the noise using the pixels in the window [i - half_window, i + half_window]. For details on the calculation inside the window, see estimate_noise_window() | |
| hdrl_spectrum1D * | hdrl_spectrum1D_create (const cpl_image *arg_flux, const cpl_image *arg_flux_e, const cpl_array *wavelength, hdrl_spectrum1D_wave_scale wave_scale) |
| hdrl_spectrum1D default constructor | |
| hdrl_spectrum1D * | hdrl_spectrum1D_create_analytic (calculate_analytic_spectrum_point func, const cpl_array *wavelength, hdrl_spectrum1D_wave_scale scale) |
| hdrl_spectrum1D constructor in the case of a spectrum defined by an analytical function | |
| hdrl_spectrum1D * | hdrl_spectrum1D_create_error_free (const cpl_image *arg_flux, const cpl_array *wavelength, hdrl_spectrum1D_wave_scale scale) |
| hdrl_spectrum1D constructor in the case of error-free spectrum (i.e. the error on the flux is zero for every wavelengths). | |
| hdrl_spectrum1D * | hdrl_spectrum1D_create_error_DER_SNR (const cpl_image *arg_flux, cpl_size half_window, const cpl_array *wavelength, hdrl_spectrum1D_wave_scale scale) |
| hdrl_spectrum1D constructor when no error information is available, in this case we use DER_SNR to esimate the error. Please refer to the documentation of the function estimate_noise_DER_SNR(). | |
| hdrl_spectrum1D * | hdrl_spectrum1D_duplicate (const hdrl_spectrum1D *self) |
| hdrl_spectrum1D copy constructor | |
| void | hdrl_spectrum1D_delete (hdrl_spectrum1D **p_self) |
| hdrl_spectrum1D destructor | |
| cpl_size | hdrl_spectrum1D_get_size (const hdrl_spectrum1D *self) |
| hdrl_spectrum1D getter for size | |
| const hdrl_image * | hdrl_spectrum1D_get_flux (const hdrl_spectrum1D *self) |
| hdrl_spectrum1D getter flux | |
| hdrl_spectrum1D_wavelength | hdrl_spectrum1D_get_wavelength (const hdrl_spectrum1D *self) |
| hdrl_spectrum1D getter for wavelengths | |
| hdrl_spectrum1D_wave_scale | hdrl_spectrum1D_get_scale (const hdrl_spectrum1D *self) |
| hdrl_spectrum1D getter for scale | |
| hdrl_value | hdrl_spectrum1D_get_flux_value (const hdrl_spectrum1D *self, int idx, int *rej) |
| hdrl_spectrum1D getter for a flux value | |
| hdrl_data_t | hdrl_spectrum1D_get_wavelength_value (const hdrl_spectrum1D *self, int idx, int *rej) |
| hdrl_spectrum1D getter for a wavelength value | |
| hdrl_spectrum1D * | hdrl_spectrum1D_div_spectrum_create (const hdrl_spectrum1D *num, const hdrl_spectrum1D *den) |
| divide one spectrum by another spectrum | |
| hdrl_spectrum1D * | hdrl_spectrum1D_mul_spectrum_create (const hdrl_spectrum1D *f1, const hdrl_spectrum1D *f2) |
| multiply one spectrum by another spectrum | |
| hdrl_spectrum1D * | hdrl_spectrum1D_add_spectrum_create (const hdrl_spectrum1D *f1, const hdrl_spectrum1D *f2) |
| sum one spectrum to another spectrum | |
| hdrl_spectrum1D * | hdrl_spectrum1D_sub_spectrum_create (const hdrl_spectrum1D *f1, const hdrl_spectrum1D *f2) |
| subtract two spectra | |
| cpl_error_code | hdrl_spectrum1D_div_spectrum (hdrl_spectrum1D *self, const hdrl_spectrum1D *other) |
| divide one spectrum by another spectrum | |
| cpl_error_code | hdrl_spectrum1D_mul_spectrum (hdrl_spectrum1D *self, const hdrl_spectrum1D *other) |
| multiply one spectrum by another spectrum | |
| cpl_error_code | hdrl_spectrum1D_add_spectrum (hdrl_spectrum1D *self, const hdrl_spectrum1D *other) |
| sum two spectra | |
| cpl_error_code | hdrl_spectrum1D_sub_spectrum (hdrl_spectrum1D *self, const hdrl_spectrum1D *other) |
| subtract two spectra | |
| hdrl_spectrum1D * | hdrl_spectrum1D_div_scalar_create (const hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| divide a spectrum by a scalar | |
| hdrl_spectrum1D * | hdrl_spectrum1D_mul_scalar_create (const hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| multiply a spectrum by a scalar | |
| hdrl_spectrum1D * | hdrl_spectrum1D_add_scalar_create (const hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| add a scalar to a spectrum | |
| hdrl_spectrum1D * | hdrl_spectrum1D_sub_scalar_create (const hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| subtract a scalar from a spectrum | |
| hdrl_spectrum1D * | hdrl_spectrum1D_pow_scalar_create (const hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| subtract a scalar from a spectrum | |
| hdrl_spectrum1D * | hdrl_spectrum1D_exp_scalar_create (const hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| subtract a scalar from a spectrum | |
| cpl_error_code | hdrl_spectrum1D_div_scalar (hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| computes the elementwise division of a spectrum by a scalar, the self parameter is modified | |
| cpl_error_code | hdrl_spectrum1D_mul_scalar (hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| computes the elementwise multiplication of a spectrum by a scalar, the self parameter is modified | |
| cpl_error_code | hdrl_spectrum1D_add_scalar (hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| computes the elementwise addition of a spectrum by a scalar, the self parameter is modified | |
| cpl_error_code | hdrl_spectrum1D_sub_scalar (hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| computes the elementwise subtraction of a spectrum by a scalar, the self parameter is modified | |
| cpl_error_code | hdrl_spectrum1D_pow_scalar (hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| computes the elementwise power of the flux to the scalar, the self parameter is modified | |
| cpl_error_code | hdrl_spectrum1D_exp_scalar (hdrl_spectrum1D *self, hdrl_value scalar_operator) |
| computes the elementwise power of the scalar to the flux, the self parameter is modified | |
| cpl_error_code | hdrl_spectrum1D_wavelength_mult_scalar_linear (hdrl_spectrum1D *self, hdrl_data_t scale_linear) |
| computes the elementwise multiplication of the scalar for the wavelength. The scalar is assumed to be expressed in linear units. the self parameter is modified | |
| hdrl_spectrum1D * | hdrl_spectrum1D_wavelength_mult_scalar_linear_create (const hdrl_spectrum1D *self, hdrl_data_t scale_linear) |
| computes the elementwise multiplication of the scalar for the wavelength. The scalar is assumed to be expressed in linear units. Self is unchanged and the function returns a newly allocated spectrum. | |
| cpl_error_code | hdrl_spectrum1D_wavelength_shift (hdrl_spectrum1D *self, hdrl_data_t shift) |
| computes the elementwise shift of the wavelength by the shift parameter. The self parameter is modified | |
| hdrl_spectrum1D * | hdrl_spectrum1D_wavelength_shift_create (const hdrl_spectrum1D *self, hdrl_data_t shift) |
| computes the elementwise shift of the wavelength by the shift parameter. | |
| cpl_error_code | hdrl_spectrum1D_wavelength_convert_to_linear (hdrl_spectrum1D *self) |
| converts the wavelength scale to linear. | |
| hdrl_spectrum1D * | hdrl_spectrum1D_wavelength_convert_to_linear_create (const hdrl_spectrum1D *self) |
| converts the wavelength scale to linear. | |
| cpl_error_code | hdrl_spectrum1D_wavelength_convert_to_log (hdrl_spectrum1D *self) |
| converts the wavelength scale to log. If the spectrum is already in log scale nothing is done. | |
| hdrl_spectrum1D * | hdrl_spectrum1D_wavelength_convert_to_log_create (const hdrl_spectrum1D *self) |
| converts the wavelength scale to log. It returns a modified version of self. self is not modified. If self is already in log, the function is equivalent to a duplication. | |
| hdrl_spectrum1D * | hdrl_spectrum1D_select_wavelengths (const hdrl_spectrum1D *self, const cpl_bivector *windows, const cpl_boolean is_internal) |
| the function selects or discards flux values according to whether the value of the corresponding wavelength belongs to the interval [min_lambda, max_lambda]. | |
| hdrl_spectrum1D * | hdrl_spectrum1D_reject_pixels (const hdrl_spectrum1D *self, const cpl_array *bad_samples) |
| For every i-th element in bad_samples having value CPL_TRUE, the i-th pixel in the 1D spectrum is marked as bad. | |
| cpl_table * | hdrl_spectrum1D_convert_to_table (const hdrl_spectrum1D *self, const char *flux_col_name, const char *wavelength_col_name, const char *flux_e_col_name, const char *flux_bpm_col_name) |
| converts a spectrum in a table. | |
| cpl_error_code | hdrl_spectrum1D_append_to_table (const hdrl_spectrum1D *self, cpl_table *dest, const char *flux_col_name, const char *wavelength_col_name, const char *flux_e_col_name, const char *flux_bpm_col_name) |
| append a spectrum to a table. | |
| hdrl_spectrum1D * | hdrl_spectrum1D_convert_from_table (const cpl_table *self, const char *flux_col_name, const char *wavelength_col_name, const char *flux_e_col_name, const char *flux_bpm_col_name, hdrl_spectrum1D_wave_scale scale) |
| convert a table to a spectrum | |
| cpl_boolean | hdrl_spectrum1D_are_wavelengths_compatible (const cpl_array *w1, const cpl_array *w2) |
| checks if two wavelengths array are defined on the same wavelengths. | |
| cpl_boolean | hdrl_spectrum1D_are_spectra_compatible (const hdrl_spectrum1D_wavelength *s1, const hdrl_spectrum1D_wavelength *s2) |
| checks if two spectrum wavelengths are equal. | |
| cpl_boolean | hdrl_spectrum1D_is_uniformly_sampled (const hdrl_spectrum1D *self, double *bin) |
| checks if the spectrum is defined on uniformly sampled wavelengths. | |
| hdrl_parameter * | hdrl_spectrum1D_resample_interpolate_parameter_create (const hdrl_spectrum1D_interpolation_method method) |
| constructor for the hdrl_parameter in the case of interpolation | |
| hdrl_parameter * | hdrl_spectrum1D_resample_integrate_parameter_create (void) |
| constructor for the hdrl_parameter in the case of integration | |
| hdrl_parameter * | hdrl_spectrum1D_resample_fit_parameter_create (const int k, const int nCoeff) |
| constructor for the hdrl_parameter in the case of interpolation | |
| hdrl_parameter * | hdrl_spectrum1D_resample_fit_windowed_parameter_create (const int k, const int nCoeff, const long window, const double factor) |
| constructor for the hdrl_parameter in the case of interpolation | |
| hdrl_spectrum1D * | hdrl_spectrum1D_resample (const hdrl_spectrum1D *self, const hdrl_spectrum1D_wavelength *waves, const hdrl_parameter *par) |
| resample a hdrl_spectrum1D on the wavelengths contained in waves | |
| hdrl_spectrum1D * | hdrl_spectrum1D_resample_on_array (const hdrl_spectrum1D *self, const cpl_array *waves, const hdrl_parameter *par) |
| resample a hdrl_spectrum1D on the wavelengths contained in waves | |
| hdrl_xcorrelation_result * | hdrl_spectrum1D_compute_shift_xcorrelation (const hdrl_spectrum1D *s1, const hdrl_spectrum1D *s2, cpl_size half_win, const cpl_boolean normalize) |
| The function computes the shift between the two spectra. | |
| hdrl_parameter * | hdrl_spectrum1D_shift_fit_parameter_create (const hdrl_data_t wguess, const hdrl_data_t range_wmin, const hdrl_data_t range_wmax, const hdrl_data_t fit_wmin, const hdrl_data_t fit_wmax, const hdrl_data_t fit_half_win) |
| The function create a hdrl_spectrum1D_shift_parameter to be used in hdrl_spectrum1D_compute_shift_fit. | |
| hdrl_data_t | hdrl_spectrum1D_compute_shift_fit (const hdrl_spectrum1D *obs, const hdrl_parameter *par) |
| The function compute the shift due to radial velocity. If wguess is the reference line and wfound is its position in the obs spectrum, the function returns (wfound - wguess) / wguess. The algorithm generate a smoothed fit of the spectrum, between [range_wmin, range_wmax] but the wavelengths between [fit_wim, fit_wmax] are ignored when fitting. obs is then divided by the fitted spectrum. The ratio is then smoothed again via fitting inside the window [wguess - fit_half_win, wguess + fit_half_win]. The wavelength corresponding to the minimum value is wfound. | |
| hdrl_spectrum1Dlist * | hdrl_spectrum1Dlist_new (void) |
| hdrl_spectrum1Dlist default constructor | |
| hdrl_spectrum1Dlist * | hdrl_spectrum1Dlist_duplicate (const hdrl_spectrum1Dlist *l) |
| hdrl_spectrum1Dlist copy-constructor | |
| hdrl_spectrum1Dlist * | hdrl_spectrum1Dlist_wrap (hdrl_spectrum1D **self, const cpl_size sz) |
| hdrl_spectrum1Dlist wrapper | |
| hdrl_spectrum1D * | hdrl_spectrum1Dlist_get (hdrl_spectrum1Dlist *self, const cpl_size idx) |
| hdrl_spectrum1Dlist getter of the i-th element | |
| const hdrl_spectrum1D * | hdrl_spectrum1Dlist_get_const (const hdrl_spectrum1Dlist *self, const cpl_size idx) |
| hdrl_spectrum1Dlist getter of the i-th element | |
| cpl_error_code | hdrl_spectrum1Dlist_set (hdrl_spectrum1Dlist *self, hdrl_spectrum1D *s, const cpl_size idx) |
| hdrl_spectrum1Dlist setter of the i-th element | |
| hdrl_spectrum1D * | hdrl_spectrum1Dlist_unset (hdrl_spectrum1Dlist *self, const cpl_size idx) |
| hdrl_spectrum1Dlist remove of the i-th element | |
| void | hdrl_spectrum1Dlist_delete (hdrl_spectrum1Dlist *l) |
| hdrl_spectrum1Dlist destructor | |
| cpl_size | hdrl_spectrum1Dlist_get_size (const hdrl_spectrum1Dlist *l) |
| hdrl_spectrum1Dlist getter for size | |
| cpl_error_code | hdrl_spectrum1Dlist_collapse (const hdrl_spectrum1Dlist *list, const hdrl_parameter *stacking_par, const cpl_array *wlengths, const hdrl_parameter *resample_par, const cpl_boolean mark_bpm_in_interpolation, hdrl_spectrum1D **result, cpl_image **contrib, hdrl_imagelist **resampled_and_aligned_fluxes) |
| collapsing a hdrl_spectrum1Dlist. The spectra in list are first resampled on the wavelengths wlengths. The resampling method is regulated by the resample_par. For more information on samplig_par see hdrl_spectrum1D_resample_on_array. The resampled fluxes are collapsed as in hdrl_imagelist_collapse and the collapsing is regulated by the parameter stacking_par. For more information on stacking_par please see the documentation of hdrl_imagelist_collapse. | |
This module defines the hdrl_spectrum1D data structure, provides basic functionalities for it (constructors, destructor, operators).
constructors
errors
error conditions
calculation
functions
interpolation
for interpolation
fitting. We first resample .2 forward and then resample .2 backward. We expect that the flux of this 2nd spectrum has very similar errors to the original one.
| cpl_image * estimate_noise_DER_SNR | ( | const hdrl_data_t * | flux_in, |
| const cpl_binary * | msk_in, | ||
| const cpl_array * | wavelengths, | ||
| const cpl_size | length, | ||
| const cpl_size | half_window | ||
| ) |
For every pixel in position i in img_arg, the function estimates the noise using the pixels in the window [i - half_window, i + half_window]. For details on the calculation inside the window, see estimate_noise_window()
| flux_in | input flux |
| msk_in | bad pixels mask |
| wavelengths | wavelengths of the spectrum |
| length | length of the flux and msl |
| half_window | half window used to calculate the noise for each pixel. |
Possible cpl-error-code set in this function (which also implies that NULL is returned):
Definition at line 160 of file hdrl_DER_SNR.c.
Referenced by hdrl_spectrum1D_create_error_DER_SNR().
| hdrl_error_t estimate_noise_window | ( | const hdrl_data_t * | flux, |
| const cpl_binary * | msk, | ||
| cpl_size | start, | ||
| cpl_size | stop, | ||
| const cpl_size | sz | ||
| ) |
Estimate the noise in the pixels between [start, stop]. The noise calculation is done using the formula from: Stoehr, F. et al. DER SNR: A Simple & General Spectroscopic Signal-to-Noise Measurement Algorithm.
| flux | Input Flux |
| msk | Bad Pixel Mask |
| start | First Pixel |
| stop | Last Pixel |
| sz | Length of the flux (must be the same for msk) |
Possible cpl-error-code set in this function (which also implies that NAN is returned):
Definition at line 89 of file hdrl_DER_SNR.c.
| cpl_error_code hdrl_spectrum1D_add_scalar | ( | hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
computes the elementwise addition of a spectrum by a scalar, the self parameter is modified
| self | spectrum |
| scalar_operator | scalar factor |
Definition at line 710 of file hdrl_spectrum.c.
References hdrl_image_add_scalar().
Referenced by hdrl_spectrum1D_compute_shift_fit().
| hdrl_spectrum1D * hdrl_spectrum1D_add_scalar_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
add a scalar to a spectrum
| self | spectrum |
| scalar_operator | scalar factor |
Possible cpl-error-code set in this function: hdrl_image_add_scalar
Definition at line 616 of file hdrl_spectrum.c.
References hdrl_image_add_scalar().
| cpl_error_code hdrl_spectrum1D_add_spectrum | ( | hdrl_spectrum1D * | self, |
| const hdrl_spectrum1D * | other | ||
| ) |
sum two spectra
| self | first factor, it is mutated to contain self+other |
| other | second factor |
Definition at line 553 of file hdrl_spectrum.c.
References hdrl_image_add_image().
Referenced by cr2res_combine_extracted().
| hdrl_spectrum1D * hdrl_spectrum1D_add_spectrum_create | ( | const hdrl_spectrum1D * | f1, |
| const hdrl_spectrum1D * | f2 | ||
| ) |
sum one spectrum to another spectrum
void
| f1 | factor 1 |
| f2 | factor 2 |
Possible cpl-error-code set in this function: hdrl_image_add_image
Definition at line 499 of file hdrl_spectrum.c.
References hdrl_image_add_image().
| cpl_error_code hdrl_spectrum1D_append_to_table | ( | const hdrl_spectrum1D * | self, |
| cpl_table * | dest, | ||
| const char * | flux_col_name, | ||
| const char * | wavelength_col_name, | ||
| const char * | flux_e_col_name, | ||
| const char * | flux_bpm_col_name | ||
| ) |
append a spectrum to a table.
| self | spectrum |
| dest | table |
| flux_col_name | name of the column containing the flux |
| wavelength_col_name | name of the column containing the wavelengths |
| flux_e_col_name | name of the column containing the flux error |
| flux_bpm_col_name | name of the column containing the flux bpm |
If NULL is provided instead of a name, the corresponding column is not inserted in the table. At least one between wavelength_col_name and flux_col_name must be not NULL.
Definition at line 1115 of file hdrl_spectrum.c.
References hdrl_spectrum1D_get_flux_value(), hdrl_spectrum1D_get_size(), and hdrl_spectrum1D_get_wavelength_value().
Referenced by hdrl_spectrum1D_convert_to_table().
| cpl_boolean hdrl_spectrum1D_are_spectra_compatible | ( | const hdrl_spectrum1D_wavelength * | s1, |
| const hdrl_spectrum1D_wavelength * | s2 | ||
| ) |
checks if two spectrum wavelengths are equal.
| s1 | first spectrum wavelength |
| s2 | second spectrum wavelength |
Definition at line 1294 of file hdrl_spectrum.c.
References hdrl_spectrum1D_are_wavelengths_compatible().
Referenced by hdrl_spectrum1D_compute_shift_xcorrelation(), and hdrl_spectrum1D_resample().
| cpl_boolean hdrl_spectrum1D_are_wavelengths_compatible | ( | const cpl_array * | w1, |
| const cpl_array * | w2 | ||
| ) |
checks if two wavelengths array are defined on the same wavelengths.
| w1 | first wavelength array |
| w2 | first wavelength array |
Definition at line 1263 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_are_spectra_compatible(), and hdrl_spectrum1D_resample_on_array().
| hdrl_data_t hdrl_spectrum1D_compute_shift_fit | ( | const hdrl_spectrum1D * | obs, |
| const hdrl_parameter * | par | ||
| ) |
The function compute the shift due to radial velocity. If wguess is the reference line and wfound is its position in the obs spectrum, the function returns (wfound - wguess) / wguess. The algorithm generate a smoothed fit of the spectrum, between [range_wmin, range_wmax] but the wavelengths between [fit_wim, fit_wmax] are ignored when fitting. obs is then divided by the fitted spectrum. The ratio is then smoothed again via fitting inside the window [wguess - fit_half_win, wguess + fit_half_win]. The wavelength corresponding to the minimum value is wfound.
| obs | The spectrum the shift has to be computed on |
| par | The shift parameter, see hdrl_spectrum1D_shift_fit_parameter_create |
Definition at line 198 of file hdrl_spectrum_shift.c.
References hdrl_spectrum1D_add_scalar(), hdrl_spectrum1D_delete(), hdrl_spectrum1D_div_spectrum(), and hdrl_spectrum1D_select_wavelengths().
Referenced by hdrl_response_compute().
| hdrl_xcorrelation_result * hdrl_spectrum1D_compute_shift_xcorrelation | ( | const hdrl_spectrum1D * | s1, |
| const hdrl_spectrum1D * | s2, | ||
| cpl_size | half_win, | ||
| const cpl_boolean | normalize | ||
| ) |
The function computes the shift between the two spectra.
| s1 | first spectrum |
| s2 | second spectrum |
| half_win | half window where the correlation will be calculated |
| normalize | normalize mean and stdev in cross-correlation calculation |
Possible cpl-error-code set in this function:
Definition at line 94 of file hdrl_spectrum_shift.c.
References hdrl_compute_offset_gaussian(), hdrl_spectrum1D_are_spectra_compatible(), hdrl_spectrum1D_get_wavelength(), and hdrl_spectrum1D_is_uniformly_sampled().
| hdrl_spectrum1D * hdrl_spectrum1D_convert_from_table | ( | const cpl_table * | self, |
| const char * | flux_col_name, | ||
| const char * | wavelength_col_name, | ||
| const char * | flux_e_col_name, | ||
| const char * | flux_bpm_col_name, | ||
| hdrl_spectrum1D_wave_scale | scale | ||
| ) |
convert a table to a spectrum
| self | table |
| flux_col_name | name of the column containing the flux |
| wavelength_col_name | name of the column containing the wavelengths |
| flux_e_col_name | name of the column containing the flux error |
| flux_bpm_col_name | name of the column containing the flux bpm |
| scale | scale of the spectrum |
Possible cpl-error-code set in this function: see error free spectrum ctor
Definition at line 1200 of file hdrl_spectrum.c.
References hdrl_spectrum1D_create().
Referenced by cr2res_combine_extracted().
| cpl_table * hdrl_spectrum1D_convert_to_table | ( | const hdrl_spectrum1D * | self, |
| const char * | flux_col_name, | ||
| const char * | wavelength_col_name, | ||
| const char * | flux_e_col_name, | ||
| const char * | flux_bpm_col_name | ||
| ) |
converts a spectrum in a table.
| self | spectrum |
| flux_col_name | name of the column containing the flux |
| wavelength_col_name | name of the column containing the wavelengths |
| flux_e_col_name | name of the column containing the flux error |
| flux_bpm_col_name | name of the column containing the flux bpm |
If NULL is provided instead of a name, the corresponding column is not inserted in the table. At least one between wavelength_col_name and flux_col_name must be not NULL.
Possible cpl-error-code set in this function: see cpl_table_wrap_double
Definition at line 1074 of file hdrl_spectrum.c.
References hdrl_spectrum1D_append_to_table(), and hdrl_spectrum1D_get_size().
| hdrl_spectrum1D * hdrl_spectrum1D_create | ( | const cpl_image * | arg_flux, |
| const cpl_image * | arg_flux_e, | ||
| const cpl_array * | wavelength, | ||
| hdrl_spectrum1D_wave_scale | wave_scale | ||
| ) |
hdrl_spectrum1D default constructor
| arg_flux | flux with bpm |
| arg_flux_e | error for the flux |
| wavelength | wavelengths |
| wave_scale | the scale of the wavelengths of the spectrum (logarithmic or linear) |
The constructor allocates memory of a hdrl_spectrum1D structure. The cpl_image(s) and the cpl_array are copied inside the newly allocated data structure. The bpm of arg_flux becomes the bpm of the spectrum.
Possible cpl-error-code set in this function:
Definition at line 117 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_convert_from_table(), hdrl_spectrum1D_create_analytic(), hdrl_spectrum1D_create_error_DER_SNR(), hdrl_spectrum1D_create_error_free(), hdrl_spectrum1D_reject_pixels(), hdrl_spectrum1D_select_wavelengths(), and hdrl_spectrum1Dlist_collapse().
| hdrl_spectrum1D * hdrl_spectrum1D_create_analytic | ( | calculate_analytic_spectrum_point | func, |
| const cpl_array * | wavelength, | ||
| hdrl_spectrum1D_wave_scale | scale | ||
| ) |
hdrl_spectrum1D constructor in the case of a spectrum defined by an analytical function
| func | analytical function defining the spectrum |
| wavelength | frequencies the flux is calculated on |
| scale | the scale of the spectrum (logarithmic or linear) |
The constructor allocates memory of a hdrl_spectrum1D structure. The cpl_array is copied inside the newly allocated data structure. For every wavelength inside the CPL array flux and error are calculated using func.
Possible cpl-error-code set in this function:
Definition at line 160 of file hdrl_spectrum.c.
References hdrl_spectrum1D_create().
Referenced by hdrl_efficiency_compute().
| hdrl_spectrum1D * hdrl_spectrum1D_create_error_DER_SNR | ( | const cpl_image * | arg_flux, |
| cpl_size | half_window, | ||
| const cpl_array * | wavelength, | ||
| hdrl_spectrum1D_wave_scale | scale | ||
| ) |
hdrl_spectrum1D constructor when no error information is available, in this case we use DER_SNR to esimate the error. Please refer to the documentation of the function estimate_noise_DER_SNR().
| arg_flux | flux with bpm |
| half_window | half window the DER_SNR is calculated on |
| wavelength | frequencies |
| scale | the scale of the spectrum (logarithmic or linear) |
The constructor allocates memory of a hdrl_spectrum1D structure. The cpl_array and the cpl_image are copied inside the newly allocated data structure. The flux error is calculated creating a window of 2 * half_window + 1 pixels around each flux pixel and then using the noise estimation used for DER_SNR calculation. The use of DER_SNR can increase the number of bad pixels, in the case of a good pixel surrounded by bad pixels. See estimate_noise_DER_SNR() for more details.
Possible cpl-error-code set in this function: see hdrl_spectrum1D_create()
Definition at line 250 of file hdrl_spectrum.c.
References estimate_noise_DER_SNR(), and hdrl_spectrum1D_create().
| hdrl_spectrum1D * hdrl_spectrum1D_create_error_free | ( | const cpl_image * | arg_flux, |
| const cpl_array * | wavelength, | ||
| hdrl_spectrum1D_wave_scale | scale | ||
| ) |
hdrl_spectrum1D constructor in the case of error-free spectrum (i.e. the error on the flux is zero for every wavelengths).
| arg_flux | flux with bpm |
| wavelength | frequencies |
| scale | the scale of the spectrum (logarithmic or linear) |
The constructor allocates memory of a hdrl_spectrum1D structure. The cpl_array and the cpl_image are copied inside the newly allocated data structure. The flux error is considered to be zero.
Possible cpl-error-code set in this function: see hdrl_spectrum1D_create()
Definition at line 204 of file hdrl_spectrum.c.
References hdrl_spectrum1D_create().
| void hdrl_spectrum1D_delete | ( | hdrl_spectrum1D ** | p_self | ) |
hdrl_spectrum1D destructor
| p_self | spectrum to delete. |
If p_self is NULL or *p_self is NULL nothing is done.
Definition at line 323 of file hdrl_spectrum.c.
References hdrl_image_delete().
Referenced by cr2res_combine_extracted(), hdrl_efficiency_compute(), hdrl_response_compute(), hdrl_response_core_compute(), hdrl_response_result_delete(), hdrl_spectrum1D_compute_shift_fit(), hdrl_spectrum1D_wavelength_convert_to_linear_create(), hdrl_spectrum1D_wavelength_convert_to_log_create(), hdrl_spectrum1D_wavelength_mult_scalar_linear_create(), hdrl_spectrum1D_wavelength_shift_create(), hdrl_spectrum1Dlist_delete(), and hdrl_spectrum1Dlist_set().
| cpl_error_code hdrl_spectrum1D_div_scalar | ( | hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
computes the elementwise division of a spectrum by a scalar, the self parameter is modified
| self | spectrum |
| scalar_operator | scalar factor |
Definition at line 681 of file hdrl_spectrum.c.
References hdrl_image_div_scalar().
Referenced by hdrl_efficiency_compute().
| hdrl_spectrum1D * hdrl_spectrum1D_div_scalar_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
divide a spectrum by a scalar
| self | spectrum |
| scalar_operator | scalar factor |
Possible cpl-error-code set in this function: hdrl_image_div_scalar
Definition at line 582 of file hdrl_spectrum.c.
References hdrl_image_div_scalar().
| cpl_error_code hdrl_spectrum1D_div_spectrum | ( | hdrl_spectrum1D * | self, |
| const hdrl_spectrum1D * | other | ||
| ) |
divide one spectrum by another spectrum
| self | numerator, it is mutated to contain self/other |
| other | denumerator |
Definition at line 529 of file hdrl_spectrum.c.
References hdrl_image_div_image().
Referenced by hdrl_efficiency_compute(), hdrl_response_core_compute(), and hdrl_spectrum1D_compute_shift_fit().
| hdrl_spectrum1D * hdrl_spectrum1D_div_spectrum_create | ( | const hdrl_spectrum1D * | num, |
| const hdrl_spectrum1D * | den | ||
| ) |
divide one spectrum by another spectrum
| num | numerator |
| den | denumerator |
Possible cpl-error-code set in this function: hdrl_image_div_image
Definition at line 467 of file hdrl_spectrum.c.
References hdrl_image_div_image().
| hdrl_spectrum1D * hdrl_spectrum1D_duplicate | ( | const hdrl_spectrum1D * | self | ) |
hdrl_spectrum1D copy constructor
| self | spectrum that has to be duplicated |
Definition at line 302 of file hdrl_spectrum.c.
References hdrl_image_duplicate().
Referenced by hdrl_efficiency_compute(), hdrl_response_core_compute(), hdrl_spectrum1D_resample(), hdrl_spectrum1D_resample_on_array(), hdrl_spectrum1D_select_wavelengths(), hdrl_spectrum1D_wavelength_convert_to_linear_create(), hdrl_spectrum1D_wavelength_convert_to_log_create(), hdrl_spectrum1D_wavelength_mult_scalar_linear_create(), hdrl_spectrum1D_wavelength_shift_create(), and hdrl_spectrum1Dlist_duplicate().
| cpl_error_code hdrl_spectrum1D_exp_scalar | ( | hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
computes the elementwise power of the scalar to the flux, the self parameter is modified
| self | spectrum |
| scalar_operator | scalar factor |
Definition at line 752 of file hdrl_spectrum.c.
References hdrl_image_exp_scalar().
Referenced by hdrl_efficiency_compute(), and hdrl_response_core_compute().
| hdrl_spectrum1D * hdrl_spectrum1D_exp_scalar_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
subtract a scalar from a spectrum
| self | spectrum |
| scalar_operator | scalar factor |
Possible cpl-error-code set in this function: hdrl_image_exp_scalar
Definition at line 667 of file hdrl_spectrum.c.
References hdrl_image_exp_scalar().
| const hdrl_image * hdrl_spectrum1D_get_flux | ( | const hdrl_spectrum1D * | self | ) |
hdrl_spectrum1D getter flux
| self | the spectrum |
Definition at line 358 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_get_flux_value(), hdrl_spectrum1D_get_wavelength(), and hdrl_spectrum1D_reject_pixels().
| hdrl_value hdrl_spectrum1D_get_flux_value | ( | const hdrl_spectrum1D * | self, |
| int | idx, | ||
| int * | rej | ||
| ) |
hdrl_spectrum1D getter for a flux value
| self | the spectrum |
| idx | position of the sample. The samples are a 0-indexed sequence. |
| rej | output, set to 0 if the value is not a valid pixel. |
Definition at line 417 of file hdrl_spectrum.c.
References hdrl_image_get_pixel(), and hdrl_spectrum1D_get_flux().
Referenced by cr2res_combine_extracted(), hdrl_spectrum1D_append_to_table(), and hdrl_spectrum1D_select_wavelengths().
| hdrl_spectrum1D_wave_scale hdrl_spectrum1D_get_scale | ( | const hdrl_spectrum1D * | self | ) |
hdrl_spectrum1D getter for scale
| self | the spectrum |
Definition at line 401 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_get_wavelength(), hdrl_spectrum1D_select_wavelengths(), and hdrl_spectrum1Dlist_collapse().
| cpl_size hdrl_spectrum1D_get_size | ( | const hdrl_spectrum1D * | self | ) |
hdrl_spectrum1D getter for size
| self | the spectrum |
Definition at line 344 of file hdrl_spectrum.c.
Referenced by cr2res_combine_extracted(), hdrl_spectrum1D_append_to_table(), hdrl_spectrum1D_convert_to_table(), hdrl_spectrum1D_is_uniformly_sampled(), hdrl_spectrum1D_reject_pixels(), and hdrl_spectrum1D_select_wavelengths().
| hdrl_spectrum1D_wavelength hdrl_spectrum1D_get_wavelength | ( | const hdrl_spectrum1D * | self | ) |
hdrl_spectrum1D getter for wavelengths
| self | the spectrum |
Definition at line 373 of file hdrl_spectrum.c.
References hdrl_image_get_image_const(), hdrl_spectrum1D_get_flux(), and hdrl_spectrum1D_get_scale().
Referenced by cr2res_combine_extracted(), hdrl_efficiency_compute(), hdrl_response_compute(), hdrl_response_core_compute(), hdrl_spectrum1D_compute_shift_xcorrelation(), hdrl_spectrum1D_get_wavelength_value(), hdrl_spectrum1D_reject_pixels(), hdrl_spectrum1D_resample(), and hdrl_spectrum1D_resample_on_array().
| hdrl_data_t hdrl_spectrum1D_get_wavelength_value | ( | const hdrl_spectrum1D * | self, |
| int | idx, | ||
| int * | rej | ||
| ) |
hdrl_spectrum1D getter for a wavelength value
| self | the spectrum |
| idx | position of the sample. The samples are a 0-indexed sequence. |
| rej | output, set to 0 if the value is not a valid pixel. |
Definition at line 435 of file hdrl_spectrum.c.
References hdrl_spectrum1D_get_wavelength().
Referenced by cr2res_combine_extracted(), hdrl_spectrum1D_append_to_table(), hdrl_spectrum1D_is_uniformly_sampled(), and hdrl_spectrum1D_select_wavelengths().
| cpl_boolean hdrl_spectrum1D_is_uniformly_sampled | ( | const hdrl_spectrum1D * | self, |
| double * | bin | ||
| ) |
checks if the spectrum is defined on uniformly sampled wavelengths.
| self | the input spectrum |
| bin | bin width - output parameter |
Definition at line 1318 of file hdrl_spectrum.c.
References hdrl_spectrum1D_get_size(), and hdrl_spectrum1D_get_wavelength_value().
Referenced by hdrl_spectrum1D_compute_shift_xcorrelation().
| cpl_error_code hdrl_spectrum1D_mul_scalar | ( | hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
computes the elementwise multiplication of a spectrum by a scalar, the self parameter is modified
| self | spectrum |
| scalar_operator | scalar factor |
Definition at line 696 of file hdrl_spectrum.c.
References hdrl_image_mul_scalar().
Referenced by hdrl_efficiency_compute(), and hdrl_response_core_compute().
| hdrl_spectrum1D * hdrl_spectrum1D_mul_scalar_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
multiply a spectrum by a scalar
| self | spectrum |
| scalar_operator | scalar factor |
Possible cpl-error-code set in this function: hdrl_image_mul_scalar
Definition at line 599 of file hdrl_spectrum.c.
References hdrl_image_mul_scalar().
| cpl_error_code hdrl_spectrum1D_mul_spectrum | ( | hdrl_spectrum1D * | self, |
| const hdrl_spectrum1D * | other | ||
| ) |
multiply one spectrum by another spectrum
| self | first factor, it is mutated to contain self*other |
| other | second factor |
Definition at line 541 of file hdrl_spectrum.c.
References hdrl_image_mul_image().
Referenced by hdrl_efficiency_compute(), and hdrl_response_core_compute().
| hdrl_spectrum1D * hdrl_spectrum1D_mul_spectrum_create | ( | const hdrl_spectrum1D * | f1, |
| const hdrl_spectrum1D * | f2 | ||
| ) |
multiply one spectrum by another spectrum
| f1 | factor 1 |
| f2 | factor 2 |
Possible cpl-error-code set in this function: hdrl_image_mul_image
Definition at line 483 of file hdrl_spectrum.c.
References hdrl_image_mul_image().
| cpl_error_code hdrl_spectrum1D_pow_scalar | ( | hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
computes the elementwise power of the flux to the scalar, the self parameter is modified
| self | spectrum |
| scalar_operator | scalar factor |
Definition at line 738 of file hdrl_spectrum.c.
References hdrl_image_pow_scalar().
| hdrl_spectrum1D * hdrl_spectrum1D_pow_scalar_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
subtract a scalar from a spectrum
| self | spectrum |
| scalar_operator | scalar factor |
Possible cpl-error-code set in this function: hdrl_image_pow_scalar
Definition at line 650 of file hdrl_spectrum.c.
References hdrl_image_pow_scalar().
| hdrl_spectrum1D * hdrl_spectrum1D_reject_pixels | ( | const hdrl_spectrum1D * | self, |
| const cpl_array * | bad_samples | ||
| ) |
For every i-th element in bad_samples having value CPL_TRUE, the i-th pixel in the 1D spectrum is marked as bad.
| self | spectrum |
| bad_samples | flags indicating whether the pixel is bad |
It returns a modified version of self. self is not modified. Possible cpl-error-code set in this function:
Definition at line 1027 of file hdrl_spectrum.c.
References hdrl_image_delete(), hdrl_image_duplicate(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_image_reject(), hdrl_spectrum1D_create(), hdrl_spectrum1D_get_flux(), hdrl_spectrum1D_get_size(), and hdrl_spectrum1D_get_wavelength().
| hdrl_spectrum1D * hdrl_spectrum1D_resample | ( | const hdrl_spectrum1D * | self, |
| const hdrl_spectrum1D_wavelength * | waves, | ||
| const hdrl_parameter * | par | ||
| ) |
resample a hdrl_spectrum1D on the wavelengths contained in waves
| self | the spectrum to be resampled |
| waves | the waves the spectrum has to be resampled on |
| par | hdrl_parameter, see hdrl_spectrum1D_resample_fit_parameter_create(), hdrl_spectrum1D_resample_interpolate_parameter_create() or hdrl_spectrum1D_resample_integrate_parameter_create(). |
Possible cpl-error-code set in this function:
Definition at line 429 of file hdrl_spectrum_resample.c.
References hdrl_spectrum1D_are_spectra_compatible(), hdrl_spectrum1D_duplicate(), and hdrl_spectrum1D_get_wavelength().
Referenced by cr2res_combine_extracted(), hdrl_efficiency_compute(), and hdrl_response_core_compute().
| hdrl_parameter * hdrl_spectrum1D_resample_fit_parameter_create | ( | const int | k, |
| const int | nCoeff | ||
| ) |
constructor for the hdrl_parameter in the case of interpolation
| k | order of the B-spline |
| nCoeff | number of coefficients used for the fit |
Definition at line 338 of file hdrl_spectrum_resample.c.
| hdrl_parameter * hdrl_spectrum1D_resample_fit_windowed_parameter_create | ( | const int | k, |
| const int | nCoeff, | ||
| const long | window, | ||
| const double | factor | ||
| ) |
constructor for the hdrl_parameter in the case of interpolation
| k | order of the B-spline |
| nCoeff | number of coefficients used for the fit |
| window | number of destination wavelengths whose flux values are computed using the same model |
| factor | Given window2 = window * factor. window2 is the number of source wavelengths used to compute the fit model |
Definition at line 366 of file hdrl_spectrum_resample.c.
| hdrl_parameter * hdrl_spectrum1D_resample_integrate_parameter_create | ( | void | ) |
constructor for the hdrl_parameter in the case of integration
Definition at line 255 of file hdrl_spectrum_resample.c.
| hdrl_parameter * hdrl_spectrum1D_resample_interpolate_parameter_create | ( | const hdrl_spectrum1D_interpolation_method | method | ) |
constructor for the hdrl_parameter in the case of interpolation
| method | interpolation methods, see the enum hdrl_spectrum1D_interpolation_method |
Definition at line 239 of file hdrl_spectrum_resample.c.
Referenced by cr2res_combine_extracted(), hdrl_barycorr_compute(), hdrl_efficiency_compute(), hdrl_response_compute(), and hdrl_response_core_compute().
| hdrl_spectrum1D * hdrl_spectrum1D_resample_on_array | ( | const hdrl_spectrum1D * | self, |
| const cpl_array * | waves, | ||
| const hdrl_parameter * | par | ||
| ) |
resample a hdrl_spectrum1D on the wavelengths contained in waves
| self | the spectrum to be resampled |
| waves | the waves the spectrum has to be resampled on |
| par | hdrl_parameter, see hdrl_spectrum1D_resample_fit_parameter_create(), hdrl_spectrum1D_resample_interpolate_parameter_create() or hdrl_spectrum1D_resample_integrate_parameter_create(). |
Possible cpl-error-code set in this function:
Definition at line 484 of file hdrl_spectrum_resample.c.
References hdrl_spectrum1D_are_wavelengths_compatible(), hdrl_spectrum1D_duplicate(), and hdrl_spectrum1D_get_wavelength().
Referenced by hdrl_response_compute(), and hdrl_spectrum1Dlist_collapse().
| hdrl_spectrum1D * hdrl_spectrum1D_select_wavelengths | ( | const hdrl_spectrum1D * | self, |
| const cpl_bivector * | windows, | ||
| const cpl_boolean | is_internal | ||
| ) |
the function selects or discards flux values according to whether the value of the corresponding wavelength belongs to the interval [min_lambda, max_lambda].
| self | spectrum |
| windows | the intervals required for selection |
| is_internal | parallel array to windows, specifies if selection is internal to the interval or external to the interval. |
Possible cpl-error-code set in this function:
Definition at line 955 of file hdrl_spectrum.c.
References hdrl_spectrum1D_create(), hdrl_spectrum1D_duplicate(), hdrl_spectrum1D_get_flux_value(), hdrl_spectrum1D_get_scale(), hdrl_spectrum1D_get_size(), and hdrl_spectrum1D_get_wavelength_value().
Referenced by hdrl_spectrum1D_compute_shift_fit().
| hdrl_parameter * hdrl_spectrum1D_shift_fit_parameter_create | ( | const hdrl_data_t | wguess, |
| const hdrl_data_t | range_wmin, | ||
| const hdrl_data_t | range_wmax, | ||
| const hdrl_data_t | fit_wmin, | ||
| const hdrl_data_t | fit_wmax, | ||
| const hdrl_data_t | fit_half_win | ||
| ) |
The function create a hdrl_spectrum1D_shift_parameter to be used in hdrl_spectrum1D_compute_shift_fit.
| wguess | Reference line wavelength position |
| range_wmin | Minimum of wavelength box for line fit |
| range_wmax | Maximum of wavelength box for line fit |
| fit_wmin | Minimum wavelength value used to fit line slope |
| fit_wmax | Maximum wavelength value used to fit line slope |
| fit_half_win | Half box where polynomial fit is performed |
Definition at line 162 of file hdrl_spectrum_shift.c.
| cpl_error_code hdrl_spectrum1D_sub_scalar | ( | hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
computes the elementwise subtraction of a spectrum by a scalar, the self parameter is modified
| self | spectrum |
| scalar_operator | scalar factor |
Definition at line 724 of file hdrl_spectrum.c.
References hdrl_image_sub_scalar().
| hdrl_spectrum1D * hdrl_spectrum1D_sub_scalar_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_value | scalar_operator | ||
| ) |
subtract a scalar from a spectrum
| self | spectrum |
| scalar_operator | scalar factor |
Possible cpl-error-code set in this function: hdrl_image_sub_scalar
Definition at line 633 of file hdrl_spectrum.c.
References hdrl_image_sub_scalar().
| cpl_error_code hdrl_spectrum1D_sub_spectrum | ( | hdrl_spectrum1D * | self, |
| const hdrl_spectrum1D * | other | ||
| ) |
subtract two spectra
| self | first factor, it is mutated to contain self-other |
| other | second factor |
Definition at line 566 of file hdrl_spectrum.c.
References hdrl_image_sub_image().
Referenced by hdrl_efficiency_compute(), and hdrl_response_core_compute().
| hdrl_spectrum1D * hdrl_spectrum1D_sub_spectrum_create | ( | const hdrl_spectrum1D * | f1, |
| const hdrl_spectrum1D * | f2 | ||
| ) |
subtract two spectra
| f1 | factor 1 |
| f2 | factor 2 |
Possible cpl-error-code set in this function: hdrl_image_sub_image
Definition at line 516 of file hdrl_spectrum.c.
References hdrl_image_sub_image().
| cpl_error_code hdrl_spectrum1D_wavelength_convert_to_linear | ( | hdrl_spectrum1D * | self | ) |
converts the wavelength scale to linear.
| self | spectrum |
If the spectrum is already in linear scale nothing is done.
Definition at line 860 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_wavelength_convert_to_linear_create().
| hdrl_spectrum1D * hdrl_spectrum1D_wavelength_convert_to_linear_create | ( | const hdrl_spectrum1D * | self | ) |
converts the wavelength scale to linear.
| self | spectrum |
It returns a modified version of self. self is not modified. If self is already in linear, the function is equivalent to a duplication. Possible cpl-error-code set in this function: see cpl_array_exponential
Definition at line 881 of file hdrl_spectrum.c.
References hdrl_spectrum1D_delete(), hdrl_spectrum1D_duplicate(), and hdrl_spectrum1D_wavelength_convert_to_linear().
| cpl_error_code hdrl_spectrum1D_wavelength_convert_to_log | ( | hdrl_spectrum1D * | self | ) |
converts the wavelength scale to log. If the spectrum is already in log scale nothing is done.
| self | spectrum |
Definition at line 899 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_wavelength_convert_to_log_create().
| hdrl_spectrum1D * hdrl_spectrum1D_wavelength_convert_to_log_create | ( | const hdrl_spectrum1D * | self | ) |
converts the wavelength scale to log. It returns a modified version of self. self is not modified. If self is already in log, the function is equivalent to a duplication.
| self | spectrum |
It returns a modified version of self. self is not modified. If self is already in log, the function is equivalent to a duplication. Possible cpl-error-code set in this function: see cpl_array_logarithm
Definition at line 922 of file hdrl_spectrum.c.
References hdrl_spectrum1D_delete(), hdrl_spectrum1D_duplicate(), and hdrl_spectrum1D_wavelength_convert_to_log().
| cpl_error_code hdrl_spectrum1D_wavelength_mult_scalar_linear | ( | hdrl_spectrum1D * | self, |
| hdrl_data_t | scale_linear | ||
| ) |
computes the elementwise multiplication of the scalar for the wavelength. The scalar is assumed to be expressed in linear units. the self parameter is modified
| self | spectrum |
| scale_linear | scalar factor |
Definition at line 768 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_wavelength_mult_scalar_linear_create().
| hdrl_spectrum1D * hdrl_spectrum1D_wavelength_mult_scalar_linear_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_data_t | scale_linear | ||
| ) |
computes the elementwise multiplication of the scalar for the wavelength. The scalar is assumed to be expressed in linear units. Self is unchanged and the function returns a newly allocated spectrum.
| self | spectrum |
| scale_linear | scalar factor |
Possible cpl-error-code set in this function: see cpl_array_multiply_scalar and cpl_array_add_scalar.
Definition at line 794 of file hdrl_spectrum.c.
References hdrl_spectrum1D_delete(), hdrl_spectrum1D_duplicate(), and hdrl_spectrum1D_wavelength_mult_scalar_linear().
| cpl_error_code hdrl_spectrum1D_wavelength_shift | ( | hdrl_spectrum1D * | self, |
| hdrl_data_t | shift | ||
| ) |
computes the elementwise shift of the wavelength by the shift parameter. The self parameter is modified
| self | spectrum |
| shift | scalar factor |
Definition at line 817 of file hdrl_spectrum.c.
Referenced by hdrl_spectrum1D_wavelength_shift_create().
| hdrl_spectrum1D * hdrl_spectrum1D_wavelength_shift_create | ( | const hdrl_spectrum1D * | self, |
| hdrl_data_t | shift | ||
| ) |
computes the elementwise shift of the wavelength by the shift parameter.
| self | spectrum |
| shift | scalar factor |
The self parameter is not modified, and a modified copy of self is returned. Possible cpl-error-code set in this function: see cpl_array_add_scalar
Definition at line 836 of file hdrl_spectrum.c.
References hdrl_spectrum1D_delete(), hdrl_spectrum1D_duplicate(), and hdrl_spectrum1D_wavelength_shift().
| cpl_error_code hdrl_spectrum1Dlist_collapse | ( | const hdrl_spectrum1Dlist * | list, |
| const hdrl_parameter * | stacking_par, | ||
| const cpl_array * | wlengths, | ||
| const hdrl_parameter * | resample_par, | ||
| const cpl_boolean | mark_bpm_in_interpolation, | ||
| hdrl_spectrum1D ** | result, | ||
| cpl_image ** | contrib, | ||
| hdrl_imagelist ** | resampled_and_aligned_fluxes | ||
| ) |
collapsing a hdrl_spectrum1Dlist. The spectra in list are first resampled on the wavelengths wlengths. The resampling method is regulated by the resample_par. For more information on samplig_par see hdrl_spectrum1D_resample_on_array. The resampled fluxes are collapsed as in hdrl_imagelist_collapse and the collapsing is regulated by the parameter stacking_par. For more information on stacking_par please see the documentation of hdrl_imagelist_collapse.
| list | hdrl_spectrum1D list |
| stacking_par | parameter regulating the stacking |
| wlengths | wavelengths the resulting spectrum is defined on |
| resample_par | parameter regulating the resampling |
| mark_bpm_in_interpolation | if true interpolated pixels whose neighbors (in the original spectrum) are rejected, are not considered during collapsing |
| result | the resulting spectrum |
| contrib | output contribution mask |
| resampled_and_aligned_fluxes | resampled and aligned fluxes to be collapsed |
Possible cpl-error-code set in this function:
Definition at line 350 of file hdrl_spectrumlist.c.
References hdrl_image_delete(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_imagelist_collapse(), hdrl_spectrum1D_create(), hdrl_spectrum1D_get_scale(), hdrl_spectrum1D_resample_on_array(), hdrl_spectrum1Dlist_get_const(), and hdrl_spectrum1Dlist_get_size().
| void hdrl_spectrum1Dlist_delete | ( | hdrl_spectrum1Dlist * | l | ) |
hdrl_spectrum1Dlist destructor
| l | hdrl_spectrum1Dlist |
The function deallocates the list and all the spectra it was containing. If l is NULL no operation is performed.
Definition at line 286 of file hdrl_spectrumlist.c.
References hdrl_spectrum1D_delete(), and hdrl_spectrum1Dlist_get_size().
| hdrl_spectrum1Dlist * hdrl_spectrum1Dlist_duplicate | ( | const hdrl_spectrum1Dlist * | l | ) |
hdrl_spectrum1Dlist copy-constructor
| l | input list |
The constructor allocates memory of a new hdrl_spectrum1Dlist structure. Each element of the new list is a copy of the corresponding element in the source list.
Definition at line 122 of file hdrl_spectrumlist.c.
References hdrl_spectrum1D_duplicate(), hdrl_spectrum1Dlist_get_const(), hdrl_spectrum1Dlist_get_size(), hdrl_spectrum1Dlist_new(), and hdrl_spectrum1Dlist_set().
Referenced by hdrl_response_telluric_evaluation_parameter_create().
| hdrl_spectrum1D * hdrl_spectrum1Dlist_get | ( | hdrl_spectrum1Dlist * | self, |
| const cpl_size | idx | ||
| ) |
hdrl_spectrum1Dlist getter of the i-th element
| self | hdrl_spectrum1Dlist |
| idx | index of the element we want. 0 <= index < size |
Possible cpl-error-code set in this function:
Definition at line 168 of file hdrl_spectrumlist.c.
| const hdrl_spectrum1D * hdrl_spectrum1Dlist_get_const | ( | const hdrl_spectrum1Dlist * | self, |
| const cpl_size | idx | ||
| ) |
hdrl_spectrum1Dlist getter of the i-th element
| self | hdrl_spectrum1Dlist |
| idx | index of the element we want. 0 <= index < size |
Possible cpl-error-code set in this function:
Definition at line 189 of file hdrl_spectrumlist.c.
Referenced by hdrl_spectrum1Dlist_collapse(), and hdrl_spectrum1Dlist_duplicate().
| cpl_size hdrl_spectrum1Dlist_get_size | ( | const hdrl_spectrum1Dlist * | l | ) |
hdrl_spectrum1Dlist getter for size
| l | hdrl_spectrum1Dlist |
Possible cpl-error-code set in this function:
Definition at line 309 of file hdrl_spectrumlist.c.
Referenced by hdrl_spectrum1Dlist_collapse(), hdrl_spectrum1Dlist_delete(), hdrl_spectrum1Dlist_duplicate(), and hdrl_spectrum1Dlist_unset().
| hdrl_spectrum1Dlist * hdrl_spectrum1Dlist_new | ( | void | ) |
hdrl_spectrum1Dlist default constructor
The constructor allocates memory of a hdrl_spectrum1Dlist structure. The struct has zero capacity when allocated.
Definition at line 102 of file hdrl_spectrumlist.c.
Referenced by hdrl_spectrum1Dlist_duplicate(), and hdrl_spectrum1Dlist_wrap().
| cpl_error_code hdrl_spectrum1Dlist_set | ( | hdrl_spectrum1Dlist * | self, |
| hdrl_spectrum1D * | s, | ||
| const cpl_size | idx | ||
| ) |
hdrl_spectrum1Dlist setter of the i-th element
| self | hdrl_spectrum1Dlist |
| s | hdrl_spectrum1D we want to insert |
| idx | position the spectrum is inserted in. 0 <= index <= size |
The function insert s inside self. if index == size, the capacity of the list is increased to accommodate the new element. If a spectrum was already contained in the i-th position, it is de-allocated. The list becomes responsible for the memory management of s.
Possible cpl-error-code set in this function:
Definition at line 216 of file hdrl_spectrumlist.c.
References hdrl_spectrum1D_delete().
Referenced by hdrl_spectrum1Dlist_duplicate().
| hdrl_spectrum1D * hdrl_spectrum1Dlist_unset | ( | hdrl_spectrum1Dlist * | self, |
| const cpl_size | idx | ||
| ) |
hdrl_spectrum1Dlist remove of the i-th element
| self | hdrl_spectrum1Dlist |
| idx | position of element we want to remove from the list. 0 <= index < size |
The function extract the idx-th element from the list. It shifts all the elements from idx + 1 to size - 1 down of one position. If the new size is less than half the capacity, the capacity is reduced.
Possible cpl-error-code set in this function:
Definition at line 254 of file hdrl_spectrumlist.c.
References hdrl_spectrum1Dlist_get_size().
| hdrl_spectrum1Dlist * hdrl_spectrum1Dlist_wrap | ( | hdrl_spectrum1D ** | self, |
| const cpl_size | sz | ||
| ) |
hdrl_spectrum1Dlist wrapper
| self | array of pointers to hdrl_spectrum1D |
| sz | number of elements in self |
The constructor allocates memory of a new hdrl_spectrum1Dlist structure. The structure takes ownership of self, and therefore it is responsible for its de-allocation. Self must not contain duplicate or NULL pointers.
Definition at line 149 of file hdrl_spectrumlist.c.
References hdrl_spectrum1Dlist_new().