GRAVI Pipeline Reference Manual 1.9.2
Loading...
Searching...
No Matches
Functions
Gravity CPL interface

Functions

double pythag (double, double)
 
cpl_matrix * svdcmp (cpl_matrix *, cpl_vector *, cpl_matrix *)
 
int gravi_array_threshold_min (cpl_array *array, double lo_cut)
 
cpl_array ** gravi_array_new_list (int n, cpl_type type, int size)
 Allocate a list of arrays, pre-filled with 0.0.
 
cpl_error_code gravi_table_interpolate_column (cpl_table *to_table, const char *to_x, const char *to_y, const cpl_table *from_table, const char *from_x, const char *from_y)
 
double gravi_table_get_column_flagged_mean (cpl_table *table, const char *name)
 Function to compute the mean of a column table with arrays.
 
double gravi_table_get_column_flagged_max (cpl_table *table, const char *name)
 Function to compute the maximum of a column table with arrays.
 
double gravi_table_get_column_mean (cpl_table *table, const char *name, int base, int nbase)
 
double gravi_table_get_column_std (cpl_table *table, const char *name, int base, int nbase)
 
cpl_array * gravi_table_get_column_sum_array (cpl_table *table, const char *name, int base, int nbase)
 
cpl_array * gravi_table_get_column_mean_array (cpl_table *table, const char *name, int base, int nbase)
 
double ** gravi_table_get_data_array_double (cpl_table *table, const char *name)
 
float ** gravi_table_get_data_array_float (cpl_table *table, const char *name)
 
float complex ** gravi_table_get_data_array_float_complex (cpl_table *table, const char *name)
 
double complex ** gravi_table_get_data_array_double_complex (cpl_table *table, const char *name)
 
int ** gravi_table_get_data_array_int (cpl_table *table, const char *name)
 
cpl_array * gravi_array_init_double (long n, double value)
 
cpl_array * gravi_array_init_int (long n, int value)
 
cpl_array * gravi_array_init_double_complex (long n, double complex value)
 
cpl_array * gravi_array_init_float_complex (long n, float complex value)
 
cpl_array * gravi_array_wrap_complex (cpl_array *input_re, cpl_array *input_im)
 
cpl_array * gravi_array_wrap_float_complex (cpl_array *input_re, cpl_array *input_im)
 
cpl_array * gravi_array_compute_norm2 (cpl_array *input_re, cpl_array *input_im)
 
cpl_error_code gravi_table_set_array_double_complex (cpl_table *table, const char *name, cpl_size row, cpl_array *visR, cpl_array *visI)
 
cpl_error_code gravi_table_set_array_phase (cpl_table *table, const char *name, cpl_size row, cpl_array *phase)
 
cpl_error_code gravi_table_set_string_fixlen (cpl_table *table, const char *name, int row, const char *value, int len)
 Set string in table, ensuring fixed length (right space padding). see cpl_table_set_string.
 
cpl_array * gravi_array_rebin (const cpl_array *input, const cpl_array *errs, cpl_table *oi_wave_sc, cpl_table *oi_wave_ft)
 
cpl_error_code gravi_table_add_columns (cpl_table *oi_vis1, const char *name1, cpl_table *oi_vis2, const char *name2)
 
cpl_error_code gravi_table_runint_column (cpl_table *oi_vis, const char *input_name, const char *output_name, int nsmooth, int nbase)
 
cpl_error_code gravi_table_smooth_column (cpl_table *oi_vis, const char *input_name, const char *output_name, int nsmooth, int nbase)
 
cpl_array * gravi_table_create_sigma_array (cpl_table *oi_wave)
 
cpl_array * gravi_table_create_wave_array (cpl_table *oi_wave)
 
cpl_error_code gravi_array_normalize_complex (cpl_array *input)
 
cpl_array * gravi_array_create_inverse (cpl_array *input)
 
cpl_error_code gravi_array_phase_unwrap (cpl_array *input)
 
cpl_error_code gravi_array_phase_wrap (cpl_array *input)
 
cpl_array * gravi_array_cexp (double complex factor, const cpl_array *input)
 Compute the complex exponention of an array: cexp (factor * input)
 
cpl_error_code gravi_array_multiply_phasor (cpl_array *input, double complex factor, cpl_array *phase)
 Multiply a REAL phase to a COMPLEX array, in-place: input = input * cexp (factor * phase)
 
cpl_error_code gravi_array_add_phasor (cpl_array *input, double complex factor, cpl_array *phase)
 Add a REAL phase to a COMPLEX array, in-place: input = input + cexp (factor * phase)
 
cpl_error_code gravi_array_add_phasors (cpl_array *input, cpl_array *add, cpl_array *sub)
 Add a pair of COMPLEX arrays to a COMPLEX array, in-place: input = input + add*conj(sub)
 
cpl_error_code gravi_array_add_phase (cpl_array *input, double factor, cpl_array *phase)
 Add a REAL phase to a REAL phase array, in-place: input = input + factor * phase.
 
cpl_error_code gravi_array_multiply_conj (cpl_array *input1, cpl_array *input2)
 
