GRAVI Pipeline Reference Manual 1.7.2
Loading...
Searching...
No Matches
Macros | Functions | Variables
Detector calibration

Macros

#define INFO_DEBUG   0
 

Functions

cpl_error_code gravi_fit_profile (cpl_vector *values_x0, cpl_vector *values_y0, cpl_vector *values_sigma, cpl_image *mean_img, int ref_x, int ref_y, int size_profile, const char *resolution)
 Fit the profile parameters in an image.
 
cpl_image * gravi_create_profile_image (cpl_image *mean_img, cpl_vector *values_x0, cpl_vector *values_y0, cpl_vector *values_sigma, cpl_size iy_min, cpl_size iy_max, const char *mode)
 Create the profile image from image and/or fitted params.
 
gravi_datagravi_compute_dark (gravi_data *raw_data)
 Compute the DARK calibration map.
 
gravi_datagravi_average_dark (gravi_data **data, cpl_size ndata)
 Average several DARK calibration map.
 
gravi_datagravi_compute_profile (gravi_data **flats_data, gravi_data *dark_map, gravi_data *bad_map, int nflat, const cpl_parameterlist *params)
 Computes the spatial profile of each spectrum for optimal extraction purpose.
 
cpl_propertylist * gravi_compute_gain (gravi_data **flats_data, int nrawgain, gravi_data *dark_map)
 Compute mean detector gain.
 
gravi_datagravi_compute_badpix (gravi_data *dark_map, gravi_data **flats_data, int nflat, const cpl_parameterlist *params)
 Identify the bad pixels in the DARK map and create the BAD map.
 
gravi_datagravi_compute_biasmask (gravi_data *dark_map, gravi_data **flats_data, int nflat, const cpl_parameterlist *params)
 Create BIASMASK for SC from raw FLATs and raw DARK.
 
gravi_datagravi_compute_piezotf (gravi_data *data, const cpl_parameterlist *params)
 Create piezo transfer function for Kalman Calibration & monitoring.
 
cpl_error_code gravi_remove_cosmicrays_sc (cpl_imagelist *imglist_sc)
 Remove cosmic rays via filtering through images.
 
cpl_array * gravi_filter_array_median (const cpl_array *arr, int size)
 Apply median filter on 1-D array.
 
double gravi_calc_sigmaclipped_stddev (const cpl_array *arr, double nstd)
 Perform sigma-clipping on input array and return std of clipped array.
 
gravi_datagravi_compute_pca (gravi_data **data, int naccept, const cpl_parameterlist *params)
 Fit model for visphi flattening using PCA.
 
cpl_error_code gravi_flatten_vis (gravi_data *vis_data, gravi_data *calib_data)
 Use PCA model to flatten observed visphi. The flattened data are added to the existing VIS table.
 

Variables

static double met_Sep_2016 [64] = {-0.000338233 ,-0.000282107 ,0.000345582 ,0.000381979 ,0.000326764 ,-0.000225664 ,5.35555e-05 ,0.00060938 ,-0.000205619 ,-0.000265577 ,0.00017356 ,0.000265687 ,0.000295987 ,3.05255e-05 ,-0.000498407 ,0.000232075 ,0.00502058 ,0.002045925 ,-0.000110657 ,-0.000403592 ,-0.000065043 ,-0.000433645 ,-0.000626545 ,3.29765e-05 ,-0.001694525 ,-0.0011684 ,6.2795e-06 ,-0.001584115 ,-0.000735553 ,-0.000868538 ,-0.000985087 ,-0.0008204 ,0.000768577 ,0.000848342 ,-0.000134943 ,-0.000385157 ,-8.68822e-05 ,-0.000757366 ,0.000446051 ,-0.000231723 ,0.000790425 ,-0.000638897 ,0.000503496 ,-7.78205e-05 ,0.000287366 ,0.000243789 ,0.000083288 ,-0.000125138 ,-0.000147337 ,4.14224e-05 ,0.000123082 ,-0.00117179 ,4.54785e-05 ,-0.000186707 ,0.000682836 ,0.00090649 ,0.000357256 ,-0.002133845 ,-0.00151895 ,-0.00150048 ,-0.00266423 ,-0.0030716 ,0.000599228 ,-0.001078583}
 
