GRAVI Pipeline Reference Manual 1.9.2
Loading...
Searching...
No Matches
Functions
P2VM calibration

Functions

cpl_table * gravi_create_p2vm_table (cpl_table *detector_table, int nwave)
 Create a new p2vm table.
 
cpl_table * gravi_create_oiwave_table_sc (cpl_table *wave_table, cpl_propertylist *header, gravi_data *wave_param)
 Create a new oiwave table for SC.
 
cpl_table * gravi_create_oiwave_table_ft (cpl_table *wave_table, cpl_table *detector_table, int pol)
 Create a new oiwave table for FT.
 
gravi_datagravi_create_p2vm (gravi_data *wave_map, gravi_data *wave_param)
 Create a new P2VM map.
 
cpl_error_code gravi_compute_p2vm (gravi_data *p2vm_map, gravi_data *preproc_data, int **valid_trans, int **valid_pair, enum gravi_detector_type det_type)
 The given output FITS file contain a p2vm table with the values of the transmission, phase and coherence extract using the p2vm matrix.
 
cpl_error_code gravi_p2vm_normalisation (gravi_data *p2vm_map, int **valid_trans, int **valid_pair)
 The given output FITS file contain a p2vm table with the values of the transmission, phase and coherence extract using the p2vm matrix so this function will normalise the p2vm map.
 
cpl_error_code gravi_p2vm_phase_correction (gravi_data *p2vm_map, gravi_data *p2vmred_data, int full_phase)
 Correct the phase of the P2VM from internal closure-phases.
 
cpl_error_code gravi_p2vm_transmission (gravi_data *p2vm_map, gravi_data *p2vmred_data)
 Compute the flux normalisation in the P2VM.
 

Detailed Description

This modules implements the calibration of the P2VM. The main functions are called by the gravity_p2vm recipe. After allocating the P2VM table with gravi_create_p2vm() each file of the P2VM data set with one or two shutters opened (FLAT and P2VM) are processed with gravi_compute_p2vm() to fill the TRANSMISSION, COHERENCE and PHASE columns of the P2VM table. Then the TRANSMISSION are normalized with gravi_p2vm_normalisation() and the file with 4 shutters opened (WAVE) is processed to calibrated the closure with gravi_p2vm_phase_correction().

The algorithms involved in this reduction are detailed in section Algorithms/Computation of the P2VM.

Function Documentation

◆ gravi_compute_p2vm()

cpl_error_code gravi_compute_p2vm ( gravi_data p2vm_map,
gravi_data preproc_data,
int **  valid_trans,
int **  valid_pair,
enum gravi_detector_type  det_type 
)

The given output FITS file contain a p2vm table with the values of the transmission, phase and coherence extract using the p2vm matrix.

Parameters
p2vm_mapThe p2vm table with the values of the transmission, phase and coherence. The table must be allocated before using this
preproc_dataThe the raw data after preprocessing and will be identified to compute the p2vm
valid_transInteger array of 2 dimensions the first dimension represents the type of the data (SC = 0 or FT = 1) , it means that it has 2 elements. the second represents the information about the files witch compute the transmission of witch telescope, it means that it has 4 elements. (if the file has a shutter 3 open of the data SC valid_trans[0][2] = 1)
valid_pairInteger array of 2 dimensions the first dimension represents the type of the data (SC = 0 or FT = 1), it means that it has 2 elements. the second represents the information about the files witch compute the phase and coherence of witch base, it means that it has 4 elements. (if the file has a shutter 3 and 4 open of the data SC valid_pair[0][5] = 1)
det_typeThe 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.
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTA table is missing in the input data, or is does not correspond with a file with one or 2 shutters opened.

The function will compute the transmission, phase and coherence and save them in the p2vm_map giving in the inputs (shall be initialized).

Definition at line 546 of file gravi_p2vm.c.

References cpl_image_delete(), cpl_msg_info(), CPLCHECK_MSG, FREE, FREELOOP, GRAVI_BASE_TEL, gravi_check_shutter(), gravi_compute_envelope(), GRAVI_DATA, gravi_data_get_header, gravi_data_get_imaging_detector, gravi_data_get_oiwave_tables(), gravi_data_get_p2vm_data, gravi_data_get_spectrum_data, gravi_data_has_spectrum, GRAVI_DATAERR, GRAVI_DET_ALL, GRAVI_DET_FT, GRAVI_DET_SC, gravi_ellipse_meanopd_create(), gravi_imagelist_unwrap_images(), gravi_imagelist_wrap_column(), gravi_matrix_invertSV_create(), gravi_msg_function_exit, gravi_msg_function_start, gravi_region_get_pol(), gravi_table_get_vector(), and GRAVI_TYPE.

