GRAVI Pipeline Reference Manual 1.9.4
Loading...
Searching...
No Matches
Functions
Transfer function computation

Functions

int gravi_array_set_invalid_negative (cpl_array *array)
 Set invalid to all negative elements of an array.
 
cpl_error_code gravi_vis_flag_negative (cpl_table *oi_table, const char *data, const char *flag)
 Flag negative element of an OIFITS table.
 
cpl_error_code gravi_vis_flag_invalid (cpl_table *oi_table, const char *data, const char *flag)
 Flag invalid element of an OIFITS table.
 
char * gravi_calib_setupstring (gravi_data *data)
 Build a unique setup string per calibratable setup.
 
double gravi_visibility_UD (double uv, double diam, double lbd)
 Compute the expected visibility from a UD model.
 
cpl_size gravi_get_row_in_cat (cpl_table *diam_table, double ra, double dec, double *separation)
 Get the row in a cpl_table matching closest RAJ2000 and DEJ2000.
 
cpl_error_code gravi_apply_tf_amp (gravi_data *science, gravi_data *science_tf, gravi_data **used_tf_data, int num_tf_data, const char *extName, const char *insName, const char *ampName, const char *ampErrName, int nbase, double delta_t)
 Interpolate the TF at the time of the science observation for an amplitude quantity.
 
cpl_error_code gravi_apply_tf_phi (gravi_data *science, gravi_data *science_tf, gravi_data **used_tf_data, int num_tf_data, const char *extName, const char *insName, const char *phiName, const char *phiErrName, int nbase, double delta_t)
 Interpolate the TF at the time of the science observation for a phase quantity (in deg).
 
gravi_datagravi_calibrate_vis (gravi_data *vis_data, gravi_data **tf_data, int num_tf, gravi_data *phi_tf_data, gravi_data *tf_science, const cpl_parameterlist *parlist)
 Computes the calibrated visibility from science a single data and several previously evaluated instrumental visibility.
 
gravi_datagravi_compute_tf (gravi_data *vis_data, gravi_data *diamcat_data)
 This function evaluates the transfer function from the observation of a reference star whose diameter can be determined.
 
cpl_error_code gravi_compute_tf_qc (gravi_data *oi_vis, gravi_data *diamcat_data)
 Fill QC parameters related to transfer function.
 
gravi_datagravi_compute_zp (gravi_data **vis_calib, int num_calib)
 Compute the ZP data.
 

Detailed Description

This module implements the functions to compute the transfer function and to calibrate the visibilities knowing this transfer function. The main functions are :

Function Documentation

◆ gravi_apply_tf_amp()

cpl_error_code gravi_apply_tf_amp ( gravi_data science,
gravi_data science_tf,
gravi_data **  used_tf_data,
int  num_tf_data,
const char *  extName,
const char *  insName,
const char *  ampName,
const char *  ampErrName,
int  nbase,
double  delta_t 
)

Interpolate the TF at the time of the science observation for an amplitude quantity.

Parameters
sciencethe science data to be calibrated, inplace
science_tfan already allocated data (duplication of science) in which the TF interpolated point are stored.
used_tf_datalist of the TF data to be interpolated
num_tf_datanumber of TF data
extNameEXTNAME of the OIFITS extension to be calibrated
insNameINSNAME of the OIFITS extension to be calibrated
ampNamecolumn name of the amplitude to be calibrated
ampErrNamecorresponding error column

All dataset shall be conformable in SETUP, but may contain a different number of observation (rnow/nbase) amp is calibrated as a real number: < AMP . W > The weight W is computed as a mixture between the SNR of each TF measurement and its time distance to the science observation.

Definition at line 248 of file gravi_tf.c.

References cpl_msg_debug(), CPLCHECK_MSG, gravi_data_get_oi_table(), gravi_msg_function_exit, gravi_msg_function_start, gravi_vis_flag_invalid(), and gravi_vis_flag_negative().

Referenced by gravi_calibrate_vis(), and gravi_flat_flux().

◆ gravi_apply_tf_phi()

cpl_error_code gravi_apply_tf_phi ( gravi_data science,
gravi_data science_tf,
gravi_data **  used_tf_data,
int  num_tf_data,
const char *  extName,
const char *  insName,
const char *  phiName,
const char *  phiErrName,
int  nbase,
double  delta_t 
)

