GRAVI Pipeline Reference Manual 1.9.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
Data handling functions

Data Structures

struct  _gravi_data_
 

Macros

#define GRAVI_DATA_SIZE   30
 

Functions

int gravi_data_is_oi_ext (cpl_propertylist *hdr)
 Check if EXTNAME starts with 'OI_' (OIFITS extension)
 
cpl_error_code gravi_data_check_savetypes (cpl_propertylist *hdr, cpl_table *oi_table)
 Set the savetypes of the OIFITS table.
 
int gravi_data_get_dark_pos (cpl_table *detector_table, int reg)
 retrun the position of the dark line on top of the region at x position
 
cpl_mask * gravi_data_create_bias_mask (cpl_table *detector_table, cpl_size nx, cpl_size ny)
 return a mask with pixel to be possibly illuminated
 
cpl_error_code gravi_remove_cosmicrays_sc (cpl_imagelist *imglist_sc)
 Remove cosmic rays via filtering through images.
 
gravi_datagravi_data_new (int nb_ext)
 Create an empty gravi_data.
 
void gravi_data_delete (gravi_data *self)
 Delete a gravi data.
 
gravi_datagravi_data_duplicate (const gravi_data *self)
 Create a copy of the gravi data.
 
cpl_error_code gravi_data_append (gravi_data *first, const gravi_data *second, int force)
 Append a gravi_data into another existing one.
 
gravi_datagravi_data_load (const char *filename)
 Low-level function to load FITS file.
 
gravi_datagravi_data_load_ext (const char *filename, const char *extensions_regexp)
 Low-level function to load FITS file.
 
cpl_error_code gravi_data_dump_mode (gravi_data *data)
 Dump some information about data in messagin.
 
gravi_datagravi_data_load_frame (cpl_frame *frame, cpl_frameset *used_frameset)
 Load a FITS file and create a gravi_data.
 
int gravi_data_patch (gravi_data *file_to_patch, cpl_frameset *patch_frameset)
 Load a RAW FITS file and create a gravi_data.
 
gravi_datagravi_data_load_rawframe (cpl_frame *frame, cpl_frameset *used_frameset)
 Load a RAW FITS file and create a gravi_data.
 
gravi_datagravi_data_load_rawframe_ext (cpl_frame *frame, cpl_frameset *used_frameset, const char *extensions_regexp)
 Load a RAW FITS file and create a gravi_data from specified extensions.
 
cpl_error_code gravi_data_dump (gravi_data *self)
 Dump the overall structure of a gravi_data in stdout.
 
int gravi_data_get_size (const gravi_data *self)
 Get the number of extension in a gravi_data.
 
cpl_error_code gravi_data_save_data (gravi_data *self, const char *filename, unsigned mode)
 Save a gravi data in a FITS file.
 
cpl_error_code gravi_data_save_new (gravi_data *self, cpl_frameset *allframes, const char *filename, const char *suffix, const cpl_parameterlist *parlist, cpl_frameset *usedframes, cpl_frame *frame, const char *recipe, cpl_propertylist *applist, const char *proCatg)
 Save a gravi data in a CPL-complian FITS file.
 
cpl_error_code gravi_data_detector_cleanup (gravi_data *data, const cpl_parameterlist *parlist)
 Perform self-bias correction to the SC raw data.
 
static int _gravi_data_find (const gravi_data *self, const char *name)
 
cpl_error_code gravi_data_copy_ext_insname (gravi_data *output, gravi_data *input, const char *name, const char *insname)
 Copy extensions from one data to another.
 
cpl_error_code gravi_data_copy_ext_i (gravi_data *output, gravi_data *input, cpl_size num)
 Copy extensions from one data to another.
 
cpl_error_code gravi_data_copy_ext (gravi_data *output, gravi_data *input, const char *name)
 Copy extensions from one data to another.
 
cpl_error_code gravi_data_move_ext (gravi_data *output, gravi_data *input, const char *name)
 Move extensions from one data to another.
 
int gravi_data_has_extension (gravi_data *raw_calib, const char *ext_name)
 Check if data has extension with given EXTNAME.
 
int gravi_data_has_type (gravi_data *self, const char *type)
 Return the number of ext whose EXTNAME and INSNAME match 'type'.
 
cpl_propertylist * gravi_data_get_plist_x (gravi_data *self, int i)
 Get the propertylist of an extension by position.
 
cpl_table * gravi_data_get_table_x (gravi_data *self, int i)
 Get the table of an extension by position.
 
cpl_imagelist * gravi_data_get_cube_x (gravi_data *self, int i)
 Get the cube of an extension by position.
 
cpl_table * gravi_data_get_oi_table (gravi_data *self, const char *extname, const char *insname)
 Get an OI_FITS table from EXTNAME and INSNAME.
 
cpl_propertylist * gravi_data_get_oi_plist (gravi_data *self, const char *extname, const char *insname)
 Get the propertylist from EXTNAME and INSNAME.
 
cpl_propertylist * gravi_data_get_plist (gravi_data *self, const char *extname)
 Get the propertylist from EXTNAME.
 
cpl_propertylist * gravi_data_get_extra_primary_header (gravi_data *self)
 Get the propertylist for additional keywords to the primary header.
 
cpl_table * gravi_data_get_table (gravi_data *self, const char *extname)
 Return a pointer on a table extension by its EXTNAME.
 
cpl_imagelist * gravi_data_get_cube (gravi_data *self, const char *extname)
 Return a pointer on an IMAGE extension by its EXTNAME.
 
cpl_error_code gravi_data_erase_x (gravi_data *self, int pos)
 Erase an extension by its position.
 
cpl_error_code gravi_data_erase (gravi_data *self, const char *extname)
 Erase an extension by its EXTNAME.
 
