GRAVI Pipeline Reference Manual 1.7.2
Loading...
Searching...
No Matches
Functions
Averaging the individual DITs into a final OIFITS

Functions

double gravi_randn (void)
 Normal distribution pseudo-random generator.
 
cpl_error_code gravi_array_online_variance (cpl_array *data, cpl_array *mean, cpl_array *variance, int n)
 
cpl_error_code gravi_array_online_variance_res (cpl_array **data, int n, int rephase)
 On-line variance of arrays.
 
cpl_error_code gravi_flux_average_bootstrap (cpl_table *oi_flux_avg, cpl_table *oi_flux, int nboot, double outlier_threshold)
 Average the flux of all DITs into a final, averaged value.
 
cpl_error_code gravi_t3_average_bootstrap (cpl_table *oi_t3_avg, cpl_table *oi_vis, cpl_table *oi_flux, int nboot, int use_vFactor, int use_pFactor, double outlier_threshold)
 Average the closure-phase of all DITs into a final, averaged value.
 
cpl_error_code gravi_vis_average_bootstrap (cpl_table *oi_vis_avg, cpl_table *oi_vis2_avg, cpl_table *oi_vis, int nboot, const char *phase_ref, int use_vFactor, int use_pFactor, int use_debiasing, double outlier_threshold)
 Average the visibility of all DITs into a final, averaged value.
 
cpl_error_code gravi_vis_flag_nan (cpl_table *oi_table)
 Flag samples of OIFITS table which are NAN or NULL.
 
cpl_error_code gravi_vis_average_amp (cpl_table *oi_table, const char *name, const char *err, int nbase)
 Average amplitudes column of a multi-observation OIFITS table The averaged quantities are stored in the first nbase rows.
 
cpl_error_code gravi_vis_average_phi (cpl_table *oi_table, const char *name, const char *err, int nbase)
 Average phases column of a multi-observation OIFITS table Phases are averaged with arg{<exp(i.phi)>} The averaged quantities are stored in the first nbase rows.
 
cpl_error_code gravi_vis_average_value (cpl_table *oi_table, const char *name, const char *err, int nbase)
 Average scalar column of a multi-observation OIFITS table. The averaged quantities are stored in the first nbase rows.
 
cpl_error_code gravi_vis_resamp_amp (cpl_table *oi_table, const char *name, const char *err, cpl_size nsamp, cpl_size nwave_new)
 Rebin amplitude column of OIFITS table.
 
cpl_error_code gravi_vis_resamp_phi (cpl_table *oi_table, const char *name, const char *err, cpl_size nsamp, cpl_size nwave_new)
 Rebin phase column of OIFITS table (arg{<exp(i.phi)>})
 
cpl_error_code gravi_vis_smooth_amp (cpl_table *oi_table, const char *name, const char *err, cpl_size nsamp)
 Smooth amplitude column of OIFITS table.
 
cpl_error_code gravi_vis_smooth_phi (cpl_table *oi_table, const char *name, const char *err, cpl_size nsamp)
 Smooth phase column of OIFITS table.
 
cpl_error_code gravi_vis_fit_amp (cpl_table *oi_table, const char *name, const char *err, cpl_size maxdeg)
 Smooth amp column of OIFITS table.
 
cpl_error_code gravi_vis_compute_column_mean (cpl_table *out_table, cpl_table *in_table, const char *name, int ntel)
 Compute the mean of a column in OIFITS table, and save the result in the specified output table.
 
cpl_error_code gravi_vis_flag_median (cpl_table *oi_table, const char *data, const char *flag, double value)
 Flag samples of OIFITS table based on runnning median.
 
cpl_error_code gravi_average_self_visphi (cpl_table *oi_vis_avg, cpl_table *oi_vis, cpl_array *wavenumber, const char *phase_ref, int *cmin, int *cmax, int nrange)
 Compute Averaged VISPHI in the manner described, e.g., in F. Millour's thesis.
 
double gdAbacusErrPhi (double x)
 
gravi_datagravi_compute_vis (gravi_data *p2vmred_data, const cpl_parameterlist *parlist, cpl_size *current_frame)
 The function average the individual frames of a P2VMREDUCED file into a final, single observation per base and per tel.
 
cpl_error_code gravi_compute_vis_qc (gravi_data *vis_data, cpl_frameset *frameset)
 The function compute the QC parameters for a VIS (averaged) data.
 
cpl_error_code gravi_data_get_minmax_uvcoord (const cpl_table *oi_vis2, double *min_uvcoord, double *max_uvcoord)
 Compute the minimum and maximum values of sqrt(ucoord**2 + vcoord**2)
 