Referenced by gravity_p2vm().

◆ gravi_create_oiwave_table_ft()

cpl_table * gravi_create_oiwave_table_ft ( cpl_table *  wave_table,
cpl_table *  detector_table,
int  pol 
)

Create a new oiwave table for FT.

Parameters
wave_tableThe input wavelength of each region in WAVE map
detector_tableThe corresponding detector table
polThe selected polarisation
Returns
The oiwave table

The function returns a table with EFF_WAVE, EFF_BAND.

Definition at line 345 of file gravi_p2vm.c.

References cpl_msg_info(), GRAVI_DATA, gravi_msg_function_exit, gravi_msg_function_start, gravi_region_get_pol(), gravi_spectrum_get_nwave(), and gravi_table_get_value.

Referenced by gravi_create_p2vm().

◆ gravi_create_oiwave_table_sc()

cpl_table * gravi_create_oiwave_table_sc ( cpl_table *  wave_table,
cpl_propertylist *  header,
gravi_data wave_param 
)

Create a new oiwave table for SC.

Parameters
wave_tableThe input wavelength of each region in WAVE map
headerThe mean header of WAVE map
paramsThe recipe parameters
Returns
The oiwave table

The function returns a table with EFF_WAVE, EFF_BAND.

Definition at line 191 of file gravi_p2vm.c.