static double met_Mar_2017 [64] = {0.000481474 ,0.000678173 ,0.00022232 ,9.04735e-05 ,0.001030283 ,0.000400478 ,0.000199579 ,0.000610902 ,0.000870061 ,0.001148845 ,0.000706636 ,0.000491999 ,0.00093158 ,0.001224225 ,0.000652115 ,0.001117025 ,0.00481452 ,0.002359475 ,0.000641491 ,0.000126103 ,0.000158341 ,0.001455785 ,0.000227113 ,0.000366087 ,-0.000372672 ,-0.000814455 ,0.000403834 ,-0.00072791 ,-0.000422227 ,0.000413887 ,-0.000024651 ,0.000106683 ,0.00092596 ,0.000327427 ,0.000775269 ,0.000906505 ,0.000108337 ,-0.000214467 ,0.001249965 ,0.000694693 ,0.000718101 ,0.00083926 ,0.00138818 ,0.00131215 ,0.001113065 ,0.00134113 ,0.000972572 ,0.00073247 ,-3.35943e-05 ,0.000312545 ,0.000365923 ,0.000510906 ,0.000955084 ,0.000808904 ,0.000403238 ,-0.000150186 ,0.000200673 ,-0.00078668 ,-0.00078133 ,-0.00039955 ,-0.00226333 ,-0.00177287 ,0.000435995 ,-0.000397403}
 
static double met_Jun_2017 [64] = {0.00029923 ,5.42185e-05 ,-0.000023823 ,0.000187444 ,0.000650675 ,0.000135629 ,-0.000047364 ,0.000479489 ,0.000463565 ,0.000536066 ,0.000528847 ,0.000874895 ,0.000702853 ,0.000438988 ,0.000183642 ,0.000536044 ,0.004829985 ,0.00215068 ,5.94134e-05 ,-0.000164468 ,-4.89301e-05 ,0.000400028 ,-0.000277333 ,-0.000169422 ,-0.00136967 ,-0.000998661 ,0.000244959 ,-0.00123726 ,-0.000404182 ,-0.000511517 ,-0.000398515 ,-0.000314167 ,0.000546602 ,0.000547136 ,0.000388259 ,0.000108443 ,-0.000266431 ,-0.000734324 ,0.000946866 ,0.0001005 ,0.000739434 ,0.000530113 ,0.000821013 ,0.000748435 ,0.00094666 ,0.00102861 ,-0.00013052 ,0.000576223 ,-0.000657692 ,-0.000293389 ,0.000146337 ,-0.000338176 ,0.000241386 ,0.00005168 ,0.000495891 ,-1.76273e-05 ,8.84135e-05 ,-0.00153857 ,-0.000850848 ,-0.000986058 ,-0.002700175 ,-0.002620785 ,0.000440797 ,-0.00063843}
 
static double met_Jul_2017 [64] = {8.19405e-05 ,-0.000061716 ,0.000067827 ,0.000234624 ,0.000521161 ,0.000031451 ,0.000211139 ,0.000578157 ,0.000316435 ,0.000431433 ,0.000431228 ,0.000761259 ,0.000576742 ,0.000299923 ,0.00034315 ,0.000561323 ,0.004834095 ,0.00208259 ,-0.000155192 ,-0.000120373 ,-0.000328756 ,0.000265791 ,-0.000249398 ,-0.000310416 ,-0.001047503 ,-0.000884526 ,0.000431645 ,-0.000890023 ,-0.000330709 ,-0.000540866 ,-0.0002067 ,-0.000334498 ,0.00035945 ,0.000683828 ,0.000464533 ,0.000166613 ,-0.000276387 ,-0.00088093 ,0.001283446 ,0.00016521 ,0.000578248 ,0.000334565 ,0.000762716 ,0.000521964 ,0.000757276 ,0.000959739 ,0.000035001 ,0.000442429 ,-0.0006928 ,-0.000105863 ,-0.00006137 ,-0.000454825 ,-0.000157343 ,-5.68635e-05 ,0.000296553 ,-3.80711e-05 ,0.000384616 ,-0.00149983 ,-0.000650183 ,-0.00076473 ,-0.002494945 ,-0.00246317 ,0.000794264 ,-0.000337915}
 
static double met_Aug_2017 [64] = {0.000225917 ,0.00033629 ,1.70956e-05 ,0.000178987 ,0.00103744 ,0.000275415 ,0.000107582 ,0.000678724 ,0.000402821 ,0.000713535 ,0.000518528 ,0.000607008 ,0.000506748 ,0.000640514 ,0.000300349 ,0.000522693 ,0.005585285 ,0.00305222 ,0.000771553 ,0.001006485 ,0.000618719 ,0.00130769 ,0.000419028 ,0.000491215 ,-0.000815277 ,-0.000646205 ,0.000640702 ,-0.000881775 ,-0.000200994 ,-0.000258582 ,-0.000465663 ,-0.00004838 ,0.000591627 ,0.000615608 ,0.000197913 ,0.000352664 ,-0.000113565 ,-0.000637229 ,0.001241975 ,-6.659e-06 ,0.000649339 ,0.000641595 ,0.000673658 ,0.000657426 ,0.001263897 ,0.001258565 ,0.000050901 ,0.000318844 ,-9.23866e-05 ,0.00065074 ,0.000793493 ,0.000600095 ,0.001049984 ,0.000858337 ,0.000786737 ,0.000737051 ,0.000576774 ,-0.001384295 ,-0.000642989 ,-0.0008569 ,-0.00208747 ,-0.00247888 ,0.00108834 ,-0.000190064}
 

