GRAVI Pipeline Reference Manual  1.2.3
Functions
Data handling functions

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. More...
 
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 More...
 
gravi_data * gravi_data_new (int nb_ext)
 Create an empty gravi_data. More...
 
void gravi_data_delete (gravi_data *self)
 Delete a gravi data. More...
 
gravi_data * gravi_data_duplicate (const gravi_data *self)
 Create a copy of the gravi data. More...
 
cpl_error_code gravi_data_append (gravi_data *first, const gravi_data *second, int force)
 Append a gravi_data into another existing one. More...
 
gravi_data * gravi_data_load (const char *filename)
 Low-level function to load FITS file. More...
 
gravi_data * gravi_data_load_ext (const char *filename, const char *extensions_regexp)
 Low-level function to load FITS file. More...
 
cpl_error_code gravi_data_dump_mode (gravi_data *data)
 Dump some information about data in messagin. More...
 
gravi_data * gravi_data_load_frame (cpl_frame *frame, cpl_frameset *used_frameset)
 Load a FITS file and create a gravi_data. More...
 
int gravi_data_patch (gravi_data *file_to_patch, cpl_frameset *patch_frameset)
 Load a RAW FITS file and create a gravi_data. More...
 
gravi_data * gravi_data_load_rawframe (cpl_frame *frame, cpl_frameset *used_frameset)
 Load a RAW FITS file and create a gravi_data. More...
 
gravi_data * gravi_data_load_rawframe_ext (cpl_frame *frame, cpl_frameset *used_frameset, char *extensions_regexp)
 Load a RAW FITS file and create a gravi_data from specified extensions. More...
 
cpl_error_code gravi_data_dump (gravi_data *self)
 Dump the overall structure of a gravi_data in stdout. More...
 
int gravi_data_get_size (const gravi_data *self)
 Get the number of extension in a gravi_data. More...
 
cpl_error_code gravi_data_save_data (gravi_data *self, const char *filename, unsigned mode)
 Save a gravi data in a FITS file. More...
 
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. More...
 
cpl_error_code gravi_data_detector_cleanup (gravi_data *data, const cpl_parameterlist *parlist)
 Perform self-bias correction to the SC raw data. More...
 
cpl_error_code gravi_data_copy_ext (gravi_data *output, gravi_data *input, const char *name)
 Copy extensions from one data to another. More...
 
cpl_error_code gravi_data_move_ext (gravi_data *output, gravi_data *input, const char *name)
 Move extensions from one data to another. More...
 
int gravi_data_has_extension (gravi_data *raw_calib, const char *ext_name)
 Check if data has extension with given EXTNAME. More...
 
int gravi_data_has_type (gravi_data *self, const char *type)
 Return the number of ext whose EXTNAME and INSNAME match 'type'. More...
 
cpl_propertylist * gravi_data_get_plist_x (gravi_data *self, int i)
 Get the propertylist of an extension by position. More...
 
cpl_table * gravi_data_get_table_x (gravi_data *self, int i)
 Get the table of an extension by position. More...
 
cpl_imagelist * gravi_data_get_cube_x (gravi_data *self, int i)
 Get the cube of an extension by position. More...
 
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. More...
 
cpl_propertylist * gravi_data_get_oi_plist (gravi_data *self, const char *extname, const char *insname)
 Get the propertylist from EXTNAME and INSNAME. More...
 
cpl_propertylist * gravi_data_get_plist (gravi_data *self, const char *extname)
 Get the propertylist from EXTNAME. More...
 
cpl_table * gravi_data_get_table (gravi_data *self, const char *extname)
 Return a pointer on a table extension by its EXTNAME. More...
 
cpl_imagelist * gravi_data_get_cube (gravi_data *self, const char *extname)
 Return a pointer on an IMAGE extension by its EXTNAME. More...
 
cpl_error_code gravi_data_erase_x (gravi_data *self, int pos)
 Erase an extension by its position. More...
 
cpl_error_code gravi_data_erase (gravi_data *self, const char *extname)
 Erase an extension by its EXTNAME. More...
 
cpl_error_code gravi_data_erase_type (gravi_data *self, const char *type)
 Erase all extension related to an instrument (SC, FT, MET...) More...
 
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. More...
 
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. More...
 
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. More...
 
cpl_error_code gravi_data_clean_for_astro (gravi_data *data)
 Clean the data to keep only OIFITS extensions related to SC. More...
 
cpl_error_code gravi_data_check_consistency (gravi_data *data)
 Verify the integrity of RAW data. More...
 
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. More...
 

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.

Function Documentation

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 1972 of file gravi_data.c.

Referenced by gravi_data_copy_ext(), gravi_data_move_ext(), gravi_preproc_acqcam(), and gravi_wave_qc().

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 2013 of file gravi_data.c.

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

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.

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

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

Definition at line 1909 of file gravi_data.c.

References gravi_data_check_savetypes().

Referenced by gravi_compute_argon_pos(), gravi_compute_badpix(), gravi_compute_dark(), gravi_compute_disp(), gravi_compute_p2vmred(), gravi_compute_profile(), gravi_compute_vis(), gravi_compute_wave(), gravi_create_p2vm(), gravi_data_copy_ext(), gravi_data_move_ext(), gravi_extract_spectrum(), gravi_metrology_reduce(), gravi_p2vm_transmission(), gravi_reduce_acqcam(), gravi_wave_compute_opds(), and gravi_wave_correct_color().

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 290 of file gravi_data.c.

References gravi_table_are_equal().

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 2121 of file gravi_data.c.