cpl_error_code gravi_data_erase_type (gravi_data *self, const char *type)
 Erase all extension related to an instrument (SC, FT, MET...)
 
cpl_error_code gravi_data_add_table (gravi_data *self, cpl_propertylist *plist, const char *extname, cpl_table *table)
 Add a BINTABLE extension in gravi_data.
 
cpl_error_code gravi_data_add_cube (gravi_data *self, cpl_propertylist *plist, const char *extname, cpl_imagelist *imglist)
 Add an IMAGE (imagelist) extension in gravi_data.
 
cpl_error_code gravi_data_add_img (gravi_data *self, cpl_propertylist *plist, const char *extname, cpl_image *image)
 Add an IMAGE (single image) extension in gravi_data.
 
cpl_error_code gravi_data_clean_for_astro (gravi_data *data)
 Clean the data to keep only OIFITS extensions related to SC.
 
cpl_error_code gravi_data_check_consistency (gravi_data *data)
 Verify the integrity of RAW data.
 
cpl_table ** gravi_data_get_oiwave_tables (gravi_data *data, int type_data, int npol)
 Get pointer to the OI_WAVELENGTH tables of both polarisations.
 

Detailed Description

This module implements the gravi data type. The type gravi_data is basically a structure of variables container which consists of type cpl_propertylist and cpl_table. The contents of the gravi_data structure is loaded from the FITS file so the property lists will be stocked in the first variable propertylist, and the tables associate at each property list will be stocked in the variable table. The fields are similar to ordinary cpl_propertylist and cpl_table variables so it can use all the features of these variables.

Macro Definition Documentation

◆ GRAVI_DATA_SIZE

#define GRAVI_DATA_SIZE   30

Definition at line 62 of file gravi_data.c.

Function Documentation

◆ _gravi_data_find()

static int _gravi_data_find ( const gravi_data self,
const char *  name 
)
inlinestatic

◆ gravi_data_add_cube()

cpl_error_code gravi_data_add_cube ( gravi_data self,
cpl_propertylist *  plist,
const char *  extname,
cpl_imagelist *  imglist 
)

Add an IMAGE (imagelist) extension in gravi_data.

Parameters
selfThe gravi_data to insert in
plistThe (optional) plist to associate, not duplicated
extnameThe (optional) EXTNAME
imglistThe imagelist to insert, not duplicated

The image and its associated plist are append into the gravi_data, without duplication (image and plist shall not be deleted).

Definition at line 2353 of file gravi_data.c.

References CPLCHECK_MSG, and plist.

Referenced by gravi_compute_flat_badpix(), gravi_compute_wave_offset(), gravi_data_copy_ext(), gravi_data_copy_ext_i(), gravi_data_copy_ext_insname(), gravi_data_move_ext(), gravi_fit_argon(), gravi_preproc_acqcam(), and gravi_wave_qc().

◆ gravi_data_add_img()

cpl_error_code gravi_data_add_img ( gravi_data self,
cpl_propertylist *  plist,
const char *  extname,
cpl_image *  image 
)

Add an IMAGE (single image) extension in gravi_data.

Parameters
selfThe gravi_data to insert in
plistThe (optional) plist to associate, not duplicated
extnameThe (optional) EXTNAME
imageThe image to insert, not duplicated

The image and its associated plist are append into the gravi_data, without duplication (image and plist shall not be deleted).

Definition at line 2394 of file gravi_data.c.

References CPLCHECK_MSG, and plist.

Referenced by gravi_compute_badpix(), gravi_compute_biasmask(), gravi_compute_dark(), gravi_compute_profile(), gravi_data_detector_cleanup(), and gravi_reduce_acqcam().

◆ gravi_data_add_table()

cpl_error_code gravi_data_add_table ( gravi_data self,
cpl_propertylist *  plist,
const char *  extname,
cpl_table *  table 
)

◆ gravi_data_append()

cpl_error_code gravi_data_append ( gravi_data first,
const gravi_data second,
int  force 
)

Append a gravi_data into another existing one.

Parameters
firstthe main gravi_data (will grow)
secondthe gravi_data to append to first
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing
CPL_ERROR_INCOMPATIBLE_INPUTThis extension of the input data are not compatible

The function only works for OIFITS so far. The function skips some table that shall not be merged (OI_ARRAY, OI_WAVELENGTH, OI_TARGET...). It appends the table extension and the image extension by duplicating the data (second may be properly deallocated).

Definition at line 308 of file gravi_data.c.

References cpl_msg_info(), CPLCHECK_MSG, gravi_data_copy_ext_i(), gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_extname(), and gravi_table_are_equal().

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

◆ gravi_data_check_consistency()

cpl_error_code gravi_data_check_consistency ( gravi_data data)

Verify the integrity of RAW data.

Parameters
dataRAW data to verify

Check the consistency of table in the data, by looking at the temporal coverage of the real-time signals METROLOGY, OPDC, FT... (shall encompass the science), and the steps between consecutive frames in these real-time signals (shall be constant).

Definition at line 2531 of file gravi_data.c.

References cpl_msg_debug(), CPLCHECK_MSG, FREE, gravi_data_get_header, gravi_data_get_plist(), gravi_data_get_table(), gravi_data_has_extension(), gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_add_check(), gravi_pfits_get_dit_sc(), gravi_pfits_get_time_sc(), header, and plist.

Referenced by gravi_data_load_rawframe().

◆ gravi_data_check_savetypes()

cpl_error_code gravi_data_check_savetypes ( cpl_propertylist *  hdr,
cpl_table *  oi_table 
)

Set the savetypes of the OIFITS table.

Parameters
hdrproperty list of the table, to check it is an OIFITS table
oi_tablethe OIFITS table to verify
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing
CPL_ERROR_ILLEGAL_INPUTCannot reinstall the savetypes