cpl_array * gravi_array_smooth (cpl_array *input_array, int DIT_smooth)
 
cpl_error_code gravi_array_get_group_delay_loop (cpl_array **input, cpl_array **flag, cpl_array *sigma, double *gd, cpl_size nrow, double max_width, int verbose)
 Optimized computation of GDELAY for a list of arrays.
 
cpl_error_code gravi_table_compute_group_delay (cpl_table *table, const char *input, const char *flag, const char *output, cpl_table *oi_wave)
 
int gravi_table_are_equal (cpl_table *first, cpl_table *second)
 Check if two tables have the same content.
 
cpl_error_code gravi_table_new_column (cpl_table *table, const char *name, const char *unit, cpl_type type)
 
cpl_error_code gravi_table_new_column_array (cpl_table *table, const char *name, const char *unit, cpl_type type, cpl_size size)
 
cpl_error_code gravi_table_init_column_array (cpl_table *table, const char *name, const char *unit, cpl_type type, cpl_size size)
 
cpl_error_code gravi_imagelist_unwrap_images (cpl_imagelist *imglist)
 Unwrap an imagelist an all its images.
 
cpl_imagelist * gravi_imagelist_wrap_column (cpl_table *table_data, const char *data_x)
 Wrap a column array of a table into an imagelist.
 
