|
ERIS Pipeline Reference Manual 1.8.15
|
Functions | |
| cpl_polynomial * | eris_ifu_lcorr_get (cpl_imagelist *cube, hdrl_imagelist *hdrlCube, const cpl_propertylist *header, cpl_vector *peaks, const int pfit_order) |
| Create wavelength correction polynomial from IFU cube using OH lines. | |
| cpl_bivector * | eris_ifu_lcorr_extract_spectrum (const cpl_imagelist *cube, const cpl_propertylist *header, const double min_frac, const cpl_vector *range) |
| Extract integrated spectrum from IFU cube for brightest spaxels. | |
| cpl_image * | eris_ifu_lcorr_create_object_mask (const cpl_imagelist *cube, double min_frac, const cpl_vector *lambda, const cpl_vector *range) |
| Create spaxel selection mask for spectrum extraction. | |
| cpl_vector * | eris_ifu_lcorr_create_lambda_vector (const cpl_propertylist *header) |
| Create wavelength vector from FITS header WCS keywords. | |
| cpl_bivector * | eris_ifu_lcorr_read_OH_reference_spectrum (const char *filename, cpl_size ext_number) |
| Read OH reference spectrum from FITS file. | |
| cpl_array * | eris_ifu_lcorr_get_peak_positions (const cpl_bivector *spectrum, double min_frac, cpl_vector *range) |
| Detect emission line peak positions in a spectrum. | |
| cpl_vector * | eris_ifu_lcorr_get_peak_lambdas (const cpl_bivector *spectrum, double min_frac, cpl_vector *range) |
| Detect and refine emission line peak wavelengths using Gaussian fitting. | |
| int | gauss1d_fnc (const double x[], const double a[], double *result) |
| define a Gaussian profile | |
| int | gauss1d_fncd (const double x[], const double a[], double result[]) |
| define a Gaussian profile | |
| double | fit_peak (const cpl_bivector *spectrum, const cpl_size size, double lambda_in, int half_width, double *sigma_par) |
| fit a peak | |
| cpl_polynomial * | eris_ifu_lcorr_crosscorrelate_spectra (cpl_bivector *object, cpl_vector *peaks, ifsBand bandId, const int pfit_order) |
| cross-correlate two input spectra | |
| void | eris_ifu_lcorr_open_debug_file (const char *filename) |
| open ASCII file to hold debug results | |
| void | eris_ifu_lcorr_close_debug_file (void) |
| close ASCII file that hold debug results | |
This module provides functions for wavelength (lambda) correction of IFU spectra using OH sky line emission features. The correction compensates for flexure-induced wavelength shifts by cross-correlating observed OH lines with reference positions.
The typical workflow is:
The correction polynomial can be of varying degree (typically 0-3), with higher degrees allowing for non-linear wavelength distortions but requiring more detected lines.
| void eris_ifu_lcorr_close_debug_file | ( | void | ) |
close ASCII file that hold debug results
Definition at line 1433 of file eris_ifu_lambda_corr.c.
| cpl_vector * eris_ifu_lcorr_create_lambda_vector | ( | const cpl_propertylist * | header | ) |
Create wavelength vector from FITS header WCS keywords.
Constructs a wavelength vector using the WCS (World Coordinate System) properties of the spectral axis (axis 3) from a data cube's FITS header. Uses the standard FITS keywords NAXIS3, CRVAL3, CDELT3, and CRPIX3.
| header | Property list (FITS header) containing WCS keywords |
Definition at line 436 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_NULL, CATCH, CATCH_MSG, and TRY.
Referenced by eris_ifu_dar_correction(), eris_ifu_lcorr_extract_spectrum(), and eris_ifu_sky_tweak().
| cpl_image * eris_ifu_lcorr_create_object_mask | ( | const cpl_imagelist * | cube, |
| double | min_frac, | ||
| const cpl_vector * | lambda, | ||
| const cpl_vector * | range | ||
| ) |
Create spaxel selection mask for spectrum extraction.
For every spaxel, calculates median flux (optionally restricted to specific wavelength ranges) and creates a binary mask selecting the brightest fraction of spaxels. This mask is used to extract an integrated spectrum from the brightest regions of the field.
| cube | Input data cube (imagelist) |
| min_frac | Fraction of brightest spaxels to select (0.0-1.0, e.g., 0.8 for top 80%) |
| lambda | Wavelength vector corresponding to cube's spectral axis, or NULL |
| range | Wavelength ranges for flux calculation (NULL for all wavelengths) Format: [min1, max1, min2, max2, ...] pairs in microns |
Definition at line 283 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_ERROR, BRK_IF_NULL, CATCH, CATCH_MSG, eris_ifu_mask_nans_in_cube(), and TRY.
Referenced by eris_ifu_lcorr_extract_spectrum(), eris_ifu_plot_cube_background(), and eris_ifu_sky_tweak().
| cpl_polynomial * eris_ifu_lcorr_crosscorrelate_spectra | ( | cpl_bivector * | object, |
| cpl_vector * | peaks, | ||
| ifsBand | bandId, | ||
| const int | pfit_order | ||
| ) |
cross-correlate two input spectra
| object | input spectrum |
| peaks | peaks |
| bandId | band setup |
| pfit_order |
Definition at line 1139 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_ERROR, BRK_IF_NULL, CATCH, CATCH_MSG, CHECK_ERROR_STATE, eris_ifu_get_band_resolution(), fit_peak(), and TRY.
Referenced by eris_ifu_lcorr_get().
| cpl_bivector * eris_ifu_lcorr_extract_spectrum | ( | const cpl_imagelist * | cube, |
| const cpl_propertylist * | header, | ||
| const double | min_frac, | ||
| const cpl_vector * | range | ||
| ) |
Extract integrated spectrum from IFU cube for brightest spaxels.
Creates an integrated spectrum by selecting the brightest spaxels in the cube (based on median flux) and summing their spectral contributions. This produces a high signal-to-noise spectrum suitable for OH line detection and wavelength calibration.
| cube | Input data cube (imagelist with spectral axis) |
| header | FITS header containing WCS keywords (NAXIS3, CRVAL3, CDELT3, CRPIX3) |
| min_frac | Fraction of brightest spaxels to include (e.g., 0.8 = brightest 80%) |
| range | Optional wavelength ranges to consider for spaxel selection (NULL for all) Format: [min1, max1, min2, max2, ...] in microns |
Definition at line 213 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_ERROR, BRK_IF_NULL, CATCH, CATCH_MSG, eris_ifu_extract_spec(), eris_ifu_lcorr_create_lambda_vector(), eris_ifu_lcorr_create_object_mask(), and TRY.
Referenced by eris_ifu_lcorr_get().
| cpl_polynomial * eris_ifu_lcorr_get | ( | cpl_imagelist * | cube, |
| hdrl_imagelist * | hdrlCube, | ||
| const cpl_propertylist * | header, | ||
| cpl_vector * | peaks, | ||
| const int | pfit_order | ||
| ) |
Create wavelength correction polynomial from IFU cube using OH lines.
This is the main entry point for lambda correction. It extracts an integrated spectrum from the input cube, detects OH emission line peaks, and cross-correlates them with reference line positions to derive a wavelength correction polynomial.
| cube | Input data cube (CPL imagelist format), set to NULL if hdrlCube is provided |
| hdrlCube | Input data cube (HDRL imagelist format), set to NULL if cube is provided |
| header | FITS header containing WCS and instrument information |
| peaks | Vector containing reference OH line wavelengths (in microns) |
| pfit_order | Order of polynomial fit (0=constant shift, 1=linear, 2=quadratic, etc.) |
Definition at line 84 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_ERROR, BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_get_band(), eris_ifu_lcorr_crosscorrelate_spectra(), eris_ifu_lcorr_extract_spectrum(), eris_ifu_mask_nans_in_cube(), hdrl_image_get_image(), hdrl_imagelist_get(), hdrl_imagelist_get_size(), and TRY.
Referenced by eris_ifu_jitter_process_exposures().
| cpl_vector * eris_ifu_lcorr_get_peak_lambdas | ( | const cpl_bivector * | spectrum, |
| double | min_frac, | ||
| cpl_vector * | range | ||
| ) |
Detect and refine emission line peak wavelengths using Gaussian fitting.
Identifies emission line peaks in the input spectrum and refines their positions by fitting Gaussian profiles. Outlier peaks are rejected based on statistical analysis of fitted wavelength shifts and line widths (sigma). This produces a clean set of well-measured line wavelengths suitable for wavelength calibration.
| spectrum | Input spectrum as bivector (X=wavelength in microns, Y=flux) |
| min_frac | Minimum flux threshold as fraction of maximum flux (0.0-1.0) |
| range | Optional wavelength ranges to search (NULL for all wavelengths) Format: [min1, max1, min2, max2, ...] pairs in microns |
Definition at line 729 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_ERROR, BRK_IF_NULL, BRK_WITH_ERROR, CATCH, CHECK_ERROR_STATE, eris_ifu_free_int_array(), eris_ifu_free_vector(), eris_ifu_lcorr_get_peak_positions(), fit_peak(), and TRY.
Referenced by eris_ifu_jitter_processSof().
| cpl_array * eris_ifu_lcorr_get_peak_positions | ( | const cpl_bivector * | spectrum, |
| double | min_frac, | ||
| cpl_vector * | range | ||
| ) |
Detect emission line peak positions in a spectrum.
Identifies local maxima (peaks) in the input spectrum that exceed a minimum flux threshold. Peaks can be restricted to specified wavelength ranges. The algorithm finds peaks by detecting sign changes in the first derivative (positive to negative transition).
| spectrum | Input spectrum as bivector (X=wavelength, Y=flux) |
| min_frac | Minimum flux threshold as fraction of maximum flux (0.0-1.0) |
| range | Optional wavelength ranges to search (NULL for all wavelengths) Format: [min1, max1, min2, max2, ...] pairs in microns |
Definition at line 602 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_ERROR, BRK_IF_NULL, CATCH, CATCH_MSG, and TRY.
Referenced by eris_ifu_lcorr_get_peak_lambdas().
| void eris_ifu_lcorr_open_debug_file | ( | const char * | filename | ) |
open ASCII file to hold debug results
| filename | input filename |
Definition at line 1423 of file eris_ifu_lambda_corr.c.
| cpl_bivector * eris_ifu_lcorr_read_OH_reference_spectrum | ( | const char * | filename, |
| cpl_size | ext_number | ||
| ) |
Read OH reference spectrum from FITS file.
Loads a reference OH sky emission spectrum from a FITS file and constructs a bivector with wavelength and flux values. The wavelength scale is derived from WCS keywords in the file's header.
| filename | Path to FITS file containing the reference spectrum |
| ext_number | FITS extension number to read (0 for primary HDU) |
Definition at line 499 of file eris_ifu_lambda_corr.c.
References ASSURE, BRK_IF_NULL, BRK_WITH_ERROR_MSG, CATCH, CATCH_MSG, CHECK_ERROR_STATE, and TRY.
Referenced by eris_ifu_jitter_processSof().
| double fit_peak | ( | const cpl_bivector * | spectrum, |
| const cpl_size | size, | ||
| double | lambda_in, | ||
| int | half_width, | ||
| double * | sigma_par | ||
| ) |
fit a peak
| spectrum | input spectrum |
| size | size of input spectrum |
| lambda_in | input lambda near which peak is found |
| half_width | input half_with of range where fit is done |
| sigma_par | output sigma |
Definition at line 1012 of file eris_ifu_lambda_corr.c.
References gauss1d_fnc(), and gauss1d_fncd().
Referenced by eris_ifu_lcorr_crosscorrelate_spectra(), and eris_ifu_lcorr_get_peak_lambdas().
| int gauss1d_fnc | ( | const double | x[], |
| const double | a[], | ||
| double * | result | ||
| ) |
define a Gaussian profile
| x | File name of input FITS file holding the reference spectrum |
| a | minimum fraction |
| result | Gaussian profile |
Definition at line 940 of file eris_ifu_lambda_corr.c.
Referenced by fit_peak().
| int gauss1d_fncd | ( | const double | x[], |
| const double | a[], | ||
| double | result[] | ||
| ) |
define a Gaussian profile
| x | File name of input FITS file holding the reference spectrum |
| a | minimum fraction |
| result | Gaussian profile |
Definition at line 969 of file eris_ifu_lambda_corr.c.
Referenced by fit_peak().