Ensure the FLAG columns are saved as BOOL, the STA_INDEX are saved as SHORT, the TARGET_ID are saved as SHORT and the MNT_STA are saved as SHORT. This is to follow properly the OIFITS standard.

Definition at line 198 of file gravi_data.c.

References gravi_data_is_oi_ext().

Referenced by gravi_data_add_table(), gravi_data_duplicate(), gravi_data_load(), and gravi_data_load_ext().

◆ gravi_data_clean_for_astro()

cpl_error_code gravi_data_clean_for_astro ( gravi_data data)

Clean the data to keep only OIFITS extensions related to SC.

Parameters
selfThe gravi data to be cleaned in-place

Remove all tables not related to SC. That is keep: OI_ARRAY, OI_TARGET, and keep OI_WAVELENGTH, OI_VIS, OI_VIS2, OI_T3, OI_FLUX whose INSNAME is the SC.

Definition at line 2435 of file gravi_data.c.

References cpl_msg_debug(), cpl_msg_info(), CPLCHECK_MSG, FREE, gravi_data_add_table(), gravi_data_get_plist_x(), gravi_data_get_size(), gravi_data_get_table_x(), gravi_msg_function_exit, gravi_msg_function_start, GRAVI_OI_ARRAY_EXT, GRAVI_OI_TARGET_EXT, GRAVI_OI_VIS_ACQ_EXT, GRAVI_OI_VIS_MET_EXT, GRAVI_OI_WAVELENGTH_EXT, gravi_pfits_get_extname(), gravi_pfits_get_insname(), INSNAME_ACQ, INSNAME_SC, INSNAME_SC_P1, INSNAME_SC_P2, and plist.

Referenced by gravity_disp(), and gravity_vis().

◆ gravi_data_copy_ext()

cpl_error_code gravi_data_copy_ext ( gravi_data output,
gravi_data input,
const char *  name 
)

Copy extensions from one data to another.

Parameters
outputgravi_data to insert the extension
inputgravi_data to read the extension
nameEXTNAME of the extension to copy

Deep copy of the extension NAME from input to output Copy all if several extension with same EXTNAME are found. Silent if the copy cannot be done.

Definition at line 1690 of file gravi_data.c.

References CPLCHECK_MSG, gravi_data_add_cube(), gravi_data_add_table(), gravi_data_get_cube_x(), gravi_data_get_plist_x(), gravi_data_get_size(), gravi_data_get_table_x(), gravi_pfits_get_extension_type(), gravi_pfits_get_extname(), and plist.

Referenced by gravi_align_spectrum(), gravi_compute_badpix(), gravi_compute_biasmask(), gravi_compute_dark(), gravi_compute_p2vmred(), gravi_compute_piezotf(), gravi_compute_profile(), gravi_compute_vis(), gravi_compute_wave(), gravi_create_p2vm(), gravi_extract_spectrum(), gravity_disp(), gravity_p2vm(), and gravity_wavelamp().

◆ gravi_data_copy_ext_i()

cpl_error_code gravi_data_copy_ext_i ( gravi_data output,
gravi_data input,
cpl_size  num 
)

Copy extensions from one data to another.

Parameters
outputgravi_data to insert the extension
inputgravi_data to read the extension
numnum to copy

Deep copy of the extension NAME from input to output Copy all if several extension with same EXTNAME are found. Silent if the copy cannot be done.

Definition at line 1647 of file gravi_data.c.

References CPLCHECK_MSG, gravi_data_add_cube(), gravi_data_add_table(), gravi_data_get_cube_x(), gravi_data_get_plist_x(), gravi_data_get_table_x(), gravi_pfits_get_extension_type(), and plist.

Referenced by gravi_data_append().

◆ gravi_data_copy_ext_insname()

cpl_error_code gravi_data_copy_ext_insname ( gravi_data output,
gravi_data input,
const char *  name,
const char *  insname 
)

Copy extensions from one data to another.

Parameters
outputgravi_data to insert the extension
inputgravi_data to read the extension
nameEXTNAME of the extension to copy
insnameINSNAME of the extension to copy

Deep copy of the extension NAME from input to output Copy all if several extension with same EXTNAME are found. Silent if the copy cannot be done.

Definition at line 1587 of file gravi_data.c.

References CPLCHECK_MSG, gravi_data_add_cube(), gravi_data_add_table(), gravi_data_get_cube_x(), gravi_data_get_plist_x(), gravi_data_get_size(), gravi_data_get_table_x(), gravi_pfits_get_extension_type(), gravi_pfits_get_extname(), gravi_pfits_get_insname(), and plist.

Referenced by gravity_vis(), and gravity_vis_from_p2vmred().

◆ gravi_data_create_bias_mask()

cpl_mask * gravi_data_create_bias_mask ( cpl_table *  detector_table,
cpl_size  nx,
cpl_size  ny 
)

return a mask with pixel to be possibly illuminated

Parameters
detector_tablecpl_table containing extension IMAGING_DETECTOR_TABLE
nxsize of image
nysize of image

Return a mask with 1 where the pixels are illumated with the spectra, according to the information in DETECTOR_TABLE, and 0 if the pixels are not illuminated.

Returned mask should be desallocated with cpl_mask_delete

Definition at line 1131 of file gravi_data.c.

References cpl_msg_info(), CPLCHECK_NUL, FREE, gravi_msg_function_exit, gravi_msg_function_start, and gravi_table_get_value.

Referenced by gravi_data_detector_cleanup().

◆ gravi_data_delete()

void gravi_data_delete ( gravi_data self)

Delete a gravi data.

Parameters
selfThe gravi data to delete.