double gravi_image_get_noise_window (cpl_image *img, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 Estimate the median noise in a window. This noise is estimated as the median{img**2}**0.5, so that it is a robust estimate.
 
cpl_image * gravi_image_collapse_median_x (cpl_image *img, cpl_size drop_from, cpl_size drop_to)
 collapse image along the x direction, droping a part of the image
 
cpl_error_code gravi_image_subtract_collapse (cpl_image *img, const cpl_image *collapse, int direction)
 
cpl_error_code gravi_image_subtract_window (cpl_image *img1, const cpl_image *img2, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size llx2, cpl_size lly2)
 
cpl_error_code gravi_image_replace_window (cpl_image *img1, const cpl_image *img2, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size llx2, cpl_size lly2)
 
cpl_image * gravi_image_from_column (cpl_table *table_data, const char *data_x, cpl_size row)
 Create an image from a column array in table.
 
cpl_imagelist * gravi_imagelist_from_column (cpl_table *table_data, const char *data_x)
 Create an imagelist from a column array in table.
 
cpl_array * gravi_table_get_column_dimension (const cpl_table *table, const char *name)
 Return an array ready for cpl_table_set_column_dimension.
 
cpl_array * gravi_array_wrap_image (cpl_image *img)
 Wrap the data of na image into an array.
 
cpl_matrix * get_matrix_from_vector (cpl_vector *vector1, cpl_vector *vector2)
 Copy the content of two vector into a newly allocated 2D matrix.
 
cpl_vector * gravi_table_get_vector (cpl_table *spectrum_data, cpl_size index, const char *regname)
 Create a vector from the row index of the column regname.
 
cpl_vector * gravi_table_get_vector_scalar (cpl_table *table, const char *name, cpl_size base, cpl_size nbase)
 
cpl_vector * gravi_table_get_vector_diff (cpl_table *spectrum_data, int index, const char *regname1, const char *regname2)
 Create a vector from the row index of the column regname.
 
cpl_error_code gravi_image_fill (cpl_image *img, double value)
 Fill entire image with value.
 
cpl_image * gravi_image_wrap_matrix (cpl_matrix *matrix)
 Wrap matrix into an image (data not duplicated)
 
cpl_image * gravi_image_from_matrix (cpl_matrix *matrix)
 
cpl_image * gravi_image_wrap_vector (cpl_vector *vector)
 Wrap vector into an image (data not duplicated)
 
cpl_image * gravi_image_from_vector (cpl_vector *vector)
 
double gravi_image_get_quantile (const cpl_image *img, double thr)
 Compute the quantile of an image.
 
double gravi_array_get_quantile (cpl_array *arr, double thr)
 Compute the value of the vector corresponding to the quantile 'thr' (0 < thr < 1)
 
cpl_vector * gravi_vector_median (const cpl_vector *vector, cpl_size hw)
 Return the running median of a vector, with special care for the boundaray, that are filled with the value at nw and size-hw. Running median is created with cpl_vector_filter_median_create or cpl_vector_get_median if size is less than hw*2+3.
 
cpl_error_code gravi_vector_abs (cpl_vector *vector)
 Return the running median of a vector, with special care for the boundaray, that are filled with the value at nw and size-hw. Running median is created with cpl_vector_filter_median_create or cpl_vector_get_median if size is less than hw*2+3.
 
cpl_size gravi_vector_get_maxpos (cpl_vector *vector)
 Return the index of maximum in a vector. If several indexes exists with the maximum value, the smallest index is returned.
 
double gravi_vector_get_mean_clip (cpl_vector *vector_in, double percent, double nsigma)
 Return the mean of a vector after extrema and RMS clipping.
 
cpl_vector * gravi_vector_extract (const cpl_vector *vector, int start, int step)
 Extract part of a vector.
 
cpl_error_code gravi_vector_unwrap_with_guess (cpl_vector *vector, cpl_vector *ref, double ref_to_phase)
 Unwrap a phase vector following a guess vector. The difference is actually unwrap and shall thus be slowly evolving. The operration if performed in-place.
 
cpl_error_code gravi_table_multiply_scalar (cpl_table *table, const char *name, int base, int nbase, double value)
 Multiply scalar or array column by scalar.
 
cpl_error_code gravi_table_add_scalar (cpl_table *table, const char *name, int base, int nbase, double value)
 Multply scalar or array column by scalar.
 
cpl_matrix * gravi_matrix_interpolate_col (cpl_matrix *matrix, cpl_vector *xref, cpl_vector *xout)
 Linear interpolation of matrix column.
 
cpl_matrix * gravi_matrix_invertSV_create (cpl_matrix *a_in)
 Invers a matrix with singular value decomposition.
 
cpl_table * gravi_table_extract_time_interval (cpl_table *table, double start, double end)
 Extract rows from table based on the TIME column.
 

Detailed Description

This module implements some interactions with cpl objects to address specific gravity needs. The manipulated cpl object are cpl_matrix, cpl_array, cpl_table and cpl_image

Function Documentation

◆ get_matrix_from_vector()

cpl_matrix * get_matrix_from_vector ( cpl_vector *  vector1,
cpl_vector *  vector2 
)

Copy the content of two vector into a newly allocated 2D matrix.

Parameters
vector1
vector2
Returns
The newly allocated matrix
Note
The returned matrix must be deallocated using the function
See also
cpl_matrix_delete()

Definition at line 2185 of file gravi_cpl.c.

Referenced by gravi_ellipse_phase_create().

◆ gravi_array_add_phase()

cpl_error_code gravi_array_add_phase ( cpl_array *  input,
double  factor,
cpl_array *  phase 
)

Add a REAL phase to a REAL phase array, in-place: input = input + factor * phase.

Definition at line 1241 of file gravi_cpl.c.

References CPLCHECK_MSG.

Referenced by gravi_p2vm_phase_correction(), and gravi_vis_create_phaseref_sc().

◆ gravi_array_add_phasor()

cpl_error_code gravi_array_add_phasor ( cpl_array *  input,
double complex  factor,
cpl_array *  phase 
)

Add a REAL phase to a COMPLEX array, in-place: input = input + cexp (factor * phase)

Definition at line 1185 of file gravi_cpl.c.

References CPLCHECK_MSG.

◆ gravi_array_add_phasors()

cpl_error_code gravi_array_add_phasors ( cpl_array *  input,
cpl_array *  add,
cpl_array *  sub 
)

Add a pair of COMPLEX arrays to a COMPLEX array, in-place: input = input + add*conj(sub)

Definition at line 1211 of file gravi_cpl.c.

References CPLCHECK_MSG.

◆ gravi_array_cexp()

cpl_array * gravi_array_cexp ( double complex  factor,
const cpl_array *  input 
)

Compute the complex exponention of an array: cexp (factor * input)

Definition at line 1137 of file gravi_cpl.c.

Referenced by gravi_apply_tf_phi(), and gravi_p2vm_phase_correction().

◆ gravi_array_compute_norm2()

cpl_array * gravi_array_compute_norm2 ( cpl_array *  input_re,
cpl_array *  input_im 
)

Definition at line 688 of file gravi_cpl.c.

Referenced by gravi_vis_average_bootstrap().

◆ gravi_array_create_inverse()

cpl_array * gravi_array_create_inverse ( cpl_array *  input)

Definition at line 1071 of file gravi_cpl.c.

References CPLCHECK_NUL.

◆ gravi_array_get_group_delay_loop()

cpl_error_code gravi_array_get_group_delay_loop ( cpl_array **  input,
cpl_array **  flag,
cpl_array *  sigma,
double *  gd,
cpl_size  nrow,
double  max_width,
int  verbose 
)

Optimized computation of GDELAY for a list of arrays.

Parameters
inputPointer to arrays (complex coherent flux)
flagPointer to arrays (flag to discard data), can be NULL
sigmaArray with the wavenumbers [m]
gdPointer to output GDELAYs [m]
nrowSize of input and gd
max_widthMaximum opd to explore [m]
verboseFlag to dump the computation time in log

For each input array, the group-delay in [m] as the maximum of |Env(x)| where Env(x) = < visdata(lbd) * exp(2i.pi * x / lbd) > with <> sum over lbd

This is optimized to run on a column of arrays:

  • guess the delay with the interspectra
  • crude search over the max_width, resolution 2lbd
  • fine search resolution lbd/10
  • fine search resolution lbd/100

Definition at line 1403 of file gravi_cpl.c.

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

Referenced by gravi_average_self_visphi(), gravi_compute_vis(), gravi_p2vm_phase_correction(), and gravi_table_compute_group_delay().

◆ gravi_array_get_quantile()

double gravi_array_get_quantile ( cpl_array *  arr,
double  thr 
)

Compute the value of the vector corresponding to the quantile 'thr' (0 < thr < 1)

Returns
quantile value

Definition at line 2511 of file gravi_cpl.c.

Referenced by gravi_p2vm_normalisation().

◆ gravi_array_init_double()

cpl_array * gravi_array_init_double ( long  n,
double  value 
)

◆ gravi_array_init_double_complex()

cpl_array * gravi_array_init_double_complex ( long  n,
double complex  value 
)

◆ gravi_array_init_float_complex()

cpl_array * gravi_array_init_float_complex ( long  n,
float complex  value 
)

Definition at line 630 of file gravi_cpl.c.

◆ gravi_array_init_int()

cpl_array * gravi_array_init_int ( long  n,
int  value 
)

Definition at line 608 of file gravi_cpl.c.

◆ gravi_array_multiply_conj()

cpl_error_code gravi_array_multiply_conj ( cpl_array *  input1,
cpl_array *  input2 
)

Definition at line 1262 of file gravi_cpl.c.

References CPLCHECK_MSG.

Referenced by gravi_p2vm_phase_correction().

◆ gravi_array_multiply_phasor()

cpl_error_code gravi_array_multiply_phasor ( cpl_array *  input,
double complex  factor,
cpl_array *  phase 
)

Multiply a REAL phase to a COMPLEX array, in-place: input = input * cexp (factor * phase)

Definition at line 1159 of file gravi_cpl.c.

References CPLCHECK_MSG.

Referenced by gravi_average_self_visphi(), gravi_compute_disp(), gravi_compute_vis(), gravi_p2vm_phase_correction(), and gravi_vis_create_phaseref_sc().

◆ gravi_array_new_list()

cpl_array ** gravi_array_new_list ( int  n,
cpl_type  type,
int  size 
)

Allocate a list of arrays, pre-filled with 0.0.

Definition at line 93 of file gravi_cpl.c.

References FREE.

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

◆ gravi_array_normalize_complex()

cpl_error_code gravi_array_normalize_complex ( cpl_array *  input)

Definition at line 1053 of file gravi_cpl.c.

References CPLCHECK_MSG.

◆ gravi_array_phase_unwrap()

cpl_error_code gravi_array_phase_unwrap ( cpl_array *  input)

Definition at line 1088 of file gravi_cpl.c.

References CPLCHECK_INT.

Referenced by gravi_compute_disp(), and gravi_metrology_drs().

◆ gravi_array_phase_wrap()

cpl_error_code gravi_array_phase_wrap ( cpl_array *  input)

◆ gravi_array_rebin()

cpl_array * gravi_array_rebin ( const cpl_array *  input,
const cpl_array *  errs,
cpl_table *  oi_wave_sc,
cpl_table *  oi_wave_ft 
)

Definition at line 792 of file gravi_cpl.c.

References CPLCHECK_NUL, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_normalize_sc_to_ft().

◆ gravi_array_smooth()

cpl_array * gravi_array_smooth ( cpl_array *  input_array,
int  DIT_smooth 
)

Definition at line 1285 of file gravi_cpl.c.

Referenced by gravi_metrology_drs(), gravi_metrology_telfc(), and gravi_smooth_preproc().

◆ gravi_array_threshold_min()

int gravi_array_threshold_min ( cpl_array *  array,
double  lo_cut 
)

Definition at line 71 of file gravi_cpl.c.

Referenced by gravi_t3_average_bootstrap(), and gravi_vis_average_bootstrap().

◆ gravi_array_wrap_complex()

cpl_array * gravi_array_wrap_complex ( cpl_array *  input_re,
cpl_array *  input_im 
)

◆ gravi_array_wrap_float_complex()

cpl_array * gravi_array_wrap_float_complex ( cpl_array *  input_re,
cpl_array *  input_im 
)

Definition at line 664 of file gravi_cpl.c.

◆ gravi_array_wrap_image()

cpl_array * gravi_array_wrap_image ( cpl_image *  img)

Wrap the data of na image into an array.

Parameters
imgThe image to wrap
Returns
An array with the same type as the image img.
Note
the returned array must unwrap using the function cpl_array_unwrap().
See also
cpl_array_unwrap().

Definition at line 2141 of file gravi_cpl.c.

References CPLCHECK_NUL.

Referenced by gravi_compute_dark(), and gravi_compute_profile().

◆ gravi_image_collapse_median_x()

cpl_image * gravi_image_collapse_median_x ( cpl_image *  img,
cpl_size  drop_from,
cpl_size  drop_to 
)

collapse image along the x direction, droping a part of the image

Parameters
imgimage
drop_fromfollow FITS convention start at 1
drop_tofollow FITS convention start at 1

The returned image has size nx=1 and the same ny as the input image. It should be desallocated with cpl_image_delete

Definition at line 1884 of file gravi_cpl.c.

References FREE, gravi_msg_function_exit, and gravi_msg_function_start.

◆ gravi_image_fill()

cpl_error_code gravi_image_fill ( cpl_image *  img,
double  value 
)

Fill entire image with value.

Definition at line 2398 of file gravi_cpl.c.

◆ gravi_image_from_column()

cpl_image * gravi_image_from_column ( cpl_table *  table_data,
const char *  data_x,
cpl_size  row 
)

Create an image from a column array in table.

Parameters
table_dataThe input table
data_xThe column name
rowThe row to extract

The array is copied into image of same type. The returned pointer shall be deleted with cpl_image_delete

FIXME: to be optimized

Definition at line 2052 of file gravi_cpl.c.

References gravi_imagelist_unwrap_images(), gravi_imagelist_wrap_column(), gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_gain(), and gravi_compute_profile().

◆ gravi_image_from_matrix()

cpl_image * gravi_image_from_matrix ( cpl_matrix *  matrix)

Definition at line 2423 of file gravi_cpl.c.

◆ gravi_image_from_vector()

cpl_image * gravi_image_from_vector ( cpl_vector *  vector)

Definition at line 2451 of file gravi_cpl.c.

◆ gravi_image_get_noise_window()

double gravi_image_get_noise_window ( cpl_image *  img,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

Estimate the median noise in a window. This noise is estimated as the median{img**2}**0.5, so that it is a robust estimate.

Definition at line 1839 of file gravi_cpl.c.

References CPLCHECK_MSG, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

◆ gravi_image_get_quantile()

double gravi_image_get_quantile ( const cpl_image *  img,
double  thr 
)

Compute the quantile of an image.

Parameters
imginput image
thrquantile fraction (0 < thr < 1)

Compute the value of the image corresponding to the quantile fraction 'thr', that is such that their is nx*ny*thr pixels with values lower the returned value.

Definition at line 2477 of file gravi_cpl.c.

Referenced by gravi_compute_badpix(), and gravi_compute_biasmask().

◆ gravi_image_replace_window()

cpl_error_code gravi_image_replace_window ( cpl_image *  img1,
const cpl_image *  img2,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
cpl_size  llx2,
cpl_size  lly2 
)

Definition at line 2004 of file gravi_cpl.c.

References cpl_msg_info(), gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_acqcam_pupil_v2().

◆ gravi_image_subtract_collapse()

cpl_error_code gravi_image_subtract_collapse ( cpl_image *  img,
const cpl_image *  collapse,
int  direction 
)

◆ gravi_image_subtract_window()

cpl_error_code gravi_image_subtract_window ( cpl_image *  img1,
const cpl_image *  img2,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
cpl_size  llx2,
cpl_size  lly2 
)

Definition at line 1971 of file gravi_cpl.c.

References gravi_msg_function_exit, and gravi_msg_function_start.

◆ gravi_image_wrap_matrix()

cpl_image * gravi_image_wrap_matrix ( cpl_matrix *  matrix)

Wrap matrix into an image (data not duplicated)

Definition at line 2415 of file gravi_cpl.c.

◆ gravi_image_wrap_vector()

cpl_image * gravi_image_wrap_vector ( cpl_vector *  vector)

Wrap vector into an image (data not duplicated)

Definition at line 2443 of file gravi_cpl.c.

◆ gravi_imagelist_from_column()

cpl_imagelist * gravi_imagelist_from_column ( cpl_table *  table_data,
const char *  data_x 
)

Create an imagelist from a column array in table.

Parameters
table_dataThe input table
data_xThe column name

The array of each row are copied into image of their type, and append into the returned imagelist. The returned pointer shall be deleted with cpl_imagelist_delete

FIXME: to be optimized

Definition at line 2084 of file gravi_cpl.c.

References gravi_imagelist_unwrap_images(), gravi_imagelist_wrap_column(), gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_gain().

◆ gravi_imagelist_unwrap_images()

cpl_error_code gravi_imagelist_unwrap_images ( cpl_imagelist *  imglist)

Unwrap an imagelist an all its images.

Parameters
imglistThe imagelist to unwrap

All the images of imaglist are unwrapped, that is the data remain allocated but the image structure is deleted (see cpl_image_unwrap). Then the imagelist structure itself is deleted with cpl_imagelist_delete.

Definition at line 1727 of file gravi_cpl.c.

References CPLCHECK_MSG.

Referenced by gravi_compute_dark(), gravi_compute_p2vm(), gravi_compute_profile(), gravi_image_from_column(), gravi_imagelist_from_column(), gravi_imglist_sc_collapse(), and gravi_wave_test_image().

◆ gravi_imagelist_wrap_column()

cpl_imagelist * gravi_imagelist_wrap_column ( cpl_table *  table_data,
const char *  data_x 
)

Wrap a column array of a table into an imagelist.

Parameters
table_dataThe input table
data_xThe column name

The array of each row are wrapped into image of their type, and append into the returned imagelist. The returned pointer shall be deleted with gravi_imagelist_unwrap_images

Definition at line 1757 of file gravi_cpl.c.

References CPLCHECK_NUL, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_dark(), gravi_compute_p2vm(), gravi_compute_profile(), gravi_image_from_column(), gravi_imagelist_from_column(), gravi_imglist_sc_collapse(), and gravi_wave_test_image().

◆ gravi_matrix_interpolate_col()

cpl_matrix * gravi_matrix_interpolate_col ( cpl_matrix *  matrix,
cpl_vector *  xref,
cpl_vector *  xout 
)

Linear interpolation of matrix column.

Parameters
matrixThe input matrix to interpolate (size n,m)
xrefThe vector of current x axis (size m)
xoutThe vector of target x axis (size k)
Returns
A newly allocated matrix of size (n,k)

The routine interpolate each column of the matrix using cpl_bivector_interpolate_linear

Definition at line 2867 of file gravi_cpl.c.

References CPLCHECK_NUL, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

◆ gravi_matrix_invertSV_create()

cpl_matrix * gravi_matrix_invertSV_create ( cpl_matrix *  a_in)

Invers a matrix with singular value decomposition.

Parameters
a_inThe input matrix to invert
Returns
Inverse matrix. In case of error a NULL is returned.

Definition at line 2921 of file gravi_cpl.c.

References CPLCHECK_NUL, gravi_msg_function_exit, gravi_msg_function_start, and svdcmp().

Referenced by gravi_compute_p2vm(), and gravi_compute_p2vmred().

◆ gravi_table_add_columns()

cpl_error_code gravi_table_add_columns ( cpl_table *  oi_vis1,
const char *  name1,
cpl_table *  oi_vis2,
const char *  name2 
)

◆ gravi_table_add_scalar()

cpl_error_code gravi_table_add_scalar ( cpl_table *  table,
const char *  name,
int  base,
int  nbase,
double  value 
)

Multply scalar or array column by scalar.

Parameters
tableThe table to modify in-place
nameThe name of the column to modify
baseThe starting row
nbaseThe row increment
valueValue to add

Each row in base::nbase (pythonic notation) of the column name is being added by value.

Definition at line 2816 of file gravi_cpl.c.

References CPLCHECK_MSG.

Referenced by gravi_opds_compute_guess().

◆ gravi_table_are_equal()

int gravi_table_are_equal ( cpl_table *  first,
cpl_table *  second 
)

Check if two tables have the same content.

Parameters
firsttable to compare
secondtable to compare
Returns
1 / 0

Definition at line 1585 of file gravi_cpl.c.

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

Referenced by gravi_data_append().

◆ gravi_table_compute_group_delay()

cpl_error_code gravi_table_compute_group_delay ( cpl_table *  table,
const char *  input,
const char *  flag,
const char *  output,
cpl_table *  oi_wave 
)

◆ gravi_table_create_sigma_array()

cpl_array * gravi_table_create_sigma_array ( cpl_table *  oi_wave)

Definition at line 1024 of file gravi_cpl.c.

References CPLCHECK_NUL.

Referenced by gravi_p2vm_phase_correction().

◆ gravi_table_create_wave_array()

cpl_array * gravi_table_create_wave_array ( cpl_table *  oi_wave)

Definition at line 1037 of file gravi_cpl.c.

References CPLCHECK_NUL.

◆ gravi_table_extract_time_interval()

cpl_table * gravi_table_extract_time_interval ( cpl_table *  table,
double  start,
double  end 
)

Extract rows from table based on the TIME column.

Parameters
tableinput table
start,endmax and min accepted time.
Returns
A new table, with rows matching TIME>=start && TIME<end

Definition at line 3261 of file gravi_cpl.c.

References gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_vis().

◆ gravi_table_get_column_dimension()

cpl_array * gravi_table_get_column_dimension ( const cpl_table *  table,
const char *  name 
)

Return an array ready for cpl_table_set_column_dimension.

Parameters
tableThe input table
nameThe column name

The return array (CPL_TYPE_INT) is of size the number returned by cpl_table_get_column_dimensions, and each values corresponds to the dimension returned by cpl_table_get_column_dimension

Definition at line 2114 of file gravi_cpl.c.

◆ gravi_table_get_column_flagged_max()

double gravi_table_get_column_flagged_max ( cpl_table *  table,
const char *  name 
)

Function to compute the maximum of a column table with arrays.

Parameters
tableThe table to get the maximum of the column
nameThe name of the column to average
Returns
The maximum value

This function computes the maximum of a column table which contains arrays. It ignores flagged values, i.e., those ones in which the column 'FLAG' in the same table contains invalid elements. Note that the flagging is evaluated on a per array element basis. Also note that the maximum is computed for all rows.

Definition at line 290 of file gravi_cpl.c.

Referenced by gravi_idp_compute().

◆ gravi_table_get_column_flagged_mean()

double gravi_table_get_column_flagged_mean ( cpl_table *  table,
const char *  name 
)

Function to compute the mean of a column table with arrays.

Parameters
tableThe table to get the averaged column
nameThe name of the column to average
Returns
The average

This function computes the mean of a column table which contains arrays. It ignores flagged values, i.e., those ones in which the column 'FLAG' in the same table contains invalid elements. Note that the flagging is evaluated on a per array element basis. Also note that all the rows are averaged, there is no stride like it is done in gravi_table_get_column_mean.

Definition at line 217 of file gravi_cpl.c.

Referenced by gravi_idp_compute().

◆ gravi_table_get_column_mean()

double gravi_table_get_column_mean ( cpl_table *  table,
const char *  name,
int  base,
int  nbase 
)

◆ gravi_table_get_column_mean_array()

cpl_array * gravi_table_get_column_mean_array ( cpl_table *  table,
const char *  name,
int  base,
int  nbase 
)

Definition at line 449 of file gravi_cpl.c.

◆ gravi_table_get_column_std()

double gravi_table_get_column_std ( cpl_table *  table,
const char *  name,
int  base,
int  nbase 
)

Definition at line 388 of file gravi_cpl.c.

Referenced by gravi_acqcam_field(), and gravi_fit_dispersion().

◆ gravi_table_get_column_sum_array()

cpl_array * gravi_table_get_column_sum_array ( cpl_table *  table,
const char *  name,
int  base,
int  nbase 
)

◆ gravi_table_get_data_array_double()

double ** gravi_table_get_data_array_double ( cpl_table *  table,
const char *  name 
)

◆ gravi_table_get_data_array_double_complex()

double complex ** gravi_table_get_data_array_double_complex ( cpl_table *  table,
const char *  name 
)

Definition at line 546 of file gravi_cpl.c.

References CPLCHECK_NUL.

Referenced by gravi_fit_dispersion().

◆ gravi_table_get_data_array_float()

float ** gravi_table_get_data_array_float ( cpl_table *  table,
const char *  name 
)

Definition at line 497 of file gravi_cpl.c.

References CPLCHECK_NUL.

Referenced by gravi_compute_tau0().

◆ gravi_table_get_data_array_float_complex()

float complex ** gravi_table_get_data_array_float_complex ( cpl_table *  table,
const char *  name 
)

Definition at line 521 of file gravi_cpl.c.

References CPLCHECK_NUL.

◆ gravi_table_get_data_array_int()

int ** gravi_table_get_data_array_int ( cpl_table *  table,
const char *  name 
)

Definition at line 570 of file gravi_cpl.c.

References CPLCHECK_NUL.

◆ gravi_table_get_vector()

cpl_vector * gravi_table_get_vector ( cpl_table *  spectrum_data,
cpl_size  index,
const char *  regname 
)

Create a vector from the row index of the column regname.

Parameters
spectrum_tableThe table loaded from the SPECTRUM_DATA field
regnameThe column's name on the table
indexThe index on the row (0 for a scalar column)
Returns
An allocated vector with values extracted from the table

Create a vector from the row index of the column regname The returned vector must be deallocated.

Definition at line 2235 of file gravi_cpl.c.

References FREE.

Referenced by gravi_compute_p2vm(), gravi_ellipse_meanopd_create(), gravi_p2vm_normalisation(), gravi_wave_fibre(), gravi_wave_scan(), and if().

◆ gravi_table_get_vector_diff()

cpl_vector * gravi_table_get_vector_diff ( cpl_table *  spectrum_data,
int  index,
const char *  regname1,
const char *  regname2 
)

Create a vector from the row index of the column regname.

Parameters
spectrum_tableThe table loaded from the SPECTRUM_DATA field
indexThe index on the row
regname1The column's name on the table
regname2The column's name on the table
Returns
An allocated vector with values extracted from the table regname1[index] - regname2[index]

Create a vector from the row index of the column regname The returned vector must be deallocated.

Definition at line 2356 of file gravi_cpl.c.

◆ gravi_table_get_vector_scalar()

cpl_vector * gravi_table_get_vector_scalar ( cpl_table *  table,
const char *  name,
cpl_size  base,
cpl_size  nbase 
)

Definition at line 2291 of file gravi_cpl.c.

References FREE.

◆ gravi_table_init_column_array()

cpl_error_code gravi_table_init_column_array ( cpl_table *  table,
const char *  name,
const char *  unit,
cpl_type  type,
cpl_size  size 
)

◆ gravi_table_interpolate_column()

cpl_error_code gravi_table_interpolate_column ( cpl_table *  to_table,
const char *  to_x,
const char *  to_y,
const cpl_table *  from_table,
const char *  from_x,
const char *  from_y 
)

◆ gravi_table_multiply_scalar()

cpl_error_code gravi_table_multiply_scalar ( cpl_table *  table,
const char *  name,
int  base,
int  nbase,
double  value 
)

Multiply scalar or array column by scalar.

Parameters
tableThe table to modify in-place
nameThe name of the column to modify
baseThe starting row
nbaseThe row increment
valueValue to multiply

Each row in base::nbase (pythonic notation) of the column name is being multiplied by value.

Definition at line 2766 of file gravi_cpl.c.

References CPLCHECK_MSG.

Referenced by gravi_compute_disp().

◆ gravi_table_new_column()

cpl_error_code gravi_table_new_column ( cpl_table *  table,
const char *  name,
const char *  unit,
cpl_type  type 
)

◆ gravi_table_new_column_array()

cpl_error_code gravi_table_new_column_array ( cpl_table *  table,
const char *  name,
const char *  unit,
cpl_type  type,
cpl_size  size 
)

◆ gravi_table_runint_column()

cpl_error_code gravi_table_runint_column ( cpl_table *  oi_vis,
const char *  input_name,
const char *  output_name,
int  nsmooth,
int  nbase 
)

◆ gravi_table_set_array_double_complex()

cpl_error_code gravi_table_set_array_double_complex ( cpl_table *  table,
const char *  name,
cpl_size  row,
cpl_array *  visR,
cpl_array *  visI 
)

Definition at line 714 of file gravi_cpl.c.

References CPLCHECK_MSG, and gravi_array_wrap_complex().

Referenced by gravi_vis_average_bootstrap().

◆ gravi_table_set_array_phase()

cpl_error_code gravi_table_set_array_phase ( cpl_table *  table,
const char *  name,
cpl_size  row,
cpl_array *  phase 
)

◆ gravi_table_set_string_fixlen()

cpl_error_code gravi_table_set_string_fixlen ( cpl_table *  table,
const char *  name,
int  row,
const char *  value,
int  len 
)

Set string in table, ensuring fixed length (right space padding). see cpl_table_set_string.

Parameters
len,thespecified maximum length of the string.
Returns
CPL_ERRROR_NONE

Definition at line 769 of file gravi_cpl.c.

References CPLCHECK_MSG, FREE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_create_oiarray_table(), and gravi_create_oitarget_table().

◆ gravi_table_smooth_column()

cpl_error_code gravi_table_smooth_column ( cpl_table *  oi_vis,
const char *  input_name,
const char *  output_name,
int  nsmooth,
int  nbase 
)

◆ gravi_vector_abs()

cpl_error_code gravi_vector_abs ( cpl_vector *  vector)

Return the running median of a vector, with special care for the boundaray, that are filled with the value at nw and size-hw. Running median is created with cpl_vector_filter_median_create or cpl_vector_get_median if size is less than hw*2+3.

Parameters
vectorInput vector (size)
hwSame parameter as in cpl_vector_filter_median_create
Returns
vector with running median, same size

Definition at line 2588 of file gravi_cpl.c.

Referenced by gravi_create_outlier_flag_sc().

◆ gravi_vector_extract()

cpl_vector * gravi_vector_extract ( const cpl_vector *  vector,
int  start,
int  step 
)

Extract part of a vector.

Parameters
vectorInput vector (size)
startStarting index (0...size-1)
stepStep index, so the returned values are every step
Returns
A new vector with size size/step

Definition at line 2696 of file gravi_cpl.c.

Referenced by if().

◆ gravi_vector_get_maxpos()

cpl_size gravi_vector_get_maxpos ( cpl_vector *  vector)

Return the index of maximum in a vector. If several indexes exists with the maximum value, the smallest index is returned.

Parameters
vectorInput vector (size)
Returns
The index of maximum or NULL on error

Definition at line 2614 of file gravi_cpl.c.

Referenced by gravi_wave_scan().

◆ gravi_vector_get_mean_clip()

double gravi_vector_get_mean_clip ( cpl_vector *  vector_in,
double  percent,
double  nsigma 
)

Return the mean of a vector after extrema and RMS clipping.

Parameters
vector_ininput vector
percent0-1, fraction of extremes values rejected
nsigmasigma clipping
Returns
The mean of accepted values after

Definition at line 2642 of file gravi_cpl.c.

References FREE.

Referenced by gravi_data_detector_cleanup().

◆ gravi_vector_median()

cpl_vector * gravi_vector_median ( const cpl_vector *  vector,
cpl_size  hw 
)

Return the running median of a vector, with special care for the boundaray, that are filled with the value at nw and size-hw. Running median is created with cpl_vector_filter_median_create or cpl_vector_get_median if size is less than hw*2+3.

Parameters
vectorInput vector (size)
hwSame parameter as in cpl_vector_filter_median_create
Returns
vector with running median, same size

Definition at line 2547 of file gravi_cpl.c.

Referenced by gravi_create_outlier_flag_sc().

◆ gravi_vector_unwrap_with_guess()

cpl_error_code gravi_vector_unwrap_with_guess ( cpl_vector *  vector,
cpl_vector *  ref,
double  ref_to_phase 
)

Unwrap a phase vector following a guess vector. The difference is actually unwrap and shall thus be slowly evolving. The operration if performed in-place.

Parameters
vectorto unwrap [rad]
refis the guess
ref_to_phaseis the coefficient to convert ref into [rad]

Definition at line 2719 of file gravi_cpl.c.

References CPLCHECK_MSG.

Referenced by gravi_ellipse_meanopd_create(), and gravi_wave_fibre().

◆ pythag()

double pythag ( double  a,
double  b 
)

Definition at line 2980 of file gravi_cpl.c.

Referenced by svdcmp().

◆ svdcmp()

cpl_matrix * svdcmp ( cpl_matrix *  a_in,
cpl_vector *  w,
cpl_matrix *  v 
)

Definition at line 2995 of file gravi_cpl.c.

References gravi_msg_function_exit, gravi_msg_function_start, IMIN, pythag(), and SIGN.

Referenced by gravi_matrix_invertSV_create().