cpl_error_code gravi_normalize_sc_to_ft (gravi_data *vis_data)
 Align the SC visibilities on the FT visibilities.
 
cpl_error_code gravi_vis_mjd_to_time (gravi_data *vis_data)
 Recompute the TIME column of all OIFITS extension from the MJD column, following the OIFITS standard (number of second since the DATE-OBS at 00:00).
 
cpl_error_code gravi_flat_flux (gravi_data *vis_data, gravi_data *p2vm_map)
 Divide the OI_FLUX by OI_FLUX from the P2VM (no checks, no time distance...)
 
cpl_error_code gravi_force_uncertainties (gravi_data *oi_data, const cpl_parameterlist *parlist)
 Force uncertainties.
 
cpl_error_code gravi_average_vis (gravi_data *oi_data)
 Coadd the observations together.
 
cpl_error_code gravi_vis_smooth (gravi_data *oi_data, cpl_size nsamp_vis, cpl_size nsamp_flx, cpl_size maxdeg)
 Smooth the SC table by nsamp consecutive spectral bins.
 
cpl_error_code gravi_vis_resamp (gravi_data *oi_data, cpl_size nsamp)
 Re-bin the SC table by nsamp consecutive spectral bins.
 
cpl_error_code gravi_vis_copy_fluxdata (gravi_data *oi_data, int delete_flux)
 Duplicate the column FLUX into FLUXDATA, for OIFITS2 compliance.
 
cpl_error_code gravi_vis_flag_threshold (cpl_table *oi_table, const char *data, const char *flag, double value)
 Flag samples of OIFITS table based on absolute threshold.
 
cpl_error_code gravi_vis_flag_lower (cpl_table *oi_table, const char *data, const char *flag, double value)
 Flag samples of OIFITS table based on absolute threshold.
 
cpl_error_code gravi_vis_flag_relative_threshold (cpl_table *oi_table, const char *err, const char *data, const char *flag, double value)
 Flag samples of OIFITS table based on relative threshold.
 
cpl_error_code gravi_vis_erase_obs (cpl_table *oi_table, cpl_array *flag_array, cpl_size ntel)
 Erase observation from an OIFITS table.
 
cpl_error_code gravi_vis_force_time (gravi_data *oi_data)
 Force all data in OI_TABLE to have the same TIME and MJD.
 

Detailed Description

This module processes the p2vmreduced file to produce the final product of the gravity_vis recipe. The functions gravi_compute_vis() computes the averaged quantities, main steps are :

Function Documentation

◆ gdAbacusErrPhi()

double gdAbacusErrPhi ( double  x)

Estimate true phase rms from the cross-spectrum variance. see Petrov, Roddier and Aime, JOSAA vol 3, N.5, may 1986 p 634. and Petrov's Thesis, p. 50 ff. I replace the piecewise interpolation usually used by a polynomial approximation of the function: if z=log10(y), then z=(C[1]*X^7+C[2]*X^6+C[3]*X^5+C[4]*X^4+C[5]*X^3+C[6]*X^2+C[7]*X+C[8]) and y=10^z. where C[01]= 2.71918080109099 C[02]=-17.1901043936273 C[03]= 45.0654103760899 C[04]=-63.4441678243197 C[05]= 52.3098941426378 C[06]=-25.8090699917488 C[07]= 7.84352873962491 C[08]=-1.57308595820081 This interpolation is valid in the range x=[0.1,1.74413]. Error is 1% everywhere except above x=1.73 where it is 10% Below x=0.1: y=x Above x=M_PI/sqrt(3.0), y = blanking (impossible value) Above x=1.74413, we take: y=0.691/(pi/sqrt(3.0)-x)

Definition at line 1315 of file gravi_vis.c.

Referenced by gravi_average_self_visphi().

◆ gravi_array_online_variance()

cpl_error_code gravi_array_online_variance ( cpl_array *  data,
cpl_array *  mean,
cpl_array *  variance,
int  n 
)

Definition at line 161 of file gravi_vis.c.

Referenced by gravi_array_online_variance_res().

◆ gravi_array_online_variance_res()

cpl_error_code gravi_array_online_variance_res ( cpl_array **  data,
int  n,
int  rephase 
)

On-line variance of arrays.

Parameters
datalist of 4 arrays, all initialized: 0: current_sample, 1: running_mean, 2: first_boot (to keep track if necessary), 3: running_variance
nthe sample number
rephaseif 1, the value are consired being phases