Interpolate the TF at the time of the science observation for a phase quantity (in deg).

Parameters
sciencethe science data to be calibrated, inplace
science_tfan already allocated data (duplication of science) in which the TF interpolated point are stored.
used_tf_datalist of the TF data to be interpolated
num_tf_datanumber of TF data
extNameEXTNAME of the OIFITS extension to be calibrated
insNameINSNAME of the OIFITS extension to be calibrated
phiNamecolumn name of the phase to be calibrated
phiErrNamecorresponding error column

All dataset shall be conformable in SETUP, but may contain a different number of observation (rnow/nbase) phi is calibrated as a phasor: arg{< exp(i PHI ) . W >} The weight W is computed as a mixture between the SNR of each TF measurement and its time distance to the science observation.

Definition at line 385 of file gravi_tf.c.

References cpl_msg_debug(), CPLCHECK_MSG, gravi_array_cexp(), gravi_data_get_oi_table(), gravi_msg_function_exit, gravi_msg_function_start, gravi_vis_flag_invalid(), and gravi_vis_flag_negative().

Referenced by gravi_calibrate_vis().

◆ gravi_array_set_invalid_negative()

int gravi_array_set_invalid_negative ( cpl_array *  array)

Set invalid to all negative elements of an array.

Parameters
arraythe cpl_array to modify in-place

Definition at line 86 of file gravi_tf.c.

◆ gravi_calib_setupstring()

char * gravi_calib_setupstring ( gravi_data data)

Build a unique setup string per calibratable setup.

Parameters
datathe input gravi_data
Returns
setupstring: the allocated setupstring coding the setup

The setup string contains: INS.SPEC.RES, INS.POLA.MODE, FT.POLA.MODE FT.DIT and SC.DIT. The setupstring shall be desallocated properly.

Definition at line 201 of file gravi_tf.c.

References cpl_msg_debug(), CPLCHECK_NUL, gravi_data_get_header, GRAVI_FT, gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_dit_ft(), gravi_pfits_get_dit_sc(), gravi_pfits_get_pola_mode(), gravi_pfits_get_spec_res(), and GRAVI_SC.

Referenced by gravi_calibrate_vis().

◆ gravi_calibrate_vis()

gravi_data * gravi_calibrate_vis ( gravi_data vis_data,
gravi_data **  tf_data,
int  num_tf,
gravi_data phi_tf_data,
gravi_data tf_science,
const cpl_parameterlist *  parlist 
)

Computes the calibrated visibility from science a single data and several previously evaluated instrumental visibility.

Parameters
vis_dataThe science OIFITS data to be calibrated
tf_dataThe list of OIFITS transfer function data
num_tfThe number of transfer function data
phi_tf_dataThe transfer function data to use for separate phase calibration, or NULL
zeroThe astrometric zero-point (unused so far)
tf_scienceThe already allocated gravi_data in which the interpolated TF at the time of the science is returned.
parlistThe recipe parameters :
  • gravity.viscal.delta-time-calib to interpolate the TF [s]
  • gravity.viscal.force-calib to force calibration with the input calibrator
  • gravity.viscal.calib-flux to calibrate the flux
  • gravity.viscal.separate-phase-calib to use a distinct calibrator for visibility phase
Returns
The calibrated OIFITS data.

Definition at line 521 of file gravi_tf.c.

References cpl_msg_info(), CPLCHECK_NUL, gravi_apply_tf_amp(), gravi_apply_tf_phi(), gravi_calib_setupstring(), gravi_data_duplicate(), gravi_data_get_header, gravi_data_get_oi_table(), GRAVI_INSNAME, gravi_msg_function_exit, gravi_msg_function_start, GRAVI_OI_FLUX_EXT, GRAVI_OI_T3_EXT, GRAVI_OI_VIS2_EXT, GRAVI_OI_VIS_EXT, gravi_param_get_bool(), gravi_param_get_double(), and gravi_pfits_get_pola_num().

Referenced by gravity_viscal().

◆ gravi_compute_tf()

gravi_data * gravi_compute_tf ( gravi_data vis_data,
gravi_data diamcat_data 
)

This function evaluates the transfer function from the observation of a reference star whose diameter can be determined.