Detailed Description

This module contains the functions that are used to calibrate the detector. These functions characterize the pixels of the detectors. They are call by the recipe gravity_dark or gravity_p2vm.

Macro Definition Documentation

◆ INFO_DEBUG

#define INFO_DEBUG   0

Definition at line 47 of file gravi_calib.c.

Function Documentation

◆ gravi_average_dark()

gravi_data * gravi_average_dark ( gravi_data **  data,
cpl_size  ndata 
)

Average several DARK calibration map.

Parameters
dataList of input DARK map
ndataNumber of DARK in the list
Returns
A newly allocated DARK calibration map
Exceptions
CPL_ERROR_NULL_INPUTno data as input

Definition at line 457 of file gravi_calib.c.

References cpl_msg_info(), CPLCHECK_NUL, gravi_data_duplicate(), gravi_data_get_img, gravi_data_get_table(), GRAVI_IMAGING_DATA_FT_EXT, GRAVI_IMAGING_DATA_SC_EXT, GRAVI_IMAGING_ERR_FT_EXT, GRAVI_IMAGING_ERR_SC_EXT, gravi_msg_function_exit, gravi_msg_function_start, and gravi_msg_warning().

Referenced by gravity_vis().

◆ gravi_calc_sigmaclipped_stddev()

double gravi_calc_sigmaclipped_stddev ( const cpl_array *  arr,
double  nstd 
)

Perform sigma-clipping on input array and return std of clipped array.

Parameters
arrArray to operate on.
nstdNumber of standard deviations to clip beyond.
Returns
Standard deviation of clipped array.

Definition at line 2891 of file gravi_calib.c.

Referenced by gravi_compute_pca().

◆ gravi_compute_badpix()

gravi_data * gravi_compute_badpix ( gravi_data dark_map,
gravi_data **  flats_data,
int  nflat,
const cpl_parameterlist *  params 
)

Identify the bad pixels in the DARK map and create the BAD map.

Parameters
dark_mapThe input dark map calibration
flats_dataThe input raw flats (optional)
nflatThe number of input flats (shall be 4)
paramsInput parameter list with :
  • bad-dark-threshold : the rms factor for dark bad pixel threshold.
Returns
The BAD map with the detected bad pixels.
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTThe number of input flats is not 4

Pixel with dark value or read-out-noise out of a specified range are declared as bad pixels.

If the flats_data are provided, they are collapsed together. Pixel with mean flat value lower than a horizontal median filtering are declared as bad pixels. Only pixel with a mean flat value higher than 100 adu are inspected. The mask of inspected pixels is saved in IMAGING_MASK_SC. This can be applied with normal or defocused FLATs. Still to be validated in LOW.

FIXME: in term of implementation, this function is weird as some of the computation are somehow done in-place after duplication of the data...

Definition at line 1806 of file gravi_calib.c.

References BADPIX_DARK, BADPIX_FLAT, BADPIX_RMS, cpl_image_delete(), cpl_msg_info(), CPLCHECK_NUL, FREE, gravi_data_add_img(), gravi_data_add_table(), gravi_data_copy_ext(), gravi_data_get_cube(), gravi_data_get_header, gravi_data_get_img, gravi_data_get_table(), gravi_data_has_extension(), gravi_data_new(), gravi_image_get_quantile(), GRAVI_IMAGING_DATA_ACQ_EXT, 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_IMAGING_MASK_SC_EXT, gravi_msg_function_exit, gravi_msg_function_start, gravi_param_get_bool(), gravi_param_get_int(), QC_BADPIX_DARK_SC, QC_BADPIX_FLAT_SC, QC_BADPIX_FT, QC_BADPIX_RMS_SC, QC_BADPIX_SC, QC_DARKRMS_FT, QC_DARKRMS_SC, and QC_MEANDARK_FT.

Referenced by gravity_badpix(), and gravity_p2vm().

◆ gravi_compute_biasmask()

gravi_data * gravi_compute_biasmask ( gravi_data dark_map,
gravi_data **  flats_data,
int  nflat,
const cpl_parameterlist *  params 
)

Create BIASMASK for SC from raw FLATs and raw DARK.