Compute the online-variance of a sample of 'data' with increasing number of sample (n), in-place. Mean and variance should be init to zero at n=0 See https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

Definition at line 221 of file gravi_vis.c.

References cpl_msg_debug(), CPLCHECK_MSG, gravi_array_online_variance(), gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_flux_average_bootstrap(), gravi_t3_average_bootstrap(), and gravi_vis_average_bootstrap().

◆ gravi_average_self_visphi()

cpl_error_code gravi_average_self_visphi ( cpl_table *  oi_vis_avg,
cpl_table *  oi_vis,
cpl_array *  wavenumber,
const char *  phase_ref,
int *  cmin,
int *  cmax,
int  nrange 
)

Compute Averaged VISPHI in the manner described, e.g., in F. Millour's thesis.

Parameters
oi_vis_avgalready allocated OI_VIS table to be filled
oi_visinput OI_VIS with all individual DITs
basebase to consider (0..5)
phase_refphase used to rephase the DITs

Definition at line 1384 of file gravi_vis.c.

References cpl_msg_debug(), cpl_msg_info(), CPLCHECK_MSG, FREE, FREELOOP, gdAbacusErrPhi(), gravi_array_get_group_delay_loop(), gravi_array_multiply_phasor(), gravi_array_new_list(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NBASE, gravi_pow2, and gravi_table_set_array_phase().

Referenced by gravi_compute_vis().

◆ gravi_average_vis()

cpl_error_code gravi_average_vis ( gravi_data oi_data)

Coadd the observations together.

Parameters
oi_datathe OIFITS map to co-add in-place

All observation are averaged together. No checks of consistency ! The result always contains 6 VIS, 6 VIS2, 4 T3, and 4 FLUX, whatever the initial content of the OIFITS. The MJD, UCOORD, VCOORD... are averaged with equal weight (no weighting by the SNR).

Definition at line 2998 of file gravi_vis.c.

References cpl_msg_info(), CPLCHECK_MSG, gravi_data_get_header, gravi_data_get_oi_flux, gravi_data_get_oi_t3, gravi_data_get_oi_vis, gravi_data_get_oi_vis2, gravi_data_has_type(), gravi_msg_function_exit, gravi_msg_function_start, gravi_msg_warning(), GRAVI_NBASE, gravi_pfits_get_pola_num(), GRAVI_SC, GRAVI_TYPE, gravi_vis_average_amp(), gravi_vis_average_phi(), gravi_vis_average_value(), and header.

Referenced by gravity_postprocess(), gravity_vis(), and gravity_vis_from_p2vmred().

◆ gravi_compute_vis()

gravi_data * gravi_compute_vis ( gravi_data p2vmred_data,
const cpl_parameterlist *  parlist,
cpl_size *  current_frame 
)

The function average the individual frames of a P2VMREDUCED file into a final, single observation per base and per tel.

Parameters
p2vmred_dataP2VMREDUCED data containing OI_FLUX and OI_VIS tables coming from the gravi_compute_p2vmred
parlistParameters of the recipe

Definition at line 1675 of file gravi_vis.c.

References cpl_msg_info(), CPLCHECK_NUL, FREE, gravi_array_get_group_delay_loop(), gravi_array_multiply_phasor(), gravi_average_self_visphi(), gravi_data_add_table(), gravi_data_copy_ext(), gravi_data_get_header, gravi_data_get_oi_flux, gravi_data_get_oi_vis, gravi_data_get_oi_vis_plist, gravi_data_get_oi_wave, gravi_data_get_table(), gravi_data_has_type(), gravi_data_new(), gravi_flux_average_bootstrap(), GRAVI_FT, gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NBASE, GRAVI_NIGHT_OBS, GRAVI_OI_ARRAY_EXT, GRAVI_OI_FLUX_EXT, GRAVI_OI_T3_EXT, GRAVI_OI_TARGET_EXT, GRAVI_OI_VIS2_EXT, GRAVI_OI_VIS_EXT, GRAVI_OI_WAVELENGTH_EXT, gravi_param_get_bool(), gravi_param_get_double(), gravi_param_get_int(), gravi_param_get_string(), gravi_pfits_get_dit_sc(), gravi_pfits_get_metfc_lockmjd(), gravi_pfits_get_pola_num(), gravi_pfits_get_sobj_x(), gravi_pfits_get_sobj_y(), GRAVI_SC, gravi_t3_average_bootstrap(), gravi_table_extract_time_interval(), gravi_table_new_column(), gravi_table_oi_create(), gravi_table_set_array_phase(), gravi_vis_average_bootstrap(), gravi_vis_compute_column_mean(), and ntel.

Referenced by gravity_disp(), gravity_vis(), and gravity_vis_from_p2vmred().

◆ gravi_compute_vis_qc()

cpl_error_code gravi_compute_vis_qc ( gravi_data vis_data,
cpl_frameset *  frameset 
)

◆ gravi_data_get_minmax_uvcoord()

cpl_error_code gravi_data_get_minmax_uvcoord ( const cpl_table *  oi_vis2,
double *  min_uvcoord,
double *  max_uvcoord 
)

Compute the minimum and maximum values of sqrt(ucoord**2 + vcoord**2)

Parameters
vis2_datatable with vis2 data
min_uvcoordreturns the minimum of sqrt(ucoord**2 + vcoord**2)
max_uvcoordreturns the maximum of sqrt(ucoord**2 + vcoord**2)

Note tha this function ignores rows which takes into account rows

Definition at line 2509 of file gravi_vis.c.

Referenced by gravi_idp_compute().

◆ gravi_flat_flux()

cpl_error_code gravi_flat_flux ( gravi_data vis_data,
gravi_data p2vm_map 
)

Divide the OI_FLUX by OI_FLUX from the P2VM (no checks, no time distance...)

Parameters
vis_datathe VIS data whose OI_FLUX tables will be updated in-place
p2vm_mapthe input P2VM calibration map to load the reference OI_FLUX

Definition at line 2704 of file gravi_vis.c.

References CPLCHECK_MSG, gravi_apply_tf_amp(), gravi_data_get_header, GRAVI_INSNAME, gravi_msg_function_exit, gravi_msg_function_start, GRAVI_OI_FLUX_EXT, and gravi_pfits_get_pola_num().

Referenced by gravity_vis().

◆ gravi_flux_average_bootstrap()

cpl_error_code gravi_flux_average_bootstrap ( cpl_table *  oi_flux_avg,
cpl_table *  oi_flux,
int  nboot,
double  outlier_threshold 
)

Average the flux of all DITs into a final, averaged value.

Parameters
oi_flux_avgalready allocated OI_FLUX table to be filled
oi_fluxinput OI_FLUX with all individual DITs
nsegnumber of segment for the boostrap
nbootnumber of boostrap
telbeam to consider (0..3)

Average the flux and compute the final flux. The errors are computed with the boostraping method.

Definition at line 274 of file gravi_vis.c.

References cpl_msg_debug(), cpl_msg_info(), CPLCHECK_MSG, FREE, FREELOOP, gravi_array_new_list(), gravi_array_online_variance_res(), gravi_msg_function_exit, gravi_msg_function_start, gravi_randn(), gravi_table_get_column_sum_array(), gravi_vis_flag_lower(), gravi_vis_flag_relative_threshold(), and ntel.

Referenced by gravi_compute_vis().

◆ gravi_force_uncertainties()

cpl_error_code gravi_force_uncertainties ( gravi_data oi_data,
const cpl_parameterlist *  parlist 
)

Force uncertainties.

Parameters
oi_datathe OIFITS map to co-add in-place

Read the parameter of the recipe and update the uncertainties on the corresponding quantities.

Definition at line 2908 of file gravi_vis.c.

References cpl_msg_info(), gravi_data_get_header, gravi_data_get_oi_flux, gravi_data_get_oi_vis, gravi_data_get_oi_vis2, gravi_msg_function_exit, gravi_msg_function_start, gravi_param_get_double_default(), gravi_pfits_get_pola_num(), GRAVI_SC, and header.

Referenced by gravity_postprocess().

◆ gravi_normalize_sc_to_ft()

cpl_error_code gravi_normalize_sc_to_ft ( gravi_data vis_data)

Align the SC visibilities on the FT visibilities.

Parameters
vis_datathe VIS data to update in-place

Force the mean value of the VIS2DATA of the SC to match the mean value of the VIS2DATA of the FT. Same for VISAMP.

Definition at line 2564 of file gravi_vis.c.

References cpl_msg_info(), CPLCHECK_MSG, FREE, gravi_array_rebin(), gravi_data_get_header, gravi_data_get_oi_vis, gravi_data_get_oi_vis2, gravi_data_get_oi_wave, GRAVI_FT, gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_pola_num(), and GRAVI_SC.

Referenced by gravity_vis(), and gravity_vis_from_p2vmred().

◆ gravi_randn()

double gravi_randn ( void  )

Normal distribution pseudo-random generator.

Definition at line 140 of file gravi_vis.c.

Referenced by gravi_flux_average_bootstrap(), gravi_t3_average_bootstrap(), and gravi_vis_average_bootstrap().

◆ gravi_t3_average_bootstrap()

cpl_error_code gravi_t3_average_bootstrap ( cpl_table *  oi_t3_avg,
cpl_table *  oi_vis,
cpl_table *  oi_flux,
int  nboot,
int  use_vFactor,
int  use_pFactor,
double  outlier_threshold 
)

Average the closure-phase of all DITs into a final, averaged value.

Parameters
oi_t3_avgalready allocated OI_T3 table to be filled
oi_visinput OI_VIS with all individual DITs
oi_fluxinput OI_FLUX with all individual DITs
nsegnumber of segment for the boostrap
nbootnumber of boostrap
closuretriplet to consider (0..3)

Average the bispectrum and compute the final closure-phase, considering the rejection flags. The errors are computed with the boostraping method.

Definition at line 510 of file gravi_vis.c.

References cpl_msg_debug(), cpl_msg_info(), CPLCHECK_MSG, FREE, FREELOOP, gravi_array_init_double(), gravi_array_init_double_complex(), gravi_array_new_list(), gravi_array_online_variance_res(), gravi_array_threshold_min(), GRAVI_CLO_BASE, GRAVI_CLO_TEL, gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NBASE, gravi_randn(), gravi_table_set_array_phase(), gravi_vis_flag_lower(), gravi_vis_flag_median(), gravi_vis_flag_threshold(), and ntel.

Referenced by gravi_compute_vis().

◆ gravi_vis_average_amp()

cpl_error_code gravi_vis_average_amp ( cpl_table *  oi_table,
const char *  name,
const char *  err,
int  nbase 
)

Average amplitudes column of a multi-observation OIFITS table The averaged quantities are stored in the first nbase rows.

Parameters
oi_tablethe table to update (number of row will be reduced)
namename of column to average
errcorresponding error column
nbasenumber of row per obs (ex: 6 for VIS and 4 for FLUX)

Definition at line 2754 of file gravi_vis.c.

References CPLCHECK_MSG, FREE, and gravi_array_init_double().

Referenced by gravi_average_vis().

◆ gravi_vis_average_bootstrap()

cpl_error_code gravi_vis_average_bootstrap ( cpl_table *  oi_vis_avg,
cpl_table *  oi_vis2_avg,
cpl_table *  oi_vis,
int  nboot,
const char *  phase_ref,
int  use_vFactor,
int  use_pFactor,
int  use_debiasing,
double  outlier_threshold 
)

Average the visibility of all DITs into a final, averaged value.

Parameters
oi_vis_avgalready allocated OI_VIS table to be filled
oi_vis2_avgalready allocated OI_VIS2 table to be filled
oi_visinput OI_VIS with all individual DITs
oi_fluxinput OI_FLUX with all individual DITs
nsegnumber of segment for the boostrap
nbootnumber of boostrap
basebase to consider (0..5)
phase_refphase used to rephase the DITs
use_vFactoruse the VFACTOR to compensate for vis. losses
use_pFactoruse the VFACTOR to compensate for vis. losses

Average the coherent flux and photometric fluex, then normalize and compute the final visibilities, considering the rejection flags. The errors are computed with the boostraping method.

Definition at line 915 of file gravi_vis.c.

References cpl_msg_debug(), cpl_msg_info(), CPLCHECK_MSG, FREE, FREELOOP, gravi_array_compute_norm2(), gravi_array_init_double(), gravi_array_new_list(), gravi_array_online_variance_res(), gravi_array_threshold_min(), gravi_array_wrap_complex(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NBASE, gravi_randn(), gravi_table_get_column_sum_array(), gravi_table_set_array_double_complex(), gravi_table_set_array_phase(), gravi_vis_flag_lower(), gravi_vis_flag_median(), and gravi_vis_flag_threshold().

Referenced by gravi_compute_vis().

◆ gravi_vis_average_phi()

cpl_error_code gravi_vis_average_phi ( cpl_table *  oi_table,
const char *  name,
const char *  err,
int  nbase 
)

Average phases column of a multi-observation OIFITS table Phases are averaged with arg{<exp(i.phi)>} The averaged quantities are stored in the first nbase rows.

Parameters
oi_tablethe table to update (number of row will be reduced)
namename of column to average
errcorresponding error column
nbasenumber of row per obs (ex: 6 for VIS and 4 for FLUX)

Definition at line 2815 of file gravi_vis.c.

References CPLCHECK_MSG, FREE, gravi_array_init_double(), gravi_array_init_double_complex(), and gravi_table_set_array_phase().

Referenced by gravi_average_vis().

◆ gravi_vis_average_value()

cpl_error_code gravi_vis_average_value ( cpl_table *  oi_table,
const char *  name,
const char *  err,
int  nbase 
)

Average scalar column of a multi-observation OIFITS table. The averaged quantities are stored in the first nbase rows.

Parameters
oi_tablethe table to update (number of row will be reduced)
namename of column to average
errcorresponding error column
nbasenumber of row per obs (ex: 6 for VIS and 4 for FLUX)

Definition at line 2871 of file gravi_vis.c.

References CPLCHECK_MSG.

Referenced by gravi_average_vis().

◆ gravi_vis_compute_column_mean()

cpl_error_code gravi_vis_compute_column_mean ( cpl_table *  out_table,
cpl_table *  in_table,
const char *  name,
int  ntel 
)

Compute the mean of a column in OIFITS table, and save the result in the specified output table.

Parameters
out_tableOutput table
in_tableInput table
nameColumn name
ntelNumber of tel (or base, or triplet)

The routine create a column in the output table with the same name and units as the one in the input table. It is filled with an average of the signal over all DITs, considering the column REJECTION_FLAG if present (non-zero means frame is rejected). This averaging is performed independently for the ntel tel (or base or triplet). The output table shall thus contain ntel rows while the input table shall contain ntel*NDIT rows.

Note that this routine is not optimized for performance and thus shall not be used on the FT tables.

Definition at line 4003 of file gravi_vis.c.

References cpl_msg_info(), CPLCHECK_MSG, FREE, gravi_array_init_double(), gravi_array_init_double_complex(), gravi_msg_function_exit, gravi_msg_function_start, and ntel.

Referenced by gravi_compute_vis().

◆ gravi_vis_copy_fluxdata()

cpl_error_code gravi_vis_copy_fluxdata ( gravi_data oi_data,
int  delete_flux 
)

Duplicate the column FLUX into FLUXDATA, for OIFITS2 compliance.

Parameters
oi_dataVIS data to process, in-place
delete_fluxIf 1 then also delete the original flux column

Definition at line 3635 of file gravi_vis.c.

References cpl_msg_info(), gravi_data_get_header, gravi_data_get_oi_flux, gravi_data_has_type(), gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_pola_num(), GRAVI_SC, GRAVI_TYPE, and header.

Referenced by gravity_postprocess(), and gravity_vis().

◆ gravi_vis_erase_obs()

cpl_error_code gravi_vis_erase_obs ( cpl_table *  oi_table,
cpl_array *  flag_array,
cpl_size  ntel 
)

Erase observation from an OIFITS table.

Parameters
oi_tableThe oitable, modified in-place
flag_arrayArray with nobs value
ntelNumber of row in oitable for each obs

The recipe first select all obs in oitable corresponding to flagged observations (flag_array != 0). Then they are erased in-place.

Definition at line 3955 of file gravi_vis.c.

References CPLCHECK_MSG, gravi_msg_function_exit, gravi_msg_function_start, and ntel.

Referenced by gravi_disp_cleanup().

◆ gravi_vis_fit_amp()

cpl_error_code gravi_vis_fit_amp ( cpl_table *  oi_table,
const char *  name,
const char *  err,
cpl_size  maxdeg 
)

Smooth amp column of OIFITS table.

Parameters
oi_tablethe table to update (column depth will be modified)
namename of column to rebin
errcorresponding error column
nsampnumber of consecutive samples to bin into single bin

Definition at line 3266 of file gravi_vis.c.

References CPLCHECK_MSG, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_vis_smooth().

◆ gravi_vis_flag_lower()

cpl_error_code gravi_vis_flag_lower ( cpl_table *  oi_table,
const char *  data,
const char *  flag,
double  value 
)

Flag samples of OIFITS table based on absolute threshold.

Parameters
oi_tablethe cpl_table to update, in-place
namethe column name to verify
flagthe corresponding flag column (to update in-place)
valuethe threshold to compare

For each sample in the column, if sample<=value then the corresponding element in the flag column is set to 'T'.

Definition at line 3799 of file gravi_vis.c.

References CPLCHECK_MSG, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_flux_average_bootstrap(), gravi_t3_average_bootstrap(), gravi_vis_average_bootstrap(), and gravi_vis_smooth().

◆ gravi_vis_flag_median()

cpl_error_code gravi_vis_flag_median ( cpl_table *  oi_table,
const char *  data,
const char *  flag,
double  value 
)

Flag samples of OIFITS table based on runnning median.

Parameters
oi_tablethe cpl_table to update, in-place
namethe column name to verify
flagthe corresponding flag column (to update in-place)
valuethe threshold to compare

For each sample in the column, if sample>value*median then the corresponding element in the flag column is set to 'T'.

Definition at line 3845 of file gravi_vis.c.

References CPLCHECK_MSG, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_t3_average_bootstrap(), gravi_vis_average_bootstrap(), and gravi_vis_smooth().

◆ gravi_vis_flag_nan()

cpl_error_code gravi_vis_flag_nan ( cpl_table *  oi_table)

Flag samples of OIFITS table which are NAN or NULL.

Parameters
oi_tablethe cpl_table to update, in-place

Definition at line 3684 of file gravi_vis.c.

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

Referenced by gravi_vis_smooth().

◆ gravi_vis_flag_relative_threshold()

cpl_error_code gravi_vis_flag_relative_threshold ( cpl_table *  oi_table,
const char *  err,
const char *  data,
const char *  flag,
double  value 
)

Flag samples of OIFITS table based on relative threshold.

Parameters
oi_tablethe cpl_table to update, in-place
namethe column name to verify
namethe corresponding error column
flagthe corresponding flag column (to update in-place)
valuethe threshold to compare

For each sample in the column, if err/sample>value then the corresponding element in the flag column is set to 'T'.

Definition at line 3905 of file gravi_vis.c.

References CPLCHECK_MSG, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_flux_average_bootstrap(), gravi_vis_resamp(), and gravi_vis_smooth().

◆ gravi_vis_flag_threshold()

cpl_error_code gravi_vis_flag_threshold ( cpl_table *  oi_table,
const char *  data,
const char *  flag,
double  value 
)

Flag samples of OIFITS table based on absolute threshold.

Parameters
oi_tablethe cpl_table to update, in-place
namethe column name to verify
flagthe corresponding flag column (to update in-place)
valuethe threshold to compare

For each sample in the column, if sample>value then the corresponding element in the flag column is set to 'T'.

Definition at line 3753 of file gravi_vis.c.

References CPLCHECK_MSG, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_t3_average_bootstrap(), gravi_vis_average_bootstrap(), gravi_vis_resamp(), and gravi_vis_smooth().

◆ gravi_vis_force_time()

cpl_error_code gravi_vis_force_time ( gravi_data oi_data)

Force all data in OI_TABLE to have the same TIME and MJD.

Parameters
oi_dataVIS data to process, in-place

The TIME and MJD columns of all OI_VIS, OI_VIS2, OI_FLUX and OI_T3 are averaged and replaced by these averages. Note that: SC and FT are averaged into the same time/mjd, all observations are averaged into the same time/mjd, all observables are averaged into the same time/mjd.

Definition at line 4123 of file gravi_vis.c.

References cpl_msg_info(), CPLCHECK_MSG, gravi_data_get_extname, gravi_data_get_size(), gravi_data_get_table_x(), gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravity_vis(), and gravity_vis_from_p2vmred().

◆ gravi_vis_mjd_to_time()

cpl_error_code gravi_vis_mjd_to_time ( gravi_data vis_data)

Recompute the TIME column of all OIFITS extension from the MJD column, following the OIFITS standard (number of second since the DATE-OBS at 00:00).

Parameters
vis_datathe gravi_data to update in-place

Definition at line 2650 of file gravi_vis.c.

References cpl_msg_debug(), gravi_convert_to_mjd(), gravi_data_get_extname, gravi_data_get_plist_x(), gravi_data_get_size(), gravi_data_get_table_x(), gravi_msg_function_exit, gravi_msg_function_start, and plist.

Referenced by gravity_disp(), gravity_postprocess(), gravity_vis(), and gravity_vis_from_p2vmred().

◆ gravi_vis_resamp()

cpl_error_code gravi_vis_resamp ( gravi_data oi_data,
cpl_size  nsamp 
)

Re-bin the SC table by nsamp consecutive spectral bins.

Parameters
oi_dataVIS data to process, in-place
nsampinteger, the number of consecutive bin to sum

The OI_VIS, OI_VIS2, OI_FLUX, OI_T3 and OI_WAVELENGTHs tables are updated accordingly. Note that this operation is not flux conservative (FIXME: understand how to better averaged flux).

Definition at line 3538 of file gravi_vis.c.

References cpl_msg_info(), CPLCHECK_MSG, gravi_data_get_header, gravi_data_get_oi_flux, gravi_data_get_oi_t3, gravi_data_get_oi_vis, gravi_data_get_oi_vis2, gravi_data_get_oi_wave, gravi_msg_function_exit, gravi_msg_function_start, gravi_msg_warning(), gravi_pfits_get_pola_num(), GRAVI_SC, gravi_vis_flag_relative_threshold(), gravi_vis_flag_threshold(), gravi_vis_resamp_amp(), and header.

Referenced by gravity_postprocess().

◆ gravi_vis_resamp_amp()

cpl_error_code gravi_vis_resamp_amp ( cpl_table *  oi_table,
const char *  name,
const char *  err,
cpl_size  nsamp,
cpl_size  nwave_new 
)

Rebin amplitude column of OIFITS table.

Parameters
oi_tablethe table to update (column depth will be modified)
namename of column to rebin
errcorresponding error column
nsampnumber of consecutive samples to bin into single bin
nwave_newnumber of final bins to reach (FIXME: why needed ??)

Definition at line 3445 of file gravi_vis.c.

References gravi_msg_function_exit, gravi_msg_function_start, gravi_table_get_value, and gravi_table_set_value.

Referenced by gravi_vis_resamp().

◆ gravi_vis_resamp_phi()

cpl_error_code gravi_vis_resamp_phi ( cpl_table *  oi_table,
const char *  name,
const char *  err,
cpl_size  nsamp,
cpl_size  nwave_new 
)

Rebin phase column of OIFITS table (arg{<exp(i.phi)>})

Parameters
oi_tablethe table to update (column depth will be modified)
namename of column to rebin
errcorresponding error column
nsampnumber of consecutive samples to bin into single bin
nwave_newnumber of final bins to reach (FIXME: why needed ??)

Definition at line 3491 of file gravi_vis.c.

References gravi_msg_function_exit, gravi_msg_function_start, gravi_table_get_value, and gravi_table_set_value.

◆ gravi_vis_smooth()

cpl_error_code gravi_vis_smooth ( gravi_data oi_data,
cpl_size  nsamp_vis,
cpl_size  nsamp_flx,
cpl_size  maxdeg 
)

Smooth the SC table by nsamp consecutive spectral bins.

Parameters
oi_dataVIS data to process, in-place
nsamp_visinteger, the number of consecutive bin to smooth
nsamp_flxinteger, the number of consecutive bin to smooth
maxdeginteger, fit order
mindeginteger, fit order

The OI_VIS, OI_VIS2, OI_FLUX, OI_T3 tables are updated accordingly. Note that this operation is not flux conservative (FIXME: understand how to better averaged flux).

Definition at line 3363 of file gravi_vis.c.

References CPLCHECK_MSG, gravi_data_get_header, gravi_data_get_oi_flux, gravi_data_get_oi_t3, gravi_data_get_oi_vis, gravi_data_get_oi_vis2, gravi_msg_function_exit, gravi_msg_function_start, gravi_msg_warning(), gravi_pfits_get_pola_num(), GRAVI_SC, gravi_vis_fit_amp(), gravi_vis_flag_lower(), gravi_vis_flag_median(), gravi_vis_flag_nan(), gravi_vis_flag_relative_threshold(), gravi_vis_flag_threshold(), gravi_vis_smooth_amp(), gravi_vis_smooth_phi(), and header.

Referenced by gravity_viscal().

◆ gravi_vis_smooth_amp()

cpl_error_code gravi_vis_smooth_amp ( cpl_table *  oi_table,
const char *  name,
const char *  err,
cpl_size  nsamp 
)

Smooth amplitude column of OIFITS table.

Parameters
oi_tablethe table to update (column depth will be modified)
namename of column to rebin
errcorresponding error column
nsampnumber of consecutive samples to bin into single bin

Definition at line 3103 of file gravi_vis.c.

References CPLCHECK_MSG, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_vis_smooth().

◆ gravi_vis_smooth_phi()

cpl_error_code gravi_vis_smooth_phi ( cpl_table *  oi_table,
const char *  name,
const char *  err,
cpl_size  nsamp 
)

Smooth phase column of OIFITS table.

Parameters
oi_tablethe table to update (column depth will be modified)
namename of column to rebin
errcorresponding error column
nsampnumber of consecutive samples to bin into single bin

Definition at line 3184 of file gravi_vis.c.

References CPLCHECK_MSG, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_vis_smooth().