Parameters
vis_dataThe input OIFITS observation
diamcat_dataThe input catalog of calibrator diameters (optional)
Returns
The OIFITS transfer function.

Definition at line 786 of file gravi_tf.c.

References cpl_msg_info(), CPLCHECK_NUL, FREE, GRAVI_BASE_NAME, gravi_data_delete(), gravi_data_duplicate(), gravi_data_get_header, gravi_data_get_oi_vis, gravi_data_get_oi_vis2, gravi_data_get_oi_wave, gravi_data_get_table(), gravi_data_get_table_x(), gravi_data_is_internal, gravi_get_row_in_cat(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_OI_ARRAY_EXT, gravi_pfits_get_diameter(), gravi_pfits_get_double_silentdefault(), gravi_pfits_get_pola_num(), gravi_pfits_get_type_decep, gravi_pfits_get_type_raep, gravi_pfits_update_double(), GRAVI_TYPE, gravi_visibility_UD(), and plist.

Referenced by gravi_compute_tf_qc(), and gravity_viscal().

◆ gravi_compute_tf_qc()

cpl_error_code gravi_compute_tf_qc ( gravi_data oi_vis,
gravi_data diamcat_data 
)

Fill QC parameters related to transfer function.

Parameters
oi_visThe input OIFITS observation
diamcat_dataThe input catalog of calibrator diameters (optional)

This function evaluates the transfer function and create QC parameters in the header of the input OIFITS observation. These QC parameters are created only if the TF could be computed. The TF OIFITS data itself is actually erased.

Definition at line 1035 of file gravi_tf.c.

References cpl_msg_info(), FREE, gravi_compute_tf(), gravi_data_delete(), gravi_data_get_header, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravity_vis().

◆ gravi_compute_zp()

gravi_data * gravi_compute_zp ( gravi_data **  vis_calib,
int  num_calib 
)

Compute the ZP data.

Definition at line 1070 of file gravi_tf.c.

References gravi_data_duplicate(), gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravity_viscal().

◆ gravi_get_row_in_cat()

cpl_size gravi_get_row_in_cat ( cpl_table *  diam_table,
double  ra,
double  dec,
double *  separation 
)

Get the row in a cpl_table matching closest RAJ2000 and DEJ2000.

Parameters
diam_tablecpl_table with RAJ2000 and DECJ2000 in '+DD MM SS.SS' and 'HH MM SS.SS' format
rara to search in [rad]
decdec to search in [rad]
Returns
closest match if <5", or -2 if no match

Definition at line 731 of file gravi_tf.c.

References gravi_dec_to_rad(), gravi_msg_function_exit, gravi_msg_function_start, and gravi_ra_to_rad().

Referenced by gravi_compute_tf().

◆ gravi_vis_flag_invalid()

cpl_error_code gravi_vis_flag_invalid ( cpl_table *  oi_table,
const char *  data,
const char *  flag 
)

Flag invalid element of an OIFITS table.

Parameters
oi_tablethe OIFITS table to modify in-place
datathe column name (ex: VIS2DATA)
flagthe corresponding flag column (ex: FLAG)

Definition at line 157 of file gravi_tf.c.

References CPLCHECK_MSG, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_apply_tf_amp(), and gravi_apply_tf_phi().

◆ gravi_vis_flag_negative()

cpl_error_code gravi_vis_flag_negative ( cpl_table *  oi_table,
const char *  data,
const char *  flag 
)

Flag negative element of an OIFITS table.

Parameters
oi_tablethe OIFITS table to modify in-place
datathe column name (ex: VIS2DATA)
flagthe corresponding flag column (ex: FLAG)

Definition at line 117 of file gravi_tf.c.

References CPLCHECK_MSG, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_apply_tf_amp(), and gravi_apply_tf_phi().

◆ gravi_visibility_UD()

double gravi_visibility_UD ( double  uv,
double  diam,
double  lbd 
)

Compute the expected visibility from a UD model.

Parameters
uvbaseline lenght [m]
diamdiameter [mas]
lbdwavelength [m]
Returns
2 * J1 (pi.x) / (pi.x) with x = uv * diam / lbd

Definition at line 711 of file gravi_tf.c.

Referenced by gravi_compute_tf().