Parameters
dark_mapThe input dark map calibration
flats_dataThe input raw flats (optional)
nflatThe number of input flats (shall be 4)
paramsThe parameter list (no parameter used)
Returns
The BIASMASK map with the un-illuminated pixels.
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTThe number of input flats is not 4

Pixel with values lower than 100 adu in the collapsed FLAT are flag with 1 in the BIASMASK, while illuminated pixels (>100adu) are flag with 0 in BIASMASK.

FIXME: improve the way we define the threshold. Use an 'ouverture' filtering maybe.

Definition at line 2271 of file gravi_calib.c.

References cpl_image_delete(), cpl_msg_info(), CPLCHECK_NUL, FREE, GRAVI_BIAS_MASK_SC_EXT, gravi_data_add_img(), gravi_data_copy_ext(), gravi_data_get_cube(), gravi_data_get_header, gravi_data_get_img, gravi_data_new(), gravi_image_get_quantile(), GRAVI_IMAGING_DATA_SC_EXT, GRAVI_IMAGING_DETECTOR_SC_EXT, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravity_biasmask().

◆ gravi_compute_dark()

gravi_data * gravi_compute_dark ( gravi_data raw_data)

Compute the DARK calibration map.

Parameters
raw_dataThe input raw dark
Returns
The output DARK calibration map
Exceptions
CPL_ERROR_NULL_INPUTno raw_data as input

The dark image of the SC is a saved as full image of the mean dark value and mean dark standard deviation (RON). The dark for the FT is saved into PIX array of the mean and dark standard deviation (RON). And the dark of the metrology is save into the METROLOGY table.

Definition at line 125 of file gravi_calib.c.

References cpl_image_delete(), cpl_msg_info(), cpl_propertylist_update_double(), CPLCHECK_NUL, FREE, gravi_array_wrap_image(), gravi_data_add_img(), gravi_data_add_table(), gravi_data_check_shutter_closed, gravi_data_check_shutter_open, gravi_data_copy_ext(), gravi_data_get_cube(), gravi_data_get_header, gravi_data_get_plist(), gravi_data_get_table(), gravi_data_has_extension(), gravi_data_new(), gravi_imagelist_unwrap_images(), gravi_imagelist_wrap_column(), GRAVI_IMAGING_DATA_ACQ_EXT, 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_METROLOGY_ERR_EXT, GRAVI_METROLOGY_EXT, gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_add_check(), gravi_pfits_get_dpr_type(), met_Aug_2017, met_Jul_2017, met_Jun_2017, met_Mar_2017, met_Sep_2016, QC_ACQ_ZERO_NB, QC_DARKRANGE_MET, QC_DARKRMS_FT, QC_DARKRMS_MET, QC_DARKRMS_SC, QC_MEANDARK_FT, QC_MEANDARK_MET, QC_MEANDARK_SC, QC_MEANSKY_FT, QC_MEANSKY_SC, QC_SKYRMS_FT, and QC_SKYRMS_SC.

Referenced by gravity_badpix(), gravity_biasmask(), gravity_dark(), gravity_disp(), gravity_p2vm(), gravity_vis(), and gravity_wavelamp().

◆ gravi_compute_gain()

cpl_propertylist * gravi_compute_gain ( gravi_data **  flats_data,
int  nrawgain,
gravi_data dark_map 
)

Compute mean detector gain.

Parameters
flats_dataThe input raw FLAT data, one per beam
nrawgain4
dark_mapThe input DARK calibration map
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTnot all shutter are opened

It returs a propertylist with the QC value of the mean SC and mean FT gain, in [ADU/e].

Definition at line 1551 of file gravi_calib.c.

References cpl_image_delete(), cpl_msg_info(), CPLCHECK_NUL, FREE, gravi_check_shutter(), gravi_data_check_shutter_beam(), gravi_data_get_cube(), gravi_data_get_header, gravi_data_get_img, gravi_data_get_table(), gravi_data_has_extension(), gravi_image_from_column(), gravi_imagelist_from_column(), GRAVI_IMAGING_DATA_FT_EXT, GRAVI_IMAGING_DATA_SC_EXT, gravi_msg_function_exit, gravi_msg_function_start, QC_MEANGAIN_FT, and QC_MEANGAIN_SC.

Referenced by gravity_p2vm().

◆ gravi_compute_pca()

gravi_data * gravi_compute_pca ( gravi_data **  data,
int  naccept,
const cpl_parameterlist *  params 
)

Fit model for visphi flattening using PCA.