The function destroys a gravi data of any kind. All the members including their values are properly deallocated. If the gravi data self is NULL, nothing is done and no error is set.

Definition at line 146 of file gravi_data.c.

References FREE, FREELOOP, GRAVI_DATA_SIZE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_tf(), gravi_compute_tf_qc(), gravi_data_load(), gravi_data_load_ext(), gravi_data_save_data(), gravi_fit_argon(), gravity_badpix(), gravity_biasmask(), gravity_dark(), gravity_disp(), gravity_image(), gravity_p2vm(), gravity_pcacal(), gravity_piezo(), gravity_postprocess(), gravity_vis(), gravity_vis_from_p2vmred(), gravity_viscal(), gravity_wavelamp(), and load_data().

◆ gravi_data_detector_cleanup()

cpl_error_code gravi_data_detector_cleanup ( gravi_data data,
const cpl_parameterlist *  parlist 
)

Perform self-bias correction to the SC raw data.

Parameters
datagravi_data to be processed (in-place).
parlistparameter list with :
  • bias-method : Method to average the biaspixels when cleaning-up the SC detector (only applied to MED and LOW). Ideally the same value shall be used when reducing the DARK with gravity_dark and the OBJECT with gravity_vis. <MEDIAN | MEDIAN_PER_COLUMN | MASKED_MEDIAN_PER_COLUMN> [MEDIAN]

This function applies the self bias-pixel correction to the IMAGING_DATA_SC images, in-place. The bias is estimated independently for each image in the imagelist (DIT). It is the median of the bias-pixel, whose location depend on the spectral setup (HIGH has bias-column, while MED and LOW have bias-lines). The functions add QC paramter to recover the mean subtracted bias.

Definition at line 1232 of file gravi_data.c.

References cpl_image_delete(), cpl_msg_info(), cpl_propertylist_update_double(), CPLCHECK_MSG, FREE, gravi_data_add_img(), gravi_data_create_bias_mask(), gravi_data_get_cube(), gravi_data_get_dark_pos(), gravi_data_get_header, gravi_data_get_table(), gravi_image_subtract_collapse(), GRAVI_IMAGING_DATA_SC_EXT, GRAVI_IMAGING_DETECTOR_SC_EXT, gravi_msg_function_exit, gravi_msg_function_start, gravi_msg_warning(), gravi_param_get_bool_default(), gravi_param_get_string_default(), gravi_pfits_get_resolution(), gravi_remove_cosmicrays_sc(), gravi_vector_get_mean_clip(), and header.

Referenced by gravity_biasmask(), gravity_dark(), gravity_disp(), gravity_p2vm(), gravity_vis(), and gravity_wavelamp().

◆ gravi_data_dump()

cpl_error_code gravi_data_dump ( gravi_data self)

Dump the overall structure of a gravi_data in stdout.

Parameters
self: gravi_data to dump
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

Definition at line 796 of file gravi_data.c.

References cpl_msg_info(), and gravi_pfits_get_extname().

◆ gravi_data_dump_mode()

cpl_error_code gravi_data_dump_mode ( gravi_data data)

Dump some information about data in messagin.

Parameters
dataThe gravi data to dump
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

If the information is missing, the function does nothing and return successfuly.

Definition at line 565 of file gravi_data.c.

References cpl_msg_info(), gravi_data_get_header, GRAVI_FT, gravi_pfits_get_pola_mode(), gravi_pfits_get_spec_res(), GRAVI_SC, and header.

Referenced by gravi_data_load_frame(), gravi_data_load_rawframe(), and gravi_data_load_rawframe_ext().

◆ gravi_data_duplicate()

gravi_data * gravi_data_duplicate ( const gravi_data self)

Create a copy of the gravi data.

Parameters
selfThe gravi data to duplicate.
Returns
The copy of self.
Exceptions
CPL_ERROR_NULL_INPUTinput data is missing

The function returns a copy of the gravi data self. The copy is a deep copy, i.e. all fields members are copied. I return NULL in case of an error. In the latter case an appropriate error code is set.

Definition at line 250 of file gravi_data.c.

References CPLCHECK_NUL, gravi_data_check_savetypes(), gravi_data_new(), gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_average_dark(), gravi_calibrate_vis(), gravi_compute_tf(), gravi_compute_zp(), and gravity_viscal().

◆ gravi_data_erase()

cpl_error_code gravi_data_erase ( gravi_data self,
const char *  extname 
)

Erase an extension by its EXTNAME.

Parameters
selfThe gravi_data to manipulate in-place
nameThe string to search

The function erases the first (and only the first) extension whose EXTNAME exactly matches name.

Definition at line 2212 of file gravi_data.c.

References _gravi_data_find(), cpl_msg_info(), CPLCHECK_MSG, and gravi_data_erase_x().

Referenced by gravity_dark().

◆ gravi_data_erase_type()

cpl_error_code gravi_data_erase_type ( gravi_data self,
const char *  type 
)

Erase all extension related to an instrument (SC, FT, MET...)

Parameters
selfThe gravi_data to manipulate in-place
typeThe string to search ("SC", "FT", "MET"...)

The function erases all extension whose INSNAME or EXTNAME parameters could be matched to type.

Definition at line 2247 of file gravi_data.c.

References cpl_msg_info(), CPLCHECK_MSG, gravi_data_erase_x(), gravi_data_get_plist_x(), gravi_data_get_size(), gravi_pfits_get_extname(), gravi_pfits_get_insname(), and plist.

Referenced by gravity_postprocess().

◆ gravi_data_erase_x()

cpl_error_code gravi_data_erase_x ( gravi_data self,
int  pos 
)

Erase an extension by its position.

Parameters
selfThe gravi_data to manipulate in-place
posThe extension to delete

The function erases the extension in position pos.

Definition at line 2161 of file gravi_data.c.

