GRAVI Pipeline Reference Manual  1.2.3
Functions
Miscellaneous Utilities

Functions

const char * gravi_get_license (void)
 Get the pipeline copyright and license. More...
 
cpl_table * gravi_table_oi_create (int nwave, int nrow, const char *oi_name)
 Create the oi table (oi_vis, oi_vis2, oi_t3) More...
 
int gravi_region_get_base (cpl_table *imaging_detector, int region)
 Return the base of a region. More...
 
int gravi_region_get_base_sign (cpl_table *imaging_detector, int base)
 Return the sign of a base by looking at the PORT order. More...
 
int gravi_region_get_pol (cpl_table *imaging_detector, int region)
 Return the polarisation id of a region. More...
 
int gravi_region_get_phaseid (cpl_table *imaging_detector, int region)
 Return the phase id of a region. More...
 
int gravi_region_get_tel (cpl_table *imaging_detector, int region, int beam)
 Return the telescope id (0,1,2,3) in a beam of a region. More...
 
char gravi_region_get_phase (cpl_table *imaging_detector, int region)
 Return the phase character of a region. More...
 
int gravi_get_region (cpl_table *img_det, int base, char phase, int pol)
 Find the region matching base, phase and pol. More...
 
int gravi_wave_get_nlambda (cpl_table *wave_data, double lambda_min, double lambda_max)
 Get the number of spectral element between lambdamin et lambdamax. More...
 
int * gravi_image_extract_dimension (cpl_image *img_profile)
 Compute startx and nx of the illuminated part of the image. More...
 
short gravi_sta_index (int gravi_input, cpl_table *optical_train_table, cpl_table *array_geometry_table)
 Retrieve STA_INDEX corresponding to a given input. More...
 
double gravi_spectrum_get_flux (const cpl_table *table)
 Return the total flux in DATA# regions. More...
 
cpl_vector * gravi_compute_envelope (const cpl_vector *opd, int wave, int nwave)
 Compute the envelope value. More...
 
double gravi_imagelist_get_flux (const cpl_imagelist *imglist)
 Return the total flux in imagelist. More...
 
cpl_error_code gravi_lkdt_get_sequence (cpl_table *oi_table, cpl_size ntel, cpl_size *first, cpl_size *nobs)
 Return the longuest sequence with constant LKDT. More...
 

Detailed Description

This module contains some utilities to access to specific quantities.

Function Documentation

cpl_vector* gravi_compute_envelope ( const cpl_vector *  opd,
int  wave,
int  nwave 
)

Compute the envelope value.

Parameters
opdInput vector with GD in [m]
waveInput wave channel
nwaveNumber of wave channel (define spectral resolution)
Returns
A newly allocated vector with the computed envelope

The vector is filled with the envelope amplitude at each OPD_GD position for the spectral channel wave, assuming the K-band is split into n_wave channel. Thus n_wave defines the spectral resolution (coherence length). The enveloppe is modeled with a Gaussian function.

Assume wave are ordered increasingly.

Definition at line 1081 of file gravi_utils.c.

Referenced by gravi_compute_disp(), gravi_compute_p2vm(), gravi_ellipse_meanopd_create(), and gravi_wave_fibre().

const char* gravi_get_license ( void  )

Get the pipeline copyright and license.

Returns
The copyright and license string

The function returns a pointer to the statically allocated license string. This string should not be modified using the returned pointer.

Definition at line 104 of file gravi_utils.c.

int gravi_get_region ( cpl_table *  img_det,
int  base,
char  phase,
int  pol 
)

Find the region matching base, phase and pol.

Parameters
imaging_detectorThe IMAGING_DETECTOR table
baseThe requested base (0..5)
phaseThe requested phase ('A','B','C' or 'D')
polThe requested pol (0 or 1)
Returns
The region id (or -1 on failure)

Definition at line 584 of file gravi_utils.c.

References gravi_region_get_base(), gravi_region_get_phase(), and gravi_region_get_pol().

Referenced by gravi_compute_disp(), gravi_ellipse_meanopd_create(), gravi_p2vm_normalisation(), gravi_wave_fibre(), and gravi_wave_fit_2d().

int* gravi_image_extract_dimension ( cpl_image *  img_profile)

Compute startx and nx of the illuminated part of the image.

Parameters
img_profileThe input image to look at
Returns
A pointer to int[2] with startx and nx

The function collapse the vertical (y) dimension and run a median filter over x. Then the limits are defined by the region when the the median filter is larger than 0.1 x MAX

Definition at line 727 of file gravi_utils.c.

Referenced by gravi_compute_profile().

double gravi_imagelist_get_flux ( const cpl_imagelist *  imglist)

Return the total flux in imagelist.

Parameters
imglistThe input imagelist
Returns
The flux

Compute the total flux by looping on image.

Definition at line 1117 of file gravi_utils.c.

Referenced by gravi_extract_spectrum().

cpl_error_code gravi_lkdt_get_sequence ( cpl_table *  oi_table,
cpl_size  ntel,
cpl_size *  first,
cpl_size *  nobs 
)

Return the longuest sequence with constant LKDT.

Parameters
oi_tableThe table to explore
ntelThe number of sample per obs (4 or 6)
firstReturn the first obs of the sequence
nobsReturn the nb of obs in the sequence

Search for the longuest sequence for which the LKDT_MET_FC are the same for the ntel beams. If several are of the same length, the first is returned.

Definition at line 1145 of file gravi_utils.c.

Referenced by gravi_disp_cleanup().

int gravi_region_get_base ( cpl_table *  imaging_detector,
int  region 
)

Return the base of a region.