Parameters
dataThe input data to generate calibration from
nacceptLength of data (number of accepted frames)
paramsInput parameter list with :
  • pca-clean-size : Window size to use for outlier cleaning
  • pca-clean-nstd : Sigma-clip n_std for outlier cleaning
  • pca-components : Number of PCA components to compute
  • pca-fit-type : Method to use for fitting PCA components
  • pca-fit-degree : Polynomial fit degree, or number of spline components, depending on value of pca-fit-type.
  • pca-save-residuals : Also save the residuals from the PCA fitting for inspection.
Returns
Table of computed PCA calibrations.
Exceptions
CPL_ERROR_NULL_INPUTinput data or parameters are missing
CPL_ERROR_DATA_NOT_FOUNDno valid input data provided

Definition at line 2945 of file gravi_calib.c.

References CPLCHECK_NUL, FREE, gravi_calc_sigmaclipped_stddev(), gravi_data_add_table(), gravi_data_get_header, gravi_data_get_oi_vis, gravi_data_get_oi_wave, gravi_data_get_oi_wave_plist, gravi_data_new(), gravi_filter_array_median(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NBASE, gravi_pca_create_model(), gravi_pca_create_result(), gravi_pca_decomp_matrix_svd(), GRAVI_PCA_EXT, gravi_pca_fit_components_bspline(), gravi_pca_fit_components_polynomial(), gravi_pca_fit_model(), gravi_pca_get_component(), gravi_pca_get_component_fit(), gravi_pca_get_component_median(), gravi_pca_get_data_residual(), gravi_pca_model_delete(), gravi_pca_refine_mean(), GRAVI_PCA_RESID_EXT, gravi_pca_result_delete(), gravi_pca_set_component_signs(), gravi_pfits_get_pola_mode(), gravi_pfits_get_pola_num(), gravi_pfits_get_spec_res(), GRAVI_SC, and header.

Referenced by gravity_pcacal().

◆ gravi_compute_piezotf()

gravi_data * gravi_compute_piezotf ( gravi_data data,
const cpl_parameterlist *  params 
)

Create piezo transfer function for Kalman Calibration & monitoring.

Parameters
dataThe input raw data
paramsThe parameter list (no parameter used)
Returns
The table of the OPDC data with the correct QC insrted
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing

1- Read the piezo commands (in volts) from the OPDC table 2- Read the OPD measured by the fringe tracker (in radians) 3- Using an SVD inversion, get the 20 parameters of the transfer function: OPD(n)=a_i*piezo(n-1)+b_i*piezo(n-2)+c_i*piezo(n-3)+d_i*piezo(n-4)+e_i*piezo(n-5) where i is the piezo number (between 1 and 4), and a,b,c,d,e the 5 values of the autoregressive function of degree 5 (AR5). 4- Compute and store the QC parameters: residual errors, delay, gain, etc...

Definition at line 2376 of file gravi_calib.c.

References cpl_msg_info(), cpl_propertylist_update_double(), CPLCHECK_NUL, gravi_data_copy_ext(), gravi_data_get_header, gravi_data_get_table(), gravi_data_new(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NBASE, GRAVI_OPDC_EXT, and ntel.

Referenced by gravity_piezo().

◆ gravi_compute_profile()

gravi_data * gravi_compute_profile ( gravi_data **  flats_data,
gravi_data dark_map,
gravi_data bad_map,
int  nflat,
const cpl_parameterlist *  params 
)

Computes the spatial profile of each spectrum for optimal extraction purpose.

Parameters
flats_dataThe FLAT_RAW datas. Each of the flats has the shutter of only one telescope open
dark_mapThe DARK calibration map
bad_mapBAD calibration map
nflatThe number of FLAT file inputs
paramsInput parameter list with :
  • profile-width : Width of the detector window extracted around the default position of each spectrum, and on which the profile will be applied to perform the extraction.
  • force-badpix-to-zero : Force the badpixel to zero in profile.
  • profile-mode : Method to compute the extraction profile. PROFILE corresponds to the pixel intensities measured in the FLAT files (Gaussian like with FWHM of approx 1.5 pixel). This is the AUTO option for the Low and Med spectral resolution. GAUSS corresponds to a Gaussian fit of the (non-zero) pixel intensities measured in the FLAT files. BOX corresponds to a box-card of 6 pixels centered on the spectra measured in the FLAT files. This is the AUTO option for High spectral resolution.
Returns
The gravi_data with FLATs and PROFILE maps
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTnot all shutter are opened or profile_width option not > 0 or missing table in the input data

For each region defined in the IMAGING_DETECTOR_SC table this function retrieves the profile of the spectrum passing by the reference point defined in the table IMAGING_DETECTOR_SC. The FT data have no profile.

Definition at line 994 of file gravi_calib.c.

References cpl_image_delete(), cpl_image_multiply(), cpl_msg_info(), CPLCHECK_NUL, FREE, FREELOOP, gravi_array_wrap_image(), gravi_create_profile_image(), GRAVI_DATA, gravi_data_add_img(), gravi_data_add_table(), gravi_data_check_shutter_beam(), gravi_data_copy_ext(), gravi_data_get_cube(), gravi_data_get_header, gravi_data_get_img, gravi_data_get_table(), gravi_data_has_extension(), gravi_data_new(), gravi_fit_profile(), gravi_get_shutter_id(), gravi_image_extract_dimension(), gravi_image_from_column(), gravi_imagelist_unwrap_images(), gravi_imagelist_wrap_column(), GRAVI_IMAGING_DATA_FT_EXT, GRAVI_IMAGING_DATA_SC_EXT, GRAVI_IMAGING_DETECTOR_FT_EXT, GRAVI_IMAGING_DETECTOR_SC_EXT, gravi_msg_function_exit, gravi_msg_function_start, gravi_param_get_bool(), gravi_param_get_int(), gravi_param_get_string_default(), gravi_pfits_get_pola_mode(), gravi_pfits_get_resolution(), gravi_pfits_get_window_start(), GRAVI_PROFILE_DATA_EXT, GRAVI_PROFILE_PARAMS_EXT, gravi_region_get_tel(), gravi_remove_badpixel_sc(), GRAVI_SC, gravi_table_get_value, PROFILE_FULLSTARTX, PROFILE_NX, PROFILE_STARTX, and QC_DARKRMS_SC.

Referenced by gravity_p2vm().

◆ gravi_create_profile_image()

cpl_image * gravi_create_profile_image ( cpl_image *  mean_img,
cpl_vector *  values_x0,
cpl_vector *  values_y0,
cpl_vector *  values_sigma,
cpl_size  iy_min,
cpl_size  iy_max,
const char *  mode 
)

Create the profile image from image and/or fitted params.

Parameters
mean_imgInput image (nx,ny)
values_x0Input vector of spectral channels (0..nx-1)
values_y0Input vector of profile center in spatial direction
values_sigmaInput vector of profile width in spatial direction
iy_minMin coordinate where to fill the profile (0..ny-1)
iy_maxMax coordinate where to fill the profile (0..ny-1)
mode"BOX", "PROFILE", "GAUSS"
Returns
The image of the profile
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTiy_min or iy_max are outside boundaries

The vectors values_x0, values_y0, values_sigma are first smoothed (duplicated) with a polynomial interpolation before being used. The image of the profile is built either from mean_img (LOW, MED) or is a boxcard of 5 pixels (HIGH).

Definition at line 814 of file gravi_calib.c.

References cpl_msg_info(), CPLCHECK_NUL, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_profile().

◆ gravi_filter_array_median()

cpl_array * gravi_filter_array_median ( const cpl_array *  arr,
int  size 
)

Apply median filter on 1-D array.

Parameters
arrArray to filter.
sizeWindow size for filter.
Returns
Filtered array, which must be deallocated with cpl_array_delete.

Definition at line 2862 of file gravi_calib.c.

Referenced by gravi_compute_pca().

◆ gravi_fit_profile()

cpl_error_code gravi_fit_profile ( cpl_vector *  values_x0,
cpl_vector *  values_y0,
cpl_vector *  values_sigma,
cpl_image *  mean_img,
int  ref_x,
int  ref_y,
int  size_profile,
const char *  resolution 
)

Fit the profile parameters in an image.

Parameters
values_x0Output vector of spectral channels (0..nx-1)
values_y0Output vector of profile center in spatial direction
values_sigmaOutput vector of profile width in spatial direction
mean_imgInput image (nx,ny)
ref_x,ref_yCoordinate of a known pixel inside the spectra
size_profileSpatial extend of the data to extract and fit
resolutionSpectral resolution (LOW, MED, HIGH)
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTref_x or ref_y are outside boundaries

values_x0, values_y0, values_sigma are of size nx and unit [pixel] in the FITS convention (1..nx). The function starts to fit the profile toward the right from ref_x, then toward the left from ref_x. In resolution HIGH, the ref_y is updated at each spectral channel to follow the curvature when extracting the data.

Definition at line 536 of file gravi_calib.c.

References CPLCHECK_MSG, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_profile().

◆ gravi_flatten_vis()

cpl_error_code gravi_flatten_vis ( gravi_data vis_data,
gravi_data calib_data 
)

Use PCA model to flatten observed visphi. The flattened data are added to the existing VIS table.

Parameters
dataThe visphi data to flatten
pca_calibThe PCA calibration to use
Exceptions
CPL_ERROR_NULL_INPUTinput data or parameters are missing
CPL_ERROR_DATA_NOT_FOUNDno valid input data provided
Note
We're reusing the same gravi_pca_result object that is used when generating the calibration. This is just so that the fitting routine can also be reused: no further decomposition is done here.

Definition at line 3279 of file gravi_calib.c.

References CPLCHECK_MSG, FREE, FREELOOP, gravi_data_get_header, gravi_data_get_oi_vis, gravi_data_get_oi_wave_plist, gravi_data_get_plist(), gravi_data_get_table(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NBASE, gravi_pca_create_result(), GRAVI_PCA_EXT, gravi_pca_fit_model(), gravi_pca_get_data_fit(), gravi_pca_get_data_residual(), gravi_pca_load_model(), gravi_pca_model_delete(), gravi_pca_result_delete(), gravi_pfits_get_pola_mode(), gravi_pfits_get_pola_num(), gravi_pfits_get_spec_res(), and GRAVI_SC.

Referenced by gravity_vis(), and gravity_vis_from_p2vmred().

◆ gravi_remove_cosmicrays_sc()

cpl_error_code gravi_remove_cosmicrays_sc ( cpl_imagelist *  imglist_sc)

Remove cosmic rays via filtering through images.

Parameters
imglist_scinput data as imglist, remove inplace

IMPORTANT: Use this function AFTER bad pixel removal. Cosmic ray hits are identified as outliers when they are more than 5 times the median absolute deviation from the median computed across the list of images. This is evaluated on a pixel-by-pixel basis. CR pixels are interpolated along the row of an image.

Definition at line 2661 of file gravi_calib.c.

References cpl_msg_info(), CPLCHECK_MSG, FREE, gravi_msg_function_exit, gravi_msg_function_start, and IMAGE_IDX.

Referenced by gravi_data_detector_cleanup().

Variable Documentation

◆ met_Aug_2017

double met_Aug_2017[64] = {0.000225917 ,0.00033629 ,1.70956e-05 ,0.000178987 ,0.00103744 ,0.000275415 ,0.000107582 ,0.000678724 ,0.000402821 ,0.000713535 ,0.000518528 ,0.000607008 ,0.000506748 ,0.000640514 ,0.000300349 ,0.000522693 ,0.005585285 ,0.00305222 ,0.000771553 ,0.001006485 ,0.000618719 ,0.00130769 ,0.000419028 ,0.000491215 ,-0.000815277 ,-0.000646205 ,0.000640702 ,-0.000881775 ,-0.000200994 ,-0.000258582 ,-0.000465663 ,-0.00004838 ,0.000591627 ,0.000615608 ,0.000197913 ,0.000352664 ,-0.000113565 ,-0.000637229 ,0.001241975 ,-6.659e-06 ,0.000649339 ,0.000641595 ,0.000673658 ,0.000657426 ,0.001263897 ,0.001258565 ,0.000050901 ,0.000318844 ,-9.23866e-05 ,0.00065074 ,0.000793493 ,0.000600095 ,0.001049984 ,0.000858337 ,0.000786737 ,0.000737051 ,0.000576774 ,-0.001384295 ,-0.000642989 ,-0.0008569 ,-0.00208747 ,-0.00247888 ,0.00108834 ,-0.000190064}
static

Definition at line 83 of file gravi_calib.c.

Referenced by gravi_compute_dark().

◆ met_Jul_2017

double met_Jul_2017[64] = {8.19405e-05 ,-0.000061716 ,0.000067827 ,0.000234624 ,0.000521161 ,0.000031451 ,0.000211139 ,0.000578157 ,0.000316435 ,0.000431433 ,0.000431228 ,0.000761259 ,0.000576742 ,0.000299923 ,0.00034315 ,0.000561323 ,0.004834095 ,0.00208259 ,-0.000155192 ,-0.000120373 ,-0.000328756 ,0.000265791 ,-0.000249398 ,-0.000310416 ,-0.001047503 ,-0.000884526 ,0.000431645 ,-0.000890023 ,-0.000330709 ,-0.000540866 ,-0.0002067 ,-0.000334498 ,0.00035945 ,0.000683828 ,0.000464533 ,0.000166613 ,-0.000276387 ,-0.00088093 ,0.001283446 ,0.00016521 ,0.000578248 ,0.000334565 ,0.000762716 ,0.000521964 ,0.000757276 ,0.000959739 ,0.000035001 ,0.000442429 ,-0.0006928 ,-0.000105863 ,-0.00006137 ,-0.000454825 ,-0.000157343 ,-5.68635e-05 ,0.000296553 ,-3.80711e-05 ,0.000384616 ,-0.00149983 ,-0.000650183 ,-0.00076473 ,-0.002494945 ,-0.00246317 ,0.000794264 ,-0.000337915}
static

Definition at line 82 of file gravi_calib.c.

Referenced by gravi_compute_dark().

◆ met_Jun_2017

double met_Jun_2017[64] = {0.00029923 ,5.42185e-05 ,-0.000023823 ,0.000187444 ,0.000650675 ,0.000135629 ,-0.000047364 ,0.000479489 ,0.000463565 ,0.000536066 ,0.000528847 ,0.000874895 ,0.000702853 ,0.000438988 ,0.000183642 ,0.000536044 ,0.004829985 ,0.00215068 ,5.94134e-05 ,-0.000164468 ,-4.89301e-05 ,0.000400028 ,-0.000277333 ,-0.000169422 ,-0.00136967 ,-0.000998661 ,0.000244959 ,-0.00123726 ,-0.000404182 ,-0.000511517 ,-0.000398515 ,-0.000314167 ,0.000546602 ,0.000547136 ,0.000388259 ,0.000108443 ,-0.000266431 ,-0.000734324 ,0.000946866 ,0.0001005 ,0.000739434 ,0.000530113 ,0.000821013 ,0.000748435 ,0.00094666 ,0.00102861 ,-0.00013052 ,0.000576223 ,-0.000657692 ,-0.000293389 ,0.000146337 ,-0.000338176 ,0.000241386 ,0.00005168 ,0.000495891 ,-1.76273e-05 ,8.84135e-05 ,-0.00153857 ,-0.000850848 ,-0.000986058 ,-0.002700175 ,-0.002620785 ,0.000440797 ,-0.00063843}
static

Definition at line 81 of file gravi_calib.c.

Referenced by gravi_compute_dark().

◆ met_Mar_2017

double met_Mar_2017[64] = {0.000481474 ,0.000678173 ,0.00022232 ,9.04735e-05 ,0.001030283 ,0.000400478 ,0.000199579 ,0.000610902 ,0.000870061 ,0.001148845 ,0.000706636 ,0.000491999 ,0.00093158 ,0.001224225 ,0.000652115 ,0.001117025 ,0.00481452 ,0.002359475 ,0.000641491 ,0.000126103 ,0.000158341 ,0.001455785 ,0.000227113 ,0.000366087 ,-0.000372672 ,-0.000814455 ,0.000403834 ,-0.00072791 ,-0.000422227 ,0.000413887 ,-0.000024651 ,0.000106683 ,0.00092596 ,0.000327427 ,0.000775269 ,0.000906505 ,0.000108337 ,-0.000214467 ,0.001249965 ,0.000694693 ,0.000718101 ,0.00083926 ,0.00138818 ,0.00131215 ,0.001113065 ,0.00134113 ,0.000972572 ,0.00073247 ,-3.35943e-05 ,0.000312545 ,0.000365923 ,0.000510906 ,0.000955084 ,0.000808904 ,0.000403238 ,-0.000150186 ,0.000200673 ,-0.00078668 ,-0.00078133 ,-0.00039955 ,-0.00226333 ,-0.00177287 ,0.000435995 ,-0.000397403}
static

Definition at line 80 of file gravi_calib.c.

Referenced by gravi_compute_dark().

◆ met_Sep_2016

double met_Sep_2016[64] = {-0.000338233 ,-0.000282107 ,0.000345582 ,0.000381979 ,0.000326764 ,-0.000225664 ,5.35555e-05 ,0.00060938 ,-0.000205619 ,-0.000265577 ,0.00017356 ,0.000265687 ,0.000295987 ,3.05255e-05 ,-0.000498407 ,0.000232075 ,0.00502058 ,0.002045925 ,-0.000110657 ,-0.000403592 ,-0.000065043 ,-0.000433645 ,-0.000626545 ,3.29765e-05 ,-0.001694525 ,-0.0011684 ,6.2795e-06 ,-0.001584115 ,-0.000735553 ,-0.000868538 ,-0.000985087 ,-0.0008204 ,0.000768577 ,0.000848342 ,-0.000134943 ,-0.000385157 ,-8.68822e-05 ,-0.000757366 ,0.000446051 ,-0.000231723 ,0.000790425 ,-0.000638897 ,0.000503496 ,-7.78205e-05 ,0.000287366 ,0.000243789 ,0.000083288 ,-0.000125138 ,-0.000147337 ,4.14224e-05 ,0.000123082 ,-0.00117179 ,4.54785e-05 ,-0.000186707 ,0.000682836 ,0.00090649 ,0.000357256 ,-0.002133845 ,-0.00151895 ,-0.00150048 ,-0.00266423 ,-0.0030716 ,0.000599228 ,-0.001078583}
static

Definition at line 79 of file gravi_calib.c.

Referenced by gravi_compute_dark().