References CPLCHECK_MSG, FREE, GRAVI_DATA_SIZE, and gravi_pfits_get_extension_type().

Referenced by gravi_data_erase(), and gravi_data_erase_type().

◆ gravi_data_get_cube()

cpl_imagelist * gravi_data_get_cube ( gravi_data self,
const char *  extname 
)

Return a pointer on an IMAGE extension by its EXTNAME.

Parameters
selfThe gravi data to search in.
nameThe EXTNAME to search
Returns
A pointer to the imagelist, or NULL.

The function returns a pointer to the imagelist with name name, or NULL if it does not exist or is not a IMAGE.

Note
The returned imagelist is still owned by the gravi data set, i.e. the obtained table must not be deleted through the returned pointer.

Definition at line 2131 of file gravi_data.c.

References _gravi_data_find(), and gravi_pfits_get_extension_type().

Referenced by gravi_compute_badpix(), gravi_compute_biasmask(), gravi_compute_dark(), gravi_compute_flat_badpix(), gravi_compute_gain(), gravi_compute_profile(), gravi_compute_wave_offset(), gravi_data_detector_cleanup(), gravi_extract_spectrum(), gravi_fit_argon(), gravi_preproc_acqcam(), gravi_reduce_acqcam(), and gravity_wavelamp().

◆ gravi_data_get_cube_x()

cpl_imagelist * gravi_data_get_cube_x ( gravi_data self,
int  i 
)

Get the cube of an extension by position.

Parameters
selfThe gravi data to search in.
iThe selected extension
Returns
The requested imglist, or NULL on error.

The function returns a pointer to the imglist corresponding to the extension i, or NULL on error or if the extension is not a imaglist. The returned imglist is still owned by the gravi_data, i.e. it must not be deleted through the returned pointer.

Definition at line 1926 of file gravi_data.c.

Referenced by gravi_data_copy_ext(), gravi_data_copy_ext_i(), gravi_data_copy_ext_insname(), and gravi_data_move_ext().

◆ gravi_data_get_dark_pos()

int gravi_data_get_dark_pos ( cpl_table *  detector_table,
int  reg 
)

retrun the position of the dark line on top of the region at x position

Parameters
detector_tablecpl_table containing extension IMAGING_DETECTOR_TABLE
regregion index (start to 0)
xx position on the detector

This function return the central position of the dark line on top of the given region at x position

Definition at line 1102 of file gravi_data.c.

References gravi_table_get_value.

Referenced by gravi_data_detector_cleanup().

◆ gravi_data_get_extra_primary_header()

cpl_propertylist * gravi_data_get_extra_primary_header ( gravi_data self)

Get the propertylist for additional keywords to the primary header.

Parameters
selfThe gravi data to search in.
Returns
The requested propertylist, or NULL on error.

Definition at line 2074 of file gravi_data.c.

Referenced by gravi_compute_vis_qc(), and gravity_viscal().

◆ gravi_data_get_oi_plist()

cpl_propertylist * gravi_data_get_oi_plist ( gravi_data self,
const char *  extname,
const char *  insname 
)

Get the propertylist from EXTNAME and INSNAME.

Parameters
selfThe gravi data to search in.
extnameThe requested EXTNAME
insnameThe requested INSNAME
Returns
The requested propertylist, or NULL on error.

The function returns a pointer to the first propertylist corresponding to the extension with the requested INSNAME and EXTNAME. The returned pointer is still owned by the gravi_data, i.e. it must not be deleted.

Definition at line 2001 of file gravi_data.c.

References gravi_pfits_get_extname(), and gravi_pfits_get_insname().

Referenced by gravi_compute_disp_old().

◆ gravi_data_get_oi_table()

cpl_table * gravi_data_get_oi_table ( gravi_data self,
const char *  extname,
const char *  insname 
)

Get an OI_FITS table from EXTNAME and INSNAME.

Parameters
selfThe gravi data to search in.
extnameThe requested EXTNAME
insnameThe requested INSNAME
Returns
The requested table, or NULL on error.

The function returns a pointer to the table corresponding to the extension with the requested INSNAME and EXTNAME. The returned table is still owned by the gravi_data, i.e. it must not be deleted through the returned pointer.

Definition at line 1952 of file gravi_data.c.

References gravi_pfits_get_extname(), and gravi_pfits_get_insname().

Referenced by gravi_apply_tf_amp(), gravi_apply_tf_phi(), gravi_calibrate_vis(), gravi_compute_disp_old(), and gravi_lazer_get_wavelength().

◆ gravi_data_get_oiwave_tables()

cpl_table ** gravi_data_get_oiwave_tables ( gravi_data data,
int  type_data,
int  npol 
)

Get pointer to the OI_WAVELENGTH tables of both polarisations.

Parameters
dataInput gravi_data
type_dataGRAVI_SC or GRAVI_FT
npolNumber of polarisation in data (1 or 2)
Returns
A pointer to the one or two OI_WAVELENGHT table

The routine allocate memory for 1 or 2 pointers on the tables. Thus the return value shall be desallocated with cpl_free

Definition at line 2664 of file gravi_data.c.

References gravi_data_get_oi_wave, GRAVI_FT, and GRAVI_SC.

Referenced by gravi_align_spectrum(), and gravi_compute_p2vm().

◆ gravi_data_get_plist()

cpl_propertylist * gravi_data_get_plist ( gravi_data self,
const char *  extname 
)

Get the propertylist from EXTNAME.

Parameters
selfThe gravi data to search in.
extnameThe requested EXTNAME
Returns
The requested propertylist, or NULL on error.

The function returns a pointer to the first propertylist corresponding to the extension with the requested EXTNAME. The propertylist of the main HEADER can be requested with extname = GRAVI_PRIMARY_HDR_EXT The returned pointer is still owned by the gravi_data, i.e. it must not be deleted.