Parameters
imaging_detectorThe IMAGING_DETECTOR table
regionThe region (0..47)
Returns
The base corresponding to this region

The function returns a integer from 0 to 5 (or -1 on failure) If REGNAME is 12-A-C, the function returns 0 If REGNAME is 21-A-C, the function returns 0 If REGNAME is 23-A-C, the function returns 3 If REGNAME is 34-A-C, the function returns 5 ...

Definition at line 361 of file gravi_utils.c.

Referenced by gravi_compute_disp(), gravi_get_region(), gravi_p2vm_normalisation(), gravi_p2vm_phase_correction(), gravi_wave_fit_2d(), and gravi_wave_test_image().

int gravi_region_get_base_sign ( cpl_table *  imaging_detector,
int  base 
)

Return the sign of a base by looking at the PORT order.

Parameters
imaging_detectorThe IMAGING_DETECTOR table
baseThe base (0..5)
Returns
The sign of this base (-1/+1), or 0 or error

The sign is defined by the order of the beam in the PORT column. If the first PORT is the largest, the sign is -1. If the first port is the smallest, the sign is +1.

Definition at line 399 of file gravi_utils.c.

Referenced by gravi_compute_disp(), gravi_ellipse_meanopd_create(), and gravi_wave_fibre().

char gravi_region_get_phase ( cpl_table *  imaging_detector,
int  region 
)

Return the phase character of a region.

Parameters
imaging_detectorThe IMAGING_DETECTOR table
regionThe region (0..47)
Returns
The phase char corresponding to this region

The function returns 'A', 'B', 'C' or 'D' If REGNAME is 12-A-C, the function returns 'A' If REGNAME is 12-B-C, the function returns 'B' If REGNAME is 12-C-C, the function returns 'C' If REGNAME is 12-D-C, the function returns 'D'

Definition at line 551 of file gravi_utils.c.

Referenced by gravi_get_region().

int gravi_region_get_phaseid ( cpl_table *  imaging_detector,
int  region 
)

Return the phase id of a region.

Parameters
imaging_detectorThe IMAGING_DETECTOR table
regionThe region (0..47)
Returns
The phase id corresponding to this region

The function returns 0 to 3 (or -1 on failure). If REGNAME is 12-A-C, the function returns 0 If REGNAME is 12-B-C, the function returns 1 If REGNAME is 12-C-C, the function returns 2 If REGNAME is 12-D-C, the function returns 3

Definition at line 479 of file gravi_utils.c.

int gravi_region_get_pol ( cpl_table *  imaging_detector,
int  region 
)

Return the polarisation id of a region.

Parameters
imaging_detectorThe IMAGING_DETECTOR table
regionThe region (0..47)
Returns
The polarisation id corresponding to this region

The function returns 0 or 1 (or -1 on failure). If REGNAME is 12-A-C, the function returns 0 If REGNAME is 12-A-S, the function returns 0 If REGNAME is 12-A-P, the function returns 1

Definition at line 445 of file gravi_utils.c.

Referenced by gravi_compute_p2vm(), gravi_compute_p2vmred(), gravi_create_oiwave_table_ft(), gravi_get_region(), gravi_interpolate_spectrum_table(), gravi_p2vm_phase_correction(), gravi_wave_fit_2d(), and gravi_wave_test_image().

int gravi_region_get_tel ( cpl_table *  imaging_detector,
int  region,
int  beam 
)

Return the telescope id (0,1,2,3) in a beam of a region.

Parameters
imaging_detectorThe table IMAGING_DETECTOR
regionThe region to query
beamThe beam to query (0 or 1)

If REGNAME is 34-A-C, the function return 2 for beam 0 and 3 for beam 1 If REGNAME is 21-B-S, the function return 1 for beam 0 and 0 for beam 1 ...

Definition at line 512 of file gravi_utils.c.

Referenced by gravi_compute_profile().

double gravi_spectrum_get_flux ( const cpl_table *  table)

Return the total flux in DATA# regions.

Parameters
tableThe input table
Returns
The flux

Compute the total flux on DATA# regions by looping on regions and rows.

Definition at line 1042 of file gravi_utils.c.

Referenced by gravi_align_spectrum(), and gravi_extract_spectrum().

short gravi_sta_index ( int  gravi_input,
cpl_table *  optical_train_table,
cpl_table *  array_geometry_table 
)

Retrieve STA_INDEX corresponding to a given input.

Parameters
gravi_inputGRAVITY input index (1..4)
Returns
STA_INDEX

Definition at line 828 of file gravi_utils.c.

Referenced by gravi_compute_p2vmred().

cpl_table* gravi_table_oi_create ( int  nwave,
int  nrow,
const char *  oi_name 
)

Create the oi table (oi_vis, oi_vis2, oi_t3)

Parameters
nwaveThe size of the wavelength
nrowThe number of acquisitions or of the file using to compute the visibilities
oi_nameThe name of the table to create
Returns
The oi table needed with the number of acquisitions and size of the wavelength of each spectrum

The function returns a cpl_table

Definition at line 153 of file gravi_utils.c.

Referenced by gravi_compute_p2vmred(), gravi_compute_vis(), and gravi_p2vm_transmission().

int gravi_wave_get_nlambda ( cpl_table *  wave_data,
double  lambda_min,
double  lambda_max 
)

Get the number of spectral element between lambdamin et lambdamax.

Parameters
wave_tableThe table loaded from the IMAGING_DETECTOR field
lambda_minThe number of the first telescope
lambda_maxThe number of the second telescope
Returns
the number of spectral element

The function returns a integer

Definition at line 611 of file gravi_utils.c.

Referenced by gravi_create_oiwave_table_sc().