References gravi_data_get_plist(), gravi_data_get_table(), gravi_data_has_extension(), gravi_pfits_add_check(), and gravi_pfits_get_time_sc().

Referenced by gravi_data_load_rawframe().

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 186 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().

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 2054 of file gravi_data.c.

References gravi_data_get_plist_x(), and gravi_data_get_size().

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 1325 of file gravi_data.c.

References gravi_data_add_cube(), gravi_data_add_table(), gravi_data_get_cube_x(), gravi_data_get_plist_x(), gravi_data_get_size(), and gravi_data_get_table_x().

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(), and gravi_extract_spectrum().

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 137 of file gravi_data.c.

Referenced by gravi_compute_tf(), gravi_compute_tf_qc(), gravi_data_load(), gravi_data_load_ext(), and gravi_data_save_data().

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> [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 1086 of file gravi_data.c.

References gravi_data_get_cube(), gravi_data_get_dark_pos(), gravi_data_get_table(), and gravi_vector_get_mean_clip().

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 770 of file gravi_data.c.

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 539 of file gravi_data.c.

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

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 236 of file gravi_data.c.

References gravi_data_check_savetypes(), and gravi_data_new().

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

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 1832 of file gravi_data.c.

References gravi_data_erase_x().

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 1867 of file gravi_data.c.

References gravi_data_erase_x(), gravi_data_get_plist_x(), and gravi_data_get_size().

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 1781 of file gravi_data.c.

Referenced by gravi_data_erase(), and gravi_data_erase_type().

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 1751 of file gravi_data.c.

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

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 1561 of file gravi_data.c.

Referenced by gravi_data_copy_ext(), and gravi_data_move_ext().

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 1050 of file gravi_data.c.

Referenced by gravi_data_detector_cleanup().

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 1636 of file gravi_data.c.

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 1587 of file gravi_data.c.

Referenced by gravi_apply_tf_amp(), and gravi_apply_tf_phi().

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 2253 of file gravi_data.c.

Referenced by gravi_align_spectrum(), and gravi_compute_p2vm().

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 1684 of file gravi_data.c.

Referenced by gravi_acqcam_field(), gravi_acqcam_z2meter(), gravi_compute_dark(), gravi_compute_p2vmred(), gravi_create_oiwave_table_sc(), gravi_data_check_consistency(), gravi_extract_spectrum(), and gravi_wave_qc().

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 1511 of file gravi_data.c.

Referenced by gravi_data_clean_for_astro(), gravi_data_copy_ext(), gravi_data_erase_type(), gravi_data_has_type(), gravi_data_move_ext(), gravi_data_patch(), and gravi_vis_mjd_to_time().

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 802 of file gravi_data.c.

Referenced by gravi_data_clean_for_astro(), gravi_data_copy_ext(), gravi_data_erase_type(), gravi_data_has_type(), gravi_data_move_ext(), gravi_vis_force_time(), and gravi_vis_mjd_to_time().

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 1716 of file gravi_data.c.

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_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_create_oiwave_table_sc(), gravi_data_check_consistency(), gravi_data_detector_cleanup(), gravi_extract_spectrum(), gravi_metrology_get_fc_focus(), gravi_metrology_get_fc_shift(), gravi_metrology_reduce(), gravi_subtract_met_dark(), and gravi_wave_qc().

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 1536 of file gravi_data.c.

Referenced by gravi_compute_pointing_uv(), gravi_compute_tf(), gravi_data_copy_ext(), gravi_data_move_ext(), gravi_metrology_reduce(), gravi_vis_force_time(), and gravi_vis_mjd_to_time().

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 1443 of file gravi_data.c.

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_metrology_reduce(), gravi_preproc_acqcam(), gravi_reduce_acqcam(), and gravi_subtract_met_dark().

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 1468 of file gravi_data.c.

References gravi_data_get_plist_x(), and gravi_data_get_size().

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

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 376 of file gravi_data.c.

References gravi_data_check_savetypes(), gravi_data_delete(), and gravi_data_new().

Referenced by gravi_data_load_frame(), and gravi_data_load_rawframe().

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 448 of file gravi_data.c.

References gravi_data_check_savetypes(), gravi_data_delete(), and gravi_data_new().

Referenced by gravi_data_load_rawframe_ext().

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 573 of file gravi_data.c.

References gravi_data_dump_mode(), and gravi_data_load().

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 690 of file gravi_data.c.

References gravi_data_check_consistency(), gravi_data_dump_mode(), and gravi_data_load().

gravi_data* gravi_data_load_rawframe_ext ( cpl_frame *  frame,
cpl_frameset *  used_frameset,
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 734 of file gravi_data.c.

References gravi_data_dump_mode(), and gravi_data_load_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 1376 of file gravi_data.c.

References gravi_data_add_cube(), gravi_data_add_table(), gravi_data_get_cube_x(), gravi_data_get_plist_x(), gravi_data_get_size(), and gravi_data_get_table_x().

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 102 of file gravi_data.c.

Referenced by gravi_compute_badpix(), gravi_compute_biasmask(), gravi_compute_dark(), gravi_compute_disp(), gravi_compute_p2vmred(), gravi_compute_piezotf(), gravi_compute_profile(), gravi_compute_vis(), gravi_create_p2vm(), gravi_data_duplicate(), gravi_data_load(), gravi_data_load_ext(), and gravi_extract_spectrum().

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 609 of file gravi_data.c.

References gravi_data_get_plist_x().

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 830 of file gravi_data.c.

References gravi_data_delete().

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 896 of file gravi_data.c.

References gravi_pfits_add_pipe_build(), and gravi_plist_get_oifits_keywords().