Definition at line 2049 of file gravi_data.c.

References _gravi_data_find(), and GRAVI_PRIMARY_HDR_EXT.

Referenced by gravi_acqcam_field(), gravi_acqcam_z2meter(), gravi_compute_dark(), gravi_compute_disp_old(), gravi_compute_flat_badpix(), gravi_compute_p2vmred(), gravi_compute_wave_offset(), gravi_create_oiwave_table_sc(), gravi_data_check_consistency(), gravi_data_compare(), gravi_data_mean_metFddl(), gravi_extract_spectrum(), gravi_fit_argon(), gravi_flatten_vis(), gravi_wave_fit_2d(), gravi_wave_qc(), and gravity_pcacal().

◆ gravi_data_get_plist_x()

cpl_propertylist * gravi_data_get_plist_x ( gravi_data self,
int  i 
)

Get the propertylist of an extension by position.

Parameters
selfThe gravi data to search in.
iThe selected extension
Returns
The requested property list, or NULL on error.

The function returns a pointer to the property list corresponding to the extension i. The returned propertylist is still owned by self, i.e. it must not be deleted through the returned pointer.

Definition at line 1876 of file gravi_data.c.

Referenced by gravi_compute_wave_offset(), gravi_data_clean_for_astro(), gravi_data_compare(), gravi_data_copy_ext(), gravi_data_copy_ext_i(), gravi_data_copy_ext_insname(), gravi_data_erase_type(), gravi_data_has_type(), gravi_data_move_ext(), gravi_data_patch(), gravi_fit_argon(), and gravi_vis_mjd_to_time().

◆ gravi_data_get_size()

int gravi_data_get_size ( const gravi_data self)

Get the number of extension in a gravi_data.

Parameters
selfThe input gravi_data.
Returns
The gravi data's current size, or 0 if the structure is empty.
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

Definition at line 828 of file gravi_data.c.

Referenced by gravi_compute_wave_offset(), gravi_data_clean_for_astro(), gravi_data_compare(), gravi_data_copy_ext(), gravi_data_copy_ext_insname(), gravi_data_erase_type(), gravi_data_has_type(), gravi_data_move_ext(), gravi_fit_argon(), gravi_vis_force_time(), and gravi_vis_mjd_to_time().

◆ gravi_data_get_table()

cpl_table * gravi_data_get_table ( gravi_data self,
const char *  extname 
)

Return a pointer on a table extension by its EXTNAME.

Parameters
selfThe gravi data to search in.
nameThe EXTNAME to search
Returns
A pointer to the table, or NULL.

The function returns a pointer to the table with name name, or NULL if it does not exist or is not a bintable.

Note
The returned table is still owned by the gravi data set, i.e. the obtained table must not be deleted through the returned handle.

Definition at line 2096 of file gravi_data.c.

References _gravi_data_find(), and gravi_pfits_get_extension_type().

Referenced by gravi_acqcam_field(), gravi_align_spectrum(), gravi_average_dark(), gravi_compute_argon_pos(), gravi_compute_badpix(), gravi_compute_dark(), gravi_compute_disp(), gravi_compute_disp_old(), gravi_compute_flat_badpix(), gravi_compute_gain(), gravi_compute_opdc_state(), gravi_compute_p2vmred(), gravi_compute_piezotf(), gravi_compute_pointing_uv(), gravi_compute_profile(), gravi_compute_qc_ft_opd_estimator(), gravi_compute_signals(), gravi_compute_tau0(), gravi_compute_tf(), gravi_compute_vis(), gravi_compute_wave(), gravi_compute_wave_offset(), gravi_create_oiwave_table_sc(), gravi_data_check_consistency(), gravi_data_detector_cleanup(), gravi_data_mean_metFddl(), gravi_extract_spectrum(), gravi_fit_argon(), gravi_flatten_vis(), gravi_idp_compute(), gravi_lazer_get_wavelength(), gravi_metrology_demodulate(), gravi_metrology_get_astig(), gravi_metrology_get_fc_focus(), gravi_metrology_get_fc_shift(), gravi_metrology_reduce(), gravi_smooth_preproc(), gravi_subtract_met_dark(), gravi_wave_qc(), gravity_image(), gravity_p2vm(), gravity_pcacal(), and gravity_wavelamp().

◆ gravi_data_get_table_x()

cpl_table * gravi_data_get_table_x ( gravi_data self,
int  i 
)

Get the table of an extension by position.

Parameters
selfThe gravi data to search in.
iThe selected extension
Returns
The requested table, or NULL on error.

The function returns a pointer to the table corresponding to the extension i, or NULL on error or if the extension is not a table. The returned table is still owned by the gravi_data set, i.e. it must not be deleted through the returned pointer.

Definition at line 1901 of file gravi_data.c.

Referenced by gravi_compute_pointing_uv(), gravi_compute_tf(), gravi_data_clean_for_astro(), gravi_data_compare(), gravi_data_copy_ext(), gravi_data_copy_ext_i(), gravi_data_copy_ext_insname(), gravi_data_move_ext(), gravi_metrology_reduce(), gravi_vis_force_time(), and gravi_vis_mjd_to_time().

◆ gravi_data_has_extension()

int gravi_data_has_extension ( gravi_data raw_calib,
const char *  ext_name 
)

Check if data has extension with given EXTNAME.

Parameters
raw_calibgravi_data to search in
ext_namename of the extension to check
Returns
1 if extension exists, 0 otherwise.

Definition at line 1808 of file gravi_data.c.

References _gravi_data_find(), and test.

