|
GRAVI Pipeline Reference Manual 1.8.0
|
Functions | |
| cpl_table * | gravi_table_ft_format (cpl_table *pix_table, cpl_table *skystd_table, cpl_table *skyavg_table, cpl_table *badft_table, int n_region, double gain, const cpl_parameterlist *parlist) |
| Extract FT spectrum from PIX column. | |
| cpl_table * | gravi_imglist_sc_collapse (cpl_table *profile_table, cpl_imagelist *raw_imglist, cpl_imagelist *rawVar_imglist, cpl_size startx) |
| Extract the SC spectrum with profile. | |
| cpl_error_code | gravi_interpolate_spectrum_table (cpl_table *spectrum_table, cpl_table *wave_table, cpl_table **oiwave_tables, cpl_table *detector_table, cpl_table *specflat_table, int type_data) |
| Re-interpolate in-place a spectrum table. | |
| int | gravi_pixel_is_good (cpl_image *bad_img, int x, int y) |
| Check if the pixel in the BADPIX map is a good pixel. | |
| cpl_error_code | gravi_remove_badpixel_sc (cpl_imagelist *imglist_sc, cpl_image *bad_img) |
| Remove the badpixel of the SC. | |
| gravi_data * | gravi_extract_spectrum (gravi_data *raw_data, gravi_data *profile_map, gravi_data *dark_map, gravi_data *bad_map, gravi_data *sky_map, const cpl_parameterlist *parlist, enum gravi_detector_type det_type) |
| Create the SPECTRUM gravi_data with extracted spectrum per region. | |
| cpl_error_code | gravi_subtract_met_dark (gravi_data *preproc_data, gravi_data *dark_map) |
| Substract metrology dark. | |
| cpl_error_code | gravi_align_spectrum (gravi_data *spectrum_data, gravi_data *wave_map, gravi_data *p2vm_map, enum gravi_detector_type det_type) |
| Regrid the regions into a common wavelength (in-place) | |
This module implements the preprocessing of the data, which is mainly to convert raw data into spectra. The main function gravi_extract_spectrum() is used at several place in the pipeline. And the steps of the preprocessing are description in the sections :
| cpl_error_code gravi_align_spectrum | ( | gravi_data * | spectrum_data, |
| gravi_data * | wave_map, | ||
| gravi_data * | p2vm_map, | ||
| enum gravi_detector_type | det_type | ||
| ) |
Regrid the regions into a common wavelength (in-place)
| spectrum_data | The SPECTRUM data to regrid |
| wave_map | The WAVE calibration map (current grid) |
| p2vm_map | or NULL The P2VM calibration map (target grid) |
| det_type | The detector to align. If GRAVI_DET_SC, then only the science detector extensions will be processed. GRAVI_DET_FT will do the same for FT detector and GRAVI_DET_ALL will do it for both. |
| parlist | Input parameter list (no parameter used). |
It re-samples the spectral element according to the wavelength calibration. The SPECTRUM are re-interpolated into the OI_WAVELENGTH of this P2VM map. The target wavelength are the one of the OI_WAVELENGTH from the P2VM map (assumed to be the same for both polarisation!!)
This is done in-place to save enormous time, especially on FT.
Definition at line 1510 of file gravi_preproc.c.
References cpl_msg_info(), cpl_propertylist_update_double(), CPLCHECK_MSG, FREE, gravi_data_copy_ext(), gravi_data_get_header, gravi_data_get_imaging_detector, gravi_data_get_oiwave_tables(), gravi_data_get_spectrum_data, gravi_data_get_spectrum_data_plist, gravi_data_get_table(), gravi_data_get_wave_data, gravi_data_has_spectrum, GRAVI_DET_ALL, GRAVI_DET_FT, GRAVI_DET_SC, gravi_interpolate_spectrum_table(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_OI_WAVELENGTH_EXT, GRAVI_SC, gravi_spectrum_get_flux(), gravi_spectrum_get_npol, gravi_spectrum_get_nwave(), GRAVI_SPECTRUMFLAT_DATA_SC_EXT, GRAVI_TYPE, PROFILE_FULLSTARTX, PROFILE_NX, and PROFILE_STARTX.
Referenced by gravity_disp(), gravity_p2vm(), gravity_vis(), and gravity_wavelamp().
| gravi_data * gravi_extract_spectrum | ( | gravi_data * | raw_data, |
| gravi_data * | profile_map, | ||
| gravi_data * | dark_map, | ||
| gravi_data * | bad_map, | ||
| gravi_data * | sky_map, | ||
| const cpl_parameterlist * | parlist, | ||
| enum gravi_detector_type | det_type | ||
| ) |
Create the SPECTRUM gravi_data with extracted spectrum per region.
| raw_data | Input RAW gravi_data |
| profile_data | FLAT calibration map, with profiles |
| dark_data | DARK calibration map |
| bad_map | BAD calibration map |
| sky_map | SKY calibration map |
| parlist | Input parameter list with :
|
| det_type | The detector to extract GRAVI_DET_SC, GRAVI_DET_FT or GRAVI_DET_ALL |
| CPL_ERROR_NULL_INPUT | input data is missing |
It substrates the dark map. It converts data into photoelectrons using the gain map and identify the bad pixels for a correction. Finally it extracts the spectra with the calibrated spatial profile (for SC data)
Definition at line 612 of file gravi_preproc.c.
References cpl_image_delete(), cpl_msg_info(), cpl_propertylist_update_double(), CPLCHECK_NUL, FREE, GRAVI_DATA, gravi_data_add_table(), gravi_data_copy_ext(), gravi_data_get_cube(), gravi_data_get_header, gravi_data_get_img, gravi_data_get_plist(), gravi_data_get_table(), gravi_data_has_detector, gravi_data_is_internal, gravi_data_new(), GRAVI_DATAERR, GRAVI_DET_ALL, GRAVI_DET_FT, GRAVI_DET_SC, GRAVI_FT, gravi_imagelist_get_flux(), GRAVI_IMAGING_DATA_FT_EXT, GRAVI_IMAGING_DATA_SC_EXT, GRAVI_IMAGING_DETECTOR_FT_EXT, GRAVI_IMAGING_DETECTOR_SC_EXT, GRAVI_IMAGING_ERR_FT_EXT, GRAVI_IMAGING_ERR_SC_EXT, gravi_imglist_sc_collapse(), gravi_msg_function_exit, gravi_msg_function_start, gravi_msg_warning(), gravi_param_get_int_default(), gravi_pfits_add_check(), gravi_pfits_get_dit_sc(), gravi_pfits_get_ft_gain(), gravi_pfits_get_pola_mode(), gravi_pfits_get_sc_gain(), gravi_pfits_get_spec_res(), gravi_pfits_get_startx(), gravi_pfits_get_time_sc(), GRAVI_PROFILE_DATA_EXT, gravi_remove_badpixel_sc(), GRAVI_SC, GRAVI_SPECTRUM_DATA_FT_EXT, GRAVI_SPECTRUM_DATA_SC_EXT, gravi_spectrum_get_flux(), gravi_spectrum_get_nwave(), GRAVI_SPECTRUMFLAT_DATA_SC_EXT, gravi_table_ft_format(), PROFILE_FULLSTARTX, PROFILE_NX, and PROFILE_STARTX.
Referenced by gravi_fit_argon(), gravity_disp(), gravity_p2vm(), gravity_vis(), and gravity_wavelamp().
| cpl_table * gravi_imglist_sc_collapse | ( | cpl_table * | profile_table, |
| cpl_imagelist * | raw_imglist, | ||
| cpl_imagelist * | rawVar_imglist, | ||
| cpl_size | startx | ||
| ) |
Extract the SC spectrum with profile.
| profile_table | Input table containing the profile images |
| raw_imagelist | Input imagelist of raw data |
| rawVar_imagelist | Input imagelist of variance |
| startx | Input left location of profile in image |
Extract all the spectrum using the spectrum extraction method based on the optimal extraction algorithm (Horne, 1986). This algorithm is based on the knowledge of a spatial profile. Note the profile may not be optimal (ex: boxcard) but shall ensure flux-conservation from its normalization.
The profile table shall contains DATA# columns, each containing the image of the profile of this region. The return tables contains DATA# column with flux, and DATAERR# columns with errors (sqrt(variance)).
startx is the left start column of the profile in images, in FITS convention (1 for the first pixel).
Definition at line 458 of file gravi_preproc.c.
References cpl_image_delete(), cpl_image_multiply(), cpl_msg_debug(), CPLCHECK_NUL, FREE, GRAVI_DATA, GRAVI_DATAERR, gravi_imagelist_unwrap_images(), gravi_imagelist_wrap_column(), gravi_msg_function_exit, gravi_msg_function_start, and gravi_spectrum_get_nregion().
Referenced by gravi_extract_spectrum().
| cpl_error_code gravi_interpolate_spectrum_table | ( | cpl_table * | spectrum_table, |
| cpl_table * | wave_table, | ||
| cpl_table ** | oiwave_tables, | ||
| cpl_table * | detector_table, | ||
| cpl_table * | specflat_table, | ||
| int | type_data | ||
| ) |
Re-interpolate in-place a spectrum table.
| spectrum_table | The table to manipulate |
| wave_table | The input wave_table (one map per region) |
| oiwave_tables | The output OI_WAVEs table (same for all regions) |
| detector_rable | The input IMAGING DETECTOR table |
| specflat_table | The SPECTRUMFLAT, to allow unbiased effective wave |
| parlist | Input parameter list (no parameter used) |
All regions are re-interpolated into a common wavelength grid, defined by the oiwave_table (OIFITS format). The input wave_table contains the the initial wavelength grid of each region.
The wavelength bins in wave_table shall be monotonic incresing. All wavelength bins of oiwave_table shall be within the min/max of wave_table (not extrapolation is allowed).
Definition at line 1038 of file gravi_preproc.c.
References cpl_msg_debug(), cpl_msg_info(), CPLCHECK_MSG, FREE, GRAVI_DATA, GRAVI_DATAERR, gravi_msg_function_exit, gravi_msg_function_start, gravi_region_get_pol(), GRAVI_SC, gravi_spectrum_get_npol, gravi_spectrum_get_nregion(), gravi_spectrum_get_nwave(), and gravi_table_get_value.
Referenced by gravi_align_spectrum().
| int gravi_pixel_is_good | ( | cpl_image * | bad_img, |
| int | x, | ||
| int | y | ||
| ) |
Check if the pixel in the BADPIX map is a good pixel.
| bad_img | badpix as img |
| x | xpos |
| y | ypos |
Definition at line 98 of file gravi_preproc.c.
References BADPIX_DARK, BADPIX_FLAT, and BADPIX_RMS.
| cpl_error_code gravi_remove_badpixel_sc | ( | cpl_imagelist * | imglist_sc, |
| cpl_image * | bad_img | ||
| ) |
Remove the badpixel of the SC.
| imglist_sc | input data as imglist, remove inplace |
| bad_img | badpixel image |
The bad pixels of imglist_sc, identified by the map bad_img, are re-interpolated from neighboring values with a special care of the spatial / spectral directions since the spectra are almost 1D.
Definition at line 124 of file gravi_preproc.c.
References CPLCHECK_MSG, gravi_msg_function_exit, and gravi_msg_function_start.
Referenced by gravi_compute_profile(), and gravi_extract_spectrum().
| cpl_error_code gravi_subtract_met_dark | ( | gravi_data * | preproc_data, |
| gravi_data * | dark_map | ||
| ) |
Substract metrology dark.
| preproc_data | The table to manipulate |
| dark_data | DARK calibration map |
If Metrology dark is present, subtract DARK to METROLOGY data
Definition at line 978 of file gravi_preproc.c.
References cpl_msg_info(), CPLCHECK_MSG, gravi_data_get_table(), gravi_data_has_extension(), GRAVI_METROLOGY_EXT, gravi_msg_function_exit, and gravi_msg_function_start.
Referenced by gravity_vis().
| cpl_table * gravi_table_ft_format | ( | cpl_table * | pix_table, |
| cpl_table * | skystd_table, | ||
| cpl_table * | skyavg_table, | ||
| cpl_table * | badft_table, | ||
| int | n_region, | ||
| double | gain, | ||
| const cpl_parameterlist * | parlist | ||
| ) |
Extract FT spectrum from PIX column.
| pix_table | Input raw data [adu] |
| skystd_table | Input SKY std data [adu] |
| skyavg_table | Input SKY avg data [adu] |
| n_region | Number of regions to descramble |
| gain | Conversion gain in [ADU/e] |
The TIME column is duplicated in output. The pixels from the PIX column are descrambled into DATA# = (RAW-SKY)/gain DATAERR# = sqrt (max(DATA#,0) + (SKYSTD/gain)^2)
Definition at line 283 of file gravi_preproc.c.
References cpl_msg_info(), CPLCHECK_NUL, FREE, GRAVI_DATA, GRAVI_DATAERR, gravi_msg_function_exit, gravi_msg_function_start, gravi_param_get_bool(), and gravi_table_get_value.
Referenced by gravi_extract_spectrum().