GRAVI Pipeline Reference Manual 1.9.4
Loading...
Searching...
No Matches
gravity_vis_from_p2vmred.c
Go to the documentation of this file.
1/* $Id: gravity_vis_from_p2vmred.c,v 1.29 2011/12/3 09:16:12 nazouaoui Exp $
2 *
3 * This file is part of the GRAVI Pipeline
4 * Copyright (C) 2002,2003 European Southern Observatory
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifdef HAVE_CONFIG_H
22#include <config.h>
23#endif
24
25/*-----------------------------------------------------------------------------
26 Includes
27 -----------------------------------------------------------------------------*/
28
29#include <cpl.h>
30#include <stdio.h>
31#include <string.h>
32#include <time.h>
33
34#include "gravi_data.h"
35#include "gravi_pfits.h"
36#include "gravi_dfs.h"
37
38#include "gravi_utils.h"
39
40#include "gravi_calib.h"
41#include "gravi_p2vmred.h"
42#include "gravi_eop.h"
43#include "gravi_metrology.h"
44
45#include "gravi_signal.h"
46#include "gravi_vis.h"
47#include "gravi_tf.h"
48
49#include "gravi_preproc.h"
50
51/*-----------------------------------------------------------------------------
52 Private function prototypes
53 -----------------------------------------------------------------------------*/
54
55static int gravity_vis_from_p2vmred_create(cpl_plugin *);
56static int gravity_vis_from_p2vmred_exec(cpl_plugin *);
57static int gravity_vis_from_p2vmred_destroy(cpl_plugin *);
58static int gravity_vis_from_p2vmred(cpl_frameset *, cpl_parameterlist *);
59
60/*-----------------------------------------------------------------------------
61 Static variables
62 -----------------------------------------------------------------------------*/
63static char gravity_vis_from_p2vmred_short[] = "Compute the visibilities from P2VMRED intermediate product.";
65 "This recipe averages the real-time data of P2VMRED files into a VIS product. It allows to run the reduction with different parameters (for instance for SNR thresholding) without having to re-reduce the files from scratch. Typically the reduction is 4x faster when started from this intermediate product.\n"
66 "\n"
67 "The tag in the DO category can be SINGLE/DUAL and CAL/SCI. They should reflect the mode (SINGLE or DUAL) and the DPR.CATG of the observation (SCIENCE or CALIB). The tag in the PRO.CATG category will be SINGLE/DUAL and CAL/SCI depending on the input tag.\n"
69 "* Load the input file (loop on input files)\n"
70 "* Update the selection flag\n"
71 "* Average the real-time visibilities\n"
72 "* Write the product\n"
74 GRAVI_P2VMRED_SINGLE_SCIENCE" : Input intermediate product\n"
76 GRAVI_VIS_SINGLE_SCIENCE" : OIFITS with uncalibrated visibilities\n"
77 "";
78
79/*-----------------------------------------------------------------------------
80 Function code
81 -----------------------------------------------------------------------------*/
82
83/*----------------------------------------------------------------------------*/
93/*----------------------------------------------------------------------------*/
94int cpl_plugin_get_info(cpl_pluginlist * list)
95{
96 cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe );
97 cpl_plugin * plugin = &recipe->interface;
98
99 if (cpl_plugin_init(plugin,
100 CPL_PLUGIN_API,
101 GRAVI_BINARY_VERSION,
102 CPL_PLUGIN_TYPE_RECIPE,
103 "gravity_vis_from_p2vmred",
106 "JB. Le Bouquin, Vincent Lapeyrere, ",
107 PACKAGE_BUGREPORT,
112 cpl_msg_error(cpl_func, "Plugin initialization failed");
113 (void)cpl_error_set_where(cpl_func);
114 return 1;
115 }
116
117 if (cpl_pluginlist_append(list, plugin)) {
118 cpl_msg_error(cpl_func, "Error adding plugin to list");
119 (void)cpl_error_set_where(cpl_func);
120 return 1;
121 }
122
123 return 0;
124}
125
126/*----------------------------------------------------------------------------*/
134/*----------------------------------------------------------------------------*/
135static int gravity_vis_from_p2vmred_create(cpl_plugin * plugin)
136{
137 cpl_recipe * recipe;
138 cpl_parameter * p;
139
140 /* Do not create the recipe if an error code is already set */
141 if (cpl_error_get_code() != CPL_ERROR_NONE) {
142 cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
143 cpl_func, __LINE__, cpl_error_get_where());
144 return (int)cpl_error_get_code();
145 }
146
147 if (plugin == NULL) {
148 cpl_msg_error(cpl_func, "Null plugin");
149 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
150 }
151
152 /* Verify plugin type */
153 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
154 cpl_msg_error(cpl_func, "Plugin is not a recipe");
155 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
156 }
157
158 /* Get the recipe */
159 recipe = (cpl_recipe *)plugin;
160
161 /* Create the parameters list in the cpl_recipe object */
162 recipe->parameters = cpl_parameterlist_new();
163 if (recipe->parameters == NULL) {
164 cpl_msg_error(cpl_func, "Parameter list allocation failed");
165 cpl_ensure_code(0, (int)CPL_ERROR_ILLEGAL_OUTPUT);
166 }
167
168 /* Fill the parameters list */
169 int isCalib = 0;
170
171 /* Use static names (output_procatg.fits) */
172 gravi_parameter_add_static_name (recipe->parameters);
173
174 /* PCA visphi flattening */
175 gravi_parameter_add_pca (recipe->parameters);
176
177 /* Averaging */
178 gravi_parameter_add_average_vis (recipe->parameters);
179
180 /* Snr */
181 gravi_parameter_add_compute_snr (recipe->parameters);
182
183 /* Rejection */
184 gravi_parameter_add_rejection (recipe->parameters, isCalib);
185
186 /* Parameters for gravi_compute_vis */
187 gravi_parameter_add_compute_vis (recipe->parameters, isCalib);
188
189 /* Reduce ACQ_CAM */
190 p = cpl_parameter_new_value ("gravity.test.reduce-acq-cam", CPL_TYPE_BOOL,
191 "If TRUE, reduced ACQ_CAM images",
192 "gravity.test", FALSE);
193 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI, "reduce-acq-cam");
194 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
195 cpl_parameterlist_append (recipe->parameters, p);
196
197 /* --Use existing selection */
198 p = cpl_parameter_new_value ("gravity.signal.use-existing-rejection", CPL_TYPE_BOOL,
199 "Use existing rejection flags (ignore related options)",
200 "gravity.signal", FALSE);
201 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI, "use-existing-rejection");
202 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
203 cpl_parameterlist_append (recipe->parameters, p);
204
205 return 0;
206}
207
208/*----------------------------------------------------------------------------*/
214/*----------------------------------------------------------------------------*/
215static int gravity_vis_from_p2vmred_exec(cpl_plugin * plugin)
216{
217
218 cpl_recipe * recipe;
219 int recipe_status;
220 cpl_errorstate initial_errorstate = cpl_errorstate_get();
221
222
223 /* Return immediately if an error code is already set */
224 if (cpl_error_get_code() != CPL_ERROR_NONE) {
225 cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
226 cpl_func, __LINE__, cpl_error_get_where());
227 return (int)cpl_error_get_code();
228 }
229
230 if (plugin == NULL) {
231 cpl_msg_error(cpl_func, "Null plugin");
232 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
233 }
234
235 /* Verify plugin type */
236 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
237 cpl_msg_error(cpl_func, "Plugin is not a recipe");
238 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
239 }
240
241 /* Get the recipe */
242 recipe = (cpl_recipe *)plugin;
243
244 /* Verify parameter and frame lists */
245 if (recipe->parameters == NULL) {
246 cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
247 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
248 }
249 if (recipe->frames == NULL) {
250 cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
251 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
252 }
253
254 /* Invoke the recipe */
255 recipe_status = gravity_vis_from_p2vmred(recipe->frames, recipe->parameters);
256
257 /* Ensure DFS-compliance of the products */
258 if (cpl_dfs_update_product_header(recipe->frames)) {
259 if (!recipe_status){
260 recipe_status = (int)cpl_error_get_code();
261 }
262 }
263
264 if (!cpl_errorstate_is_equal(initial_errorstate)) {
265 /* Dump the error history since recipe execution start.
266 At this point the recipe cannot recover from the error */
267 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
268 }
269
270 return recipe_status;
271}
272
273/*----------------------------------------------------------------------------*/
279/*----------------------------------------------------------------------------*/
280static int gravity_vis_from_p2vmred_destroy(cpl_plugin * plugin)
281{
282 cpl_recipe * recipe;
283
284 if (plugin == NULL) {
285 cpl_msg_error(cpl_func, "Null plugin");
286 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
287 }
288
289 /* Verify plugin type */
290 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
291 cpl_msg_error(cpl_func, "Plugin is not a recipe");
292 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
293 }
294
295 /* Get the recipe */
296 recipe = (cpl_recipe *)plugin;
297
298 cpl_parameterlist_delete(recipe->parameters);
299
300 return 0;
301}
302
303
304/*----------------------------------------------------------------------------*/
312/*----------------------------------------------------------------------------*/
313static int gravity_vis_from_p2vmred(cpl_frameset * frameset,
314 cpl_parameterlist * parlist)
315{
316 cpl_frameset * recipe_frameset=NULL, *pcacalib_frameset=NULL, *used_frameset=NULL;
317
318 cpl_frame * frame=NULL;
319
320 const char * frame_tag=NULL;
321 char * proCatg = NULL, * mode=NULL;
322
323 gravi_data * p2vmred_data=NULL, * vis_data=NULL, * tmpvis_data=NULL, * pca_calib_data=NULL;
324 cpl_propertylist ** p2vm_qcs = NULL;
325
326 int nb_frame;
327
328 /* Message */
331
332 cpl_ensure_code(gravi_dfs_set_groups(frameset) == CPL_ERROR_NONE,
333 cpl_error_get_code()) ;
334
335 /* Dispatch the frameset */
336 recipe_frameset = gravi_frameset_extract_p2vmred_data (frameset);
337 pcacalib_frameset = gravi_frameset_extract_pca_calib (frameset);
338
339 /* To use this recipe the frameset must contain a P2VMREDUCED file. */
340 if ( cpl_frameset_get_size (recipe_frameset) < 1 ) {
341 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
342 "Illegal number of P2VMREDUCED file on the frameset");
343 goto cleanup;
344 }
345
346 /* Force some options if phase flattening is to be performed */
347 if (gravi_param_get_bool (parlist, "gravity.vis.flatten-visphi")) {
348 cpl_parameter *phase_ref = cpl_parameterlist_find (parlist, "gravity.vis.phase-ref-sc");
349 cpl_parameter *output_phase = cpl_parameterlist_find (parlist, "gravity.vis.output-phase-sc");
350
351 if (strcmp (cpl_parameter_get_string(phase_ref), "SELF_REF") != 0) {
352 cpl_msg_warning (cpl_func, "VISPHI flattening requires phase-ref-sc=SELF_REF, forcing");
353 cpl_parameter_set_string (phase_ref, "SELF_REF");
354 }
355
356 if (strcmp (cpl_parameter_get_string(output_phase), "SELF_VISPHI") != 0) {
357 cpl_msg_warning (cpl_func, "VISPHI flattening requires output-phase-sc=SELF_VISPHI, forcing");
358 cpl_parameter_set_string (output_phase, "SELF_VISPHI");
359 }
360 }
361
362 /* Insert calibration frame into the used frameset */
363 used_frameset = cpl_frameset_new();
364
365 if ( !cpl_frameset_is_empty (pcacalib_frameset)) {
366 frame = cpl_frameset_get_position (pcacalib_frameset, 0);
367 pca_calib_data = gravi_data_load_frame (frame, used_frameset);
368 } else
369 cpl_msg_info (cpl_func, "There is no PHASE_PCA in the frameset");
370
371 /*
372 * Select the PRO CATG (based on first frame)
373 */
374
375 frame_tag = cpl_frame_get_tag (cpl_frameset_get_position (recipe_frameset, 0));
376
377 if ((strcmp(frame_tag, GRAVI_P2VMRED_DUAL_CALIB) == 0)) {
378 proCatg = cpl_sprintf (GRAVI_VIS_DUAL_CALIB);
379 mode = cpl_sprintf ("gravi_dual");
380 }
381 else if ((strcmp(frame_tag, GRAVI_P2VMRED_DUAL_SCIENCE) == 0)) {
382 proCatg = cpl_sprintf (GRAVI_VIS_DUAL_SCIENCE);
383 mode = cpl_sprintf ("gravi_dual");
384 }
385 else if ((strcmp(frame_tag, GRAVI_P2VMRED_SINGLE_CALIB) == 0)) {
386 proCatg = cpl_sprintf (GRAVI_VIS_SINGLE_CALIB);
387 mode = cpl_sprintf ("gravi_single");
388 }
389 else if ((strcmp(frame_tag, GRAVI_P2VMRED_SINGLE_SCIENCE) == 0)) {
390 proCatg = cpl_sprintf (GRAVI_VIS_SINGLE_SCIENCE);
391 mode = cpl_sprintf ("gravi_single");
392 }
393 else {
394 proCatg = cpl_sprintf ("UNKNOWN");
395 mode = cpl_sprintf ("gravi_single");
396 }
397
398 cpl_msg_info (cpl_func,"Mode of the first frame is: %s (will be used for all frames)", mode);
399
400 /*
401 * Loop on input RAW frames to be reduced
402 */
403
404 nb_frame = cpl_frameset_get_size (recipe_frameset);
405 p2vm_qcs = cpl_malloc(sizeof(cpl_propertylist*) * nb_frame);
406
407 for (int ivis = 0; ivis < nb_frame; ivis++){
408
409 cpl_msg_info (cpl_func, " ***** P2VMREDUCED %d over %d ***** ", ivis+1, nb_frame);
410
411 frame = cpl_frameset_get_position (recipe_frameset, ivis);
412 p2vmred_data = gravi_data_load_frame (frame, used_frameset);
413 p2vm_qcs[ivis] = cpl_propertylist_new();
414
415 /* Compute rejection flags for averaging */
416 if (gravi_param_get_bool (parlist, "gravity.signal.use-existing-rejection")) {
417 cpl_msg_info (cpl_func,"Don't recompute SNR and selection, use the existing one");
418 } else {
419 /* Find outliers */
420 gravi_compute_outliers (p2vmred_data, parlist);
421 CPLCHECK_MSG ("Cannot compute outliers");
422
423 /* Compute the SNR/GDELAY */
424 gravi_compute_snr (p2vmred_data, parlist);
425 CPLCHECK_MSG ("Cannot compute SNR");
426
427 /* Compute rejection flags for averaging */
428 gravi_compute_rejection (p2vmred_data, parlist);
429 CPLCHECK_MSG ("Cannot recompute rejection flags signals");
430 }
431
432 /* Temporary copy for averaging over all frames */
433 gravi_copy_p2vm_qcs(p2vmred_data, p2vm_qcs[ivis]);
434 CPLCHECK_MSG ("Cannot copy QC for averaging");
435
436 /* Loop on the wanted sub-integration */
437 cpl_size current_frame = 0;
438 while (current_frame >= 0)
439 {
440
441 /* Visibility and flux are averaged and the followings
442 * are saved in Visibility data in tables VIS, VIS2 and T3 */
443 tmpvis_data = gravi_compute_vis (p2vmred_data, parlist, &current_frame);
444 CPLCHECK_CLEAN ("Cannot average the P2VMRED frames into VIS");
445
446 /* Set the mean TIME and mean MJD if required */
447 if (gravi_param_get_bool (parlist, "gravity.vis.force-same-time") ) {
448 cpl_msg_info (cpl_func,"Force same time for all quantities/baselines");
449 gravi_vis_force_time (tmpvis_data);
450 CPLCHECK_CLEAN ("Cannot average the TIME in OI_VIS");
451 }
452
453 /* Copy the acquisition camera if requested */
454 if (current_frame < 0 && gravi_param_get_bool (parlist, "gravity.test.reduce-acq-cam"))
455 {
456 cpl_msg_info (cpl_func, "Copy ACQ into the VIS file");
458 }
459
460 /* Merge with already existing */
461 if (vis_data == NULL) {
462 vis_data = tmpvis_data; tmpvis_data = NULL;
463 }
464 else {
465 cpl_msg_info (cpl_func,"Merge with previous OI_VIS");
466 gravi_data_append (vis_data, tmpvis_data, 1);
467 FREE (gravi_data_delete, tmpvis_data);
468 }
469 CPLCHECK_CLEAN ("Cannot merge the visibilities");
470
471 }
472
473 cpl_msg_info (cpl_func,"Free the p2vmreduced");
474 FREE (gravi_data_delete, p2vmred_data);
475 }
476 /* End loop on the input files to reduce */
477
478 /* Use the PCA calibration to flatten the VISPHI */
479 if (gravi_param_get_bool (parlist, "gravity.vis.flatten-visphi")) {
480 cpl_msg_info (cpl_func, "Flatten VISPHI using PCA");
481 gravi_flatten_vis(vis_data, pca_calib_data);
482 CPLCHECK_CLEAN ("Cannot apply the VISPHI flattening");
483 }
484
485 /* Compute QC parameters */
486 gravi_compute_vis_qc (vis_data, used_frameset, p2vm_qcs, nb_frame);
487
488 /* Perform the normalisation of the SC vis2 and visamp
489 * to match those of the FT */
490 if (!strcmp (gravi_param_get_string (parlist, "gravity.vis.vis-correction-sc"), "FORCE")) {
491
492 cpl_msg_info (cpl_func, "Align the SC visibilities on the FT");
493 gravi_normalize_sc_to_ft (vis_data);
494
495 } else {
496 cpl_msg_info (cpl_func, "Don't align the SC visibilities on the FT");
497 }
498
499 /* Co-add the observations if requested */
500 if (gravi_param_get_bool (parlist, "gravity.postprocess.average-vis")) {
501
502 cpl_msg_warning (cpl_func, "Average the different observation (if any) = EXPERIMENTAL");
503 gravi_average_vis (vis_data);
504
505 } else {
506 cpl_msg_info (cpl_func, "Don't average the different observation (if any)");
507 }
508
509 /* Recompute the TIME column from the MJD column
510 * in all OIFITS tables to follow standard */
511 gravi_vis_mjd_to_time (vis_data);
512
513 /* Save the output data file based on the first frame of the frameset */
514 frame = cpl_frameset_get_position (recipe_frameset, 0);
515
516 gravi_data_save_new (vis_data, frameset, NULL, NULL, parlist,
517 used_frameset, frame, "gravity_vis_from_p2vmred",
518 NULL, proCatg);
519
520 CPLCHECK_CLEAN ("Cannot save the VIS product");
521
522 /* Terminate the function */
523 goto cleanup;
524
525cleanup:
526 /* Deallocation of all variables */
527 cpl_msg_info(cpl_func,"Memory cleanup");
528
529 FREE (gravi_data_delete,p2vmred_data);
530 FREE (gravi_data_delete, pca_calib_data);
531 FREE (gravi_data_delete,vis_data);
532 FREE (gravi_data_delete,tmpvis_data);
533 FREE (cpl_frameset_delete,recipe_frameset);
534 FREE (cpl_frameset_delete,pcacalib_frameset);
535 FREE (cpl_frameset_delete,used_frameset);
536 FREE (cpl_free,proCatg);
537 FREE (cpl_free,mode);
538 FREELOOP(cpl_propertylist_delete, p2vm_qcs, nb_frame);
539
541 return (int)cpl_error_get_code();
542}
typedefCPL_BEGIN_DECLS struct _gravi_data_ gravi_data
Definition: gravi_data.h:39
#define GRAVI_RECIPE_OUTPUT
Definition: gravi_dfs.h:39
#define GRAVI_P2VMRED_SINGLE_CALIB
Definition: gravi_dfs.h:63
#define GRAVI_P2VMRED_DUAL_CALIB
Definition: gravi_dfs.h:65
#define GRAVI_RECIPE_FLOW
Definition: gravi_dfs.h:37
#define GRAVI_VIS_DUAL_SCIENCE
Definition: gravi_dfs.h:98
#define GRAVI_VIS_SINGLE_SCIENCE
Definition: gravi_dfs.h:96
#define GRAVI_P2VMRED_SINGLE_SCIENCE
Definition: gravi_dfs.h:64
#define GRAVI_RECIPE_INPUT
Definition: gravi_dfs.h:38
#define GRAVI_VIS_DUAL_CALIB
Definition: gravi_dfs.h:99
#define GRAVI_VIS_SINGLE_CALIB
Definition: gravi_dfs.h:97
#define GRAVI_P2VMRED_DUAL_SCIENCE
Definition: gravi_dfs.h:66
cpl_msg_info(cpl_func, "Compute WAVE_SCAN for %s", GRAVI_TYPE(type_data))
#define INSNAME_ACQ
Definition: gravi_pfits.h:199
#define GRAVI_IMAGING_DATA_ACQ_EXT
Definition: gravi_pfits.h:41
#define CPLCHECK_CLEAN(msg)
Definition: gravi_utils.h:54
#define gravi_msg_function_exit(flag)
Definition: gravi_utils.h:85
#define FREE(function, variable)
Definition: gravi_utils.h:69
#define gravi_msg_function_start(flag)
Definition: gravi_utils.h:84
#define CPLCHECK_MSG(msg)
Definition: gravi_utils.h:45
#define FREELOOP(function, variable, n)
Definition: gravi_utils.h:72
static int gravity_vis_from_p2vmred_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static char gravity_vis_from_p2vmred_description[]
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
static int gravity_vis_from_p2vmred_create(cpl_plugin *)
Setup the recipe options
static char gravity_vis_from_p2vmred_short[]
static int gravity_vis_from_p2vmred(cpl_frameset *, cpl_parameterlist *)
Compute the visibilities, and closure phase and create the io fits file.
static int gravity_vis_from_p2vmred_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
cpl_error_code gravi_flatten_vis(gravi_data *vis_data, gravi_data *calib_data)
Use PCA model to flatten observed visphi. The flattened data are added to the existing VIS table.
Definition: gravi_calib.c:3279
gravi_data * gravi_data_load_frame(cpl_frame *frame, cpl_frameset *used_frameset)
Load a FITS file and create a gravi_data.
Definition: gravi_data.c:599
cpl_error_code gravi_data_append(gravi_data *first, const gravi_data *second, int force)
Append a gravi_data into another existing one.
Definition: gravi_data.c:308
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.
Definition: gravi_data.c:925
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.
Definition: gravi_data.c:1587
void gravi_data_delete(gravi_data *self)
Delete a gravi data.
Definition: gravi_data.c:146
int gravi_param_get_bool(const cpl_parameterlist *parlist, const char *name)
Definition: gravi_dfs.c:1537
cpl_parameter * gravi_parameter_add_static_name(cpl_parameterlist *self)
Definition: gravi_dfs.c:464
cpl_error_code gravi_parameter_add_rejection(cpl_parameterlist *self, int isCalib)
Add rejection parameters to the input parameter list.
Definition: gravi_dfs.c:864
cpl_error_code gravi_parameter_add_compute_snr(cpl_parameterlist *self)
Definition: gravi_dfs.c:779
cpl_parameter * gravi_parameter_add_average_vis(cpl_parameterlist *self)
Definition: gravi_dfs.c:714
const char * gravi_param_get_string(const cpl_parameterlist *parlist, const char *name)
Definition: gravi_dfs.c:1550
cpl_parameter * gravi_parameter_add_pca(cpl_parameterlist *self)
Add pca parameters to the input parameter list.
Definition: gravi_dfs.c:324
cpl_frameset * gravi_frameset_extract_pca_calib(cpl_frameset *frameset)
Definition: gravi_dfs.c:1438
cpl_error_code gravi_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
Definition: gravi_dfs.c:78
cpl_frameset * gravi_frameset_extract_p2vmred_data(cpl_frameset *frameset)
Definition: gravi_dfs.c:1327
cpl_error_code gravi_parameter_add_compute_vis(cpl_parameterlist *self, int isCalib)
Definition: gravi_dfs.c:943
void gravity_print_banner(void)
Definition: gravi_dfs.c:61
cpl_error_code gravi_compute_snr(gravi_data *p2vmred_data, const cpl_parameterlist *parlist)
Compute real-time SNR and Group-Delay of the observation.
Definition: gravi_signal.c:620
cpl_error_code gravi_compute_outliers(gravi_data *p2vmred_data, const cpl_parameterlist *parlist)
Compute the outliers flags.
Definition: gravi_signal.c:536
cpl_error_code gravi_compute_rejection(gravi_data *p2vmred_data, const cpl_parameterlist *parlist)
Create rejection flags P2VMREDUCED file.
cpl_error_code gravi_copy_p2vm_qcs(gravi_data *p2vmred_data, cpl_propertylist *plist)
Copy PFACTOR and VFACTOR QCs so that they may be aggregated over all frames.
const char * gravi_get_license(void)
Get the pipeline copyright and license.
Definition: gravi_utils.c:104
cpl_error_code gravi_normalize_sc_to_ft(gravi_data *vis_data)
Align the SC visibilities on the FT visibilities.
Definition: gravi_vis.c:2602
gravi_data * gravi_compute_vis(gravi_data *p2vmred_data, const cpl_parameterlist *parlist, cpl_size *current_frame)
The function average the individual frames of a P2VMREDUCED file into a final, single observation per...
Definition: gravi_vis.c:1675
cpl_error_code gravi_vis_force_time(gravi_data *oi_data)
Force all data in OI_TABLE to have the same TIME and MJD.
Definition: gravi_vis.c:4170
cpl_error_code gravi_vis_mjd_to_time(gravi_data *vis_data)
Recompute the TIME column of all OIFITS extension from the MJD column, following the OIFITS standard ...
Definition: gravi_vis.c:2688
cpl_error_code gravi_compute_vis_qc(gravi_data *vis_data, cpl_frameset *frameset, cpl_propertylist **frame_qcs, cpl_size nb_frame)
Compute the QC parameters for a VIS (averaged) data.
Definition: gravi_vis.c:2237
cpl_error_code gravi_average_vis(gravi_data *oi_data)
Coadd the observations together.
Definition: gravi_vis.c:3036