Referenced by gravi_compute_badpix(), gravi_compute_dark(), gravi_compute_gain(), gravi_compute_p2vmred(), gravi_compute_profile(), gravi_compute_signals(), gravi_data_check_consistency(), gravi_idp_compute(), gravi_metrology_get_astig(), gravi_metrology_reduce(), gravi_preproc_acqcam(), gravi_reduce_acqcam(), and gravi_subtract_met_dark().

◆ gravi_data_has_type()

int gravi_data_has_type ( gravi_data self,
const char *  type 
)

Return the number of ext whose EXTNAME and INSNAME match 'type'.

Parameters
selfgravi_data to search in
typename to search (ex: "_SC", "_FT", "METROLOGY")
Returns
The number of extension matching

Definition at line 1833 of file gravi_data.c.

References cpl_msg_debug(), gravi_data_get_plist_x(), gravi_data_get_size(), gravi_pfits_get_extname(), gravi_pfits_get_insname(), and plist.

Referenced by gravi_average_vis(), gravi_compute_rejection(), gravi_compute_snr(), gravi_compute_vis(), gravi_compute_vis_qc(), and gravi_vis_copy_fluxdata().

◆ gravi_data_is_oi_ext()

int gravi_data_is_oi_ext ( cpl_propertylist *  hdr)

Check if EXTNAME starts with 'OI_' (OIFITS extension)

Definition at line 174 of file gravi_data.c.

References gravi_pfits_get_extname().

Referenced by gravi_data_check_savetypes().

◆ gravi_data_load()

gravi_data * gravi_data_load ( const char *  filename)

Low-level function to load FITS file.

Parameters
filenameName of the input file.
Returns
The newly created gravi data or NULL if an error occurred.
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

The function returns a gravi data created by reading the FITS file. Currently only the FITS file format is supported. All the gravi data memory members are allocated.

Definition at line 402 of file gravi_data.c.

References cpl_msg_debug(), CPLCHECK_NUL, FREE, gravi_data_check_savetypes(), gravi_data_delete(), gravi_data_new(), gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_extension_type(), and header.

Referenced by gravi_data_load_frame(), and gravi_data_load_rawframe().

◆ gravi_data_load_ext()

gravi_data * gravi_data_load_ext ( const char *  filename,
const char *  extensions_regexp 
)

Low-level function to load FITS file.

Parameters
filenameName of the input file.
extensions_regexpExtensions to load
Returns
The newly created gravi data or NULL if an error occurred.
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing
CPL_ERROR_ILLEGAL_INPUTextensions_regexp cannot be interpreted

The function returns a gravi data created by reading the FITS file. Only the extension names that match the regular expression in extensions_regexp parameter are actually loaded Currently only the FITS file format is supported. All the gravi data memory members are allocated.

Definition at line 474 of file gravi_data.c.

References cpl_msg_debug(), CPLCHECK_NUL, FREE, gravi_data_check_savetypes(), gravi_data_delete(), gravi_data_new(), gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_extension_type(), and header.

Referenced by gravi_data_load_rawframe_ext(), and gravity_image().

◆ gravi_data_load_frame()

gravi_data * gravi_data_load_frame ( cpl_frame *  frame,
cpl_frameset *  used_frameset 
)

Load a FITS file and create a gravi_data.

Parameters
filenameName of the input file.
used_framesetIf not NULL, this frameset is append with frame
Returns
gravi_data
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

Load and create a gravi data type from input frame.

Definition at line 599 of file gravi_data.c.

References cpl_msg_info(), CPLCHECK_NUL, FILESHORT, gravi_data_dump_mode(), and gravi_data_load().

Referenced by gravity_disp(), gravity_p2vm(), gravity_pcacal(), gravity_postprocess(), gravity_vis(), gravity_vis_from_p2vmred(), gravity_viscal(), gravity_wavelamp(), and load_data().

◆ gravi_data_load_rawframe()

gravi_data * gravi_data_load_rawframe ( cpl_frame *  frame,
cpl_frameset *  used_frameset 
)

Load a RAW FITS file and create a gravi_data.

Parameters
filenameName of the input file.
used_framesetIf not NULL, this frameset is append with frame
Returns
gravi_data
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

Load and create a gravi data type from input RAW frame. Data integrity is verified.

Definition at line 716 of file gravi_data.c.

References cpl_msg_info(), CPLCHECK_NUL, FILESHORT, gravi_data_check_consistency(), gravi_data_dump_mode(), and gravi_data_load().

Referenced by gravity_badpix(), gravity_biasmask(), gravity_dark(), gravity_disp(), gravity_p2vm(), gravity_piezo(), gravity_vis(), and gravity_wavelamp().

◆ gravi_data_load_rawframe_ext()

gravi_data * gravi_data_load_rawframe_ext ( cpl_frame *  frame,
cpl_frameset *  used_frameset,
const char *  extensions_regexp 
)

Load a RAW FITS file and create a gravi_data from specified extensions.

Parameters
filenameName of the input file.
used_framesetIf not NULL, this frameset is append with frame
extensions_regexpRegular expression with extensions to load
Returns
gravi_data
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

Load and create a gravi data type from input RAW frame. Only the extensions specified by the regular expression are loaded into the gravi_data struct.

Definition at line 760 of file gravi_data.c.

References cpl_msg_info(), CPLCHECK_NUL, FILESHORT, gravi_data_dump_mode(), and gravi_data_load_ext().

Referenced by gravity_p2vm().

◆ gravi_data_move_ext()

cpl_error_code gravi_data_move_ext ( gravi_data output,
gravi_data input,
const char *  name 
)

Move extensions from one data to another.

Parameters
outputgravi_data to insert the extension
inputgravi_data to remove the extension
nameEXTNAME of the extension to move

Move the extension NAME from input to output Move all if several extension with same EXTNAME are found. Silent if no move could be done.