References cpl_msg_info(), CPLCHECK_NUL, gravi_data_get_plist(), gravi_data_get_table(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_PRIMARY_HDR_EXT, gravi_wave_get_nlambda(), and header.

Referenced by gravi_create_p2vm().

◆ gravi_create_p2vm()

gravi_data * gravi_create_p2vm ( gravi_data wave_map,
gravi_data wave_param 
)

Create a new P2VM map.

Parameters
preproc_dataone of the loaded data of this P2VM calibration
wave_mapthe WAVE calibration map of this P2VM
Returns
a p2vm_map

Create the P2VM map, including the P2VM_SC table, the P2VM_FT table and a copy of the P2VM_MET table from wave_map. It also creates the necessary OI_WAVELENGTHs table in the P2VM map.

Definition at line 413 of file gravi_p2vm.c.

References cpl_msg_info(), CPLCHECK_NUL, gravi_create_oiwave_table_ft(), gravi_create_oiwave_table_sc(), gravi_create_p2vm_table(), gravi_data_add_table(), gravi_data_copy_ext(), gravi_data_get_header, gravi_data_get_imaging_detector, gravi_data_get_wave_data, gravi_data_has_wave, gravi_data_new(), GRAVI_EXTVER, GRAVI_IMAGING_DETECTOR_EXT, GRAVI_INSNAME, gravi_msg_function_exit, gravi_msg_function_start, GRAVI_OI_WAVELENGTH_EXT, GRAVI_P2VM_DATA_FT_EXT, GRAVI_P2VM_DATA_SC_EXT, GRAVI_P2VM_MET_EXT, GRAVI_SC, gravi_spectrum_get_npol, and GRAVI_TYPE.

Referenced by gravity_p2vm().

◆ gravi_create_p2vm_table()

cpl_table * gravi_create_p2vm_table ( cpl_table *  detector_table,
int  nwave 
)

Create a new p2vm table.

Parameters
n_regionThe number of region
nwaveThe number of wavelength channels
ntelThe number of telescopes
Returns
The p2vm table who must contain all of values of the p2vm

The function returns a table with regname, transmission, coherence and phase columns. All columns are initialized with valid zero values.

REGNAME

Transmission

Coherence

Phase

C_matrix

Definition at line 103 of file gravi_p2vm.c.

References FREE, gravi_msg_function_exit, gravi_msg_function_start, and ntel.

Referenced by gravi_create_p2vm().

◆ gravi_p2vm_normalisation()

cpl_error_code gravi_p2vm_normalisation ( gravi_data p2vm_map,
int **  valid_trans,
int **  valid_pair 
)

The given output FITS file contain a p2vm table with the values of the transmission, phase and coherence extract using the p2vm matrix so this function will normalise the p2vm map.

Parameters
p2vm_mapThe given P2VM calibration already computed using the function gravi_compute_p2vm
valid_transInteger array of 2 dimensions the first dimension representes the type of the data (SC = 0 or FT = 1) , it means that it has 2 elements. the second representes the information about the files witch compute the transmission of witch telescope, it means that it has 4 elements. (if the file has a shutter 3 open of the data SC valid_trans[0][2] = 1). This array will be useful to check witch par of the p2vm map in the transmission must be normalised
valid_pairInteger array of 2 dimensions the first dimension representes the type of the data (SC = 0 or FT = 1), it means that it has 2 elements. the second representes the information about the files witch compute the phase and coherence of witch base, it means that it has 4 elements. (if the file has a shutter 3 and 4 open of the data SC valid_pair[0][5] = 1)This array will be useful to check witch par of the p2vm map in the phase and coherence must be normalised
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTCannot retrieve the number of wavelength

The function normalises the given p2vm map

Definition at line 880 of file gravi_p2vm.c.

References cpl_msg_info(), cpl_propertylist_update_double(), CPLCHECK_MSG, FREE, gravi_array_get_quantile(), GRAVI_BASE_NAME, GRAVI_BASE_TEL, gravi_data_get_header, gravi_data_get_imaging_detector, gravi_data_get_oi_wave, gravi_data_get_p2vm_data, gravi_data_has_p2vm, gravi_get_region(), gravi_msg_function_exit, gravi_msg_function_start, gravi_region_get_base(), gravi_table_get_vector(), GRAVI_TYPE, ntel, QC_MAXTRANS_FT, QC_MAXTRANS_SC, QC_MEANCOH_FT, QC_MEANCOH_SC, QC_MEANTRANS_FT, QC_MEANTRANS_SC, QC_MINTRANS_FT, QC_MINTRANS_SC, QC_RMSCOH_FT, QC_RMSCOH_SC, QC_RMSPHASE_FT, and QC_RMSPHASE_SC.

Referenced by gravity_p2vm().

◆ gravi_p2vm_phase_correction()

cpl_error_code gravi_p2vm_phase_correction ( gravi_data p2vm_map,
gravi_data p2vmred_data,
int  full_phase 
)

Correct the phase of the P2VM from internal closure-phases.

Parameters
p2vm_mapThe given P2VM already computed using the function gravi_compute_p2vm
p2vmred_dataThe P2VMRED of the 4-shutter open file
full_phase0: Force phiA(lbd) to be zero for baselines (01,02,03) = keep only closures 1: Force phiA(lbd) to have zero mean and minimum GD for baselines (01,02,03) 2: Force phiA(lbd) to have zero-GD for baselines (01,02,03)
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTfull_phase parameter out of range

The p2vmreduced of a 4-shutter open observation (generally the WAVE) can be used to compute the p2vm closure phase and chromatic phase, which are then removed from the P2VM phases.

Definition at line 1267 of file gravi_p2vm.c.

References cpl_msg_debug(), cpl_msg_info(), CPLCHECK_MSG, FREE, FREELOOP, gravi_array_add_phase(), gravi_array_cexp(), gravi_array_get_group_delay_loop(), gravi_array_multiply_conj(), gravi_array_multiply_phasor(), GRAVI_BASE_TEL, gravi_data_get_header, gravi_data_get_oi_vis, gravi_data_get_oi_wave, gravi_data_get_p2vm_data, gravi_data_has_p2vm, gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_pola_num(), gravi_region_get_base(), gravi_region_get_pol(), gravi_table_create_sigma_array(), and GRAVI_TYPE.

Referenced by gravity_p2vm().

◆ gravi_p2vm_transmission()

cpl_error_code gravi_p2vm_transmission ( gravi_data p2vm_map,
gravi_data p2vmred_data 
)

Compute the flux normalisation in the P2VM.

Parameters
p2vm_mapThe given p2vm map already computed using the function gravi_compute_p2vm
p2vmred_dataThe P2VMREDUCED of the 4-shutter open file
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing

Compute the mean OI_FLUX from the p2vmreduced data. Normalize to mean=1.0 and store it into the p2vm_map.

Definition at line 1550 of file gravi_p2vm.c.

References cpl_msg_info(), CPLCHECK_MSG, FREE, gravi_data_add_table(), gravi_data_get_header, gravi_data_get_oi_flux, gravi_data_get_oi_flux_plist, gravi_msg_function_exit, gravi_msg_function_start, GRAVI_OI_FLUX_EXT, gravi_pfits_get_pola_num(), gravi_table_oi_create(), GRAVI_TYPE, and plist.

Referenced by gravity_p2vm().