Definition at line 1741 of file gravi_data.c.

References cpl_msg_info(), CPLCHECK_MSG, gravi_data_add_cube(), gravi_data_add_table(), gravi_data_get_cube_x(), gravi_data_get_plist_x(), gravi_data_get_size(), gravi_data_get_table_x(), GRAVI_DATA_SIZE, gravi_msg_function_exit, gravi_msg_function_start, gravi_pfits_get_extension_type(), gravi_pfits_get_extname(), and plist.

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

◆ gravi_data_new()

gravi_data * gravi_data_new ( int  nb_ext)

Create an empty gravi_data.

Parameters
nb_extmust be greater than 0
Returns
The newly created gravi_data type.
Exceptions
CPL_ERROR_ILLEGAL_INPUTis 0

The function allocates memory for a gravi_data. The returned gravi_data must be deleted using the destructor gravi_data_delete(). The allocated structure can contain up to GRAVI_DATA_SIZE extension, which with its own header (propertylist). The extensions can be IMAGE or BINTABLE.

Definition at line 110 of file gravi_data.c.

References GRAVI_DATA_SIZE, gravi_msg_function_exit, and gravi_msg_function_start.

Referenced by gravi_compute_badpix(), gravi_compute_biasmask(), gravi_compute_dark(), gravi_compute_disp(), gravi_compute_disp_old(), gravi_compute_p2vmred(), gravi_compute_pca(), gravi_compute_piezotf(), gravi_compute_profile(), gravi_compute_vis(), gravi_compute_wave_offset(), gravi_create_p2vm(), gravi_data_duplicate(), gravi_data_load(), gravi_data_load_ext(), gravi_eop_load_finals2000A(), gravi_extract_spectrum(), gravi_fit_argon(), gravi_visdata_fromellipse(), gravity_p2vm(), and gravity_wavelamp().

◆ gravi_data_patch()

int gravi_data_patch ( gravi_data file_to_patch,
cpl_frameset *  patch_frameset 
)

Load a RAW FITS file and create a gravi_data.

Parameters
filenameName of the input file.
used_framesetIf not NULL, this frameset is append with frame
Returns
gravi_data
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

Load and create a gravi data type from input RAW frame. Data integrity is verified.

Definition at line 635 of file gravi_data.c.

References cpl_msg_info(), cpl_propertylist_update_double(), CPLCHECK_INT, FILESHORT, FREE, and gravi_data_get_plist_x().

Referenced by gravity_vis().

◆ gravi_data_save_data()

cpl_error_code gravi_data_save_data ( gravi_data self,
const char *  filename,
unsigned  mode 
)

Save a gravi data in a FITS file.

Parameters
selfThe gravi data to save or NULL if empty
filenameName of the file to write
modeThe desired output options (combined with bitwise or)
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing
CPL_ERROR_ILLEGAL_INPUTUnknown type of one extension

This function saves a gravi data to a FITS file, using cfitsio and save all the tables members with its properties list. Supported output modes are CPL_IO_CREATE (create a new file) and CPL_IO_EXTEND (append to an existing file).

This is a low-level routine, which does not provide a CPL compliant product (see gravi_data_save_new).

Definition at line 856 of file gravi_data.c.

References cpl_table_save(), gravi_data_delete(), and gravi_pfits_get_extension_type().

◆ gravi_data_save_new()

cpl_error_code gravi_data_save_new ( gravi_data self,
cpl_frameset *  allframes,
const char *  filename,
const char *  suffix,
const cpl_parameterlist *  parlist,
cpl_frameset *  usedframes,
cpl_frame *  frame,
const char *  recipe,
cpl_propertylist *  applist,
const char *  proCatg 
)

Save a gravi data in a CPL-complian FITS file.

Parameters
selfThe gravi data to save or NULL if empty
allframesThe list of input frames for the recipe
filenameFilename, or build from frame and proCatg if NULL
suffixIf the filename is constructed from the recipe and pro_catg, add _suffix to it. Nothing added if NULL
parlistInput parameter list with :
  • static-name : Use static names for the products (for ESO)
usedframesThe list of raw/calibration frames used for this product
frameThe reference frame to build the header
recipeThe recipe name
applistOptional propertylist to append to primary header or NULL
proCatgOptional string coding the PRO.CATG
Exceptions
CPL_ERROR_NULL_INPUTInput data is missing

Definition at line 925 of file gravi_data.c.

References cpl_msg_info(), cpl_table_save(), CPLCHECK_MSG, FILESHORT, FREE, gravi_data_get_header, gravi_data_get_qc, gravi_msg_function_exit, gravi_msg_function_start, GRAVI_NIGHT_OBS, gravi_param_get_bool(), gravi_pfits_add_pipe_build(), and gravi_plist_get_oifits_keywords().

Referenced by gravity_astrometry(), gravity_badpix(), gravity_biasmask(), gravity_dark(), gravity_disp(), gravity_p2vm(), gravity_pcacal(), gravity_piezo(), gravity_postprocess(), gravity_vis(), gravity_vis_from_p2vmred(), gravity_viscal(), and gravity_wavelamp().

◆ gravi_remove_cosmicrays_sc()

cpl_error_code gravi_remove_cosmicrays_sc ( cpl_imagelist *  imglist_sc)

Remove cosmic rays via filtering through images.

Parameters
imglist_scinput data as imglist, remove inplace

IMPORTANT: Use this function AFTER bad pixel removal. Cosmic ray hits are identified as outliers when they are more than 5 times the median absolute deviation from the median computed across the list of images. This is evaluated on a pixel-by-pixel basis. CR pixels are interpolated along the row of an image.

Definition at line 2661 of file gravi_calib.c.

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

Referenced by gravi_data_detector_cleanup().