GRAVI Pipeline Reference Manual 1.9.6
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_enum ("gravity.test.reduce-acq-cam", CPL_TYPE_STRING,
191 "If TRUE, reduced ACQ_CAM images. If QC, compute only\n "
192 "the QC parameters of the field part. If FALSE, ignore\n "
193 "completely the acquisition camera.",
194 "gravity.test", "FALSE",
195 3, "TRUE", "FALSE", "QC");
196 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI, "reduce-acq-cam");
197 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
198 cpl_parameterlist_append (recipe->parameters, p);
199
200 /* --Use existing selection */
201 p = cpl_parameter_new_value ("gravity.signal.use-existing-rejection", CPL_TYPE_BOOL,
202 "Use existing rejection flags (ignore related options)",
203 "gravity.signal", FALSE);
204 cpl_parameter_set_alias (p, CPL_PARAMETER_MODE_CLI, "use-existing-rejection");
205 cpl_parameter_disable (p, CPL_PARAMETER_MODE_ENV);
206 cpl_parameterlist_append (recipe->parameters, p);
207
208 return 0;
209}
210
211/*----------------------------------------------------------------------------*/
217/*----------------------------------------------------------------------------*/
218static int gravity_vis_from_p2vmred_exec(cpl_plugin * plugin)
219{
220
221 cpl_recipe * recipe;
222 int recipe_status;
223 cpl_errorstate initial_errorstate = cpl_errorstate_get();
224
225
226 /* Return immediately if an error code is already set */
227 if (cpl_error_get_code() != CPL_ERROR_NONE) {
228 cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
229 cpl_func, __LINE__, cpl_error_get_where());
230 return (int)cpl_error_get_code();
231 }
232
233 if (plugin == NULL) {
234 cpl_msg_error(cpl_func, "Null plugin");
235 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
236 }
237
238 /* Verify plugin type */
239 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
240 cpl_msg_error(cpl_func, "Plugin is not a recipe");
241 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
242 }
243
244 /* Get the recipe */
245 recipe = (cpl_recipe *)plugin;
246
247 /* Verify parameter and frame lists */
248 if (recipe->parameters == NULL) {
249 cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
250 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
251 }
252 if (recipe->frames == NULL) {
253 cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
254 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
255 }
256
257 /* Invoke the recipe */
258 recipe_status = gravity_vis_from_p2vmred(recipe->frames, recipe->parameters);
259
260 /* Ensure DFS-compliance of the products */
261 if (cpl_dfs_update_product_header(recipe->frames)) {
262 if (!recipe_status){
263 recipe_status = (int)cpl_error_get_code();
264 }
265 }
266
267 if (!cpl_errorstate_is_equal(initial_errorstate)) {
268 /* Dump the error history since recipe execution start.
269 At this point the recipe cannot recover from the error */
270 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
271 }
272
273 return recipe_status;
274}
275
276/*----------------------------------------------------------------------------*/
282/*----------------------------------------------------------------------------*/
283static int gravity_vis_from_p2vmred_destroy(cpl_plugin * plugin)
284{
285 cpl_recipe * recipe;
286
287 if (plugin == NULL) {
288 cpl_msg_error(cpl_func, "Null plugin");
289 cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
290 }
291
292 /* Verify plugin type */
293 if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
294 cpl_msg_error(cpl_func, "Plugin is not a recipe");
295 cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
296 }
297
298 /* Get the recipe */
299 recipe = (cpl_recipe *)plugin;
300
301 cpl_parameterlist_delete(recipe->parameters);
302
303 return 0;
304}
305
306
307/*----------------------------------------------------------------------------*/
315/*----------------------------------------------------------------------------*/
316static int gravity_vis_from_p2vmred(cpl_frameset * frameset,
317 cpl_parameterlist * parlist)
318{
319 cpl_frameset * recipe_frameset=NULL, *pcacalib_frameset=NULL, *used_frameset=NULL;
320
321 cpl_frame * frame=NULL;
322 const char * frame_tag=NULL;
323 char * proCatg = NULL, * mode=NULL;
324
325 gravi_data * p2vmred_data=NULL, * vis_data=NULL, * tmpvis_data=NULL, * pca_calib_data=NULL;
326 cpl_propertylist ** p2vm_qcs = NULL;
327
328 int nb_frame;
329 char * input_data_type;
330
331 /* Message */
334
335 cpl_ensure_code(gravi_dfs_set_groups(frameset) == CPL_ERROR_NONE,
336 cpl_error_get_code()) ;
337
338 /* Dispatch the frameset */
339 recipe_frameset = gravi_frameset_extract_p2vmred_data (frameset);
340 pcacalib_frameset = gravi_frameset_extract_pca_calib (frameset);
341
342 /* To use this recipe the frameset must contain a P2VMREDUCED file. */
343 if ( cpl_frameset_get_size (recipe_frameset) < 1 ) {
344 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
345 "Illegal number of P2VMREDUCED file on the frameset");
346 goto cleanup;
347 }
348
349 /* Force some options if phase flattening is to be performed */
350 if (gravi_param_get_bool (parlist, "gravity.vis.flatten-visphi")) {
351 cpl_parameter *phase_ref = cpl_parameterlist_find (parlist, "gravity.vis.phase-ref-sc");
352 cpl_parameter *output_phase = cpl_parameterlist_find (parlist, "gravity.vis.output-phase-sc");
353
354 if (strcmp (cpl_parameter_get_string(phase_ref), "SELF_REF") != 0) {
355 cpl_msg_warning (cpl_func, "VISPHI flattening requires phase-ref-sc=SELF_REF, forcing");
356 cpl_parameter_set_string (phase_ref, "SELF_REF");
357 }
358
359 if (strcmp (cpl_parameter_get_string(output_phase), "SELF_VISPHI") != 0) {
360 cpl_msg_warning (cpl_func, "VISPHI flattening requires output-phase-sc=SELF_VISPHI, forcing");
361 cpl_parameter_set_string (output_phase, "SELF_VISPHI");
362 }
363 }
364
365 /* Insert calibration frame into the used frameset */
366 used_frameset = cpl_frameset_new();
367
368 if ( !cpl_frameset_is_empty (pcacalib_frameset)) {
369 frame = cpl_frameset_get_position (pcacalib_frameset, 0);
370 pca_calib_data = gravi_data_load_frame (frame, used_frameset);
371 } else
372 cpl_msg_info (cpl_func, "There is no PHASE_PCA in the frameset");
373
374 /*
375 * Select the PRO CATG (based on first frame)
376 */
377
378 frame_tag = cpl_frame_get_tag (cpl_frameset_get_position (recipe_frameset, 0));
379
380 if ((strcmp(frame_tag, GRAVI_P2VMRED_DUAL_CALIB) == 0)) {
381 proCatg = cpl_sprintf (GRAVI_VIS_DUAL_CALIB);
382 mode = cpl_sprintf ("gravi_dual");
383 input_data_type = cpl_sprintf ("raw_calibrator");
384 }
385 else if ((strcmp(frame_tag, GRAVI_P2VMRED_DUAL_SCIENCE) == 0)) {
386 proCatg = cpl_sprintf (GRAVI_VIS_DUAL_SCIENCE);
387 mode = cpl_sprintf ("gravi_dual");
388 input_data_type = cpl_sprintf ("raw_science");
389 }
390 else if ((strcmp(frame_tag, GRAVI_P2VMRED_SINGLE_CALIB) == 0)) {
391 proCatg = cpl_sprintf (GRAVI_VIS_SINGLE_CALIB);
392 mode = cpl_sprintf ("gravi_single");
393 input_data_type = cpl_sprintf ("raw_calibrator");
394 }
395 else if ((strcmp(frame_tag, GRAVI_P2VMRED_SINGLE_SCIENCE) == 0)) {
396 proCatg = cpl_sprintf (GRAVI_VIS_SINGLE_SCIENCE);
397 mode = cpl_sprintf ("gravi_single");
398 input_data_type = cpl_sprintf ("raw_science");
399 }
400 else {
401 proCatg = cpl_sprintf ("UNKNOWN");
402 mode = cpl_sprintf ("gravi_single");
403 }
404
405 cpl_msg_info (cpl_func,"Mode of the first frame is: %s (will be used for all frames)", mode);
406
407 /*
408 * Loop on input RAW frames to be reduced
409 */
410
411 nb_frame = cpl_frameset_get_size (recipe_frameset);
412 p2vm_qcs = cpl_malloc(sizeof(cpl_propertylist*) * nb_frame);
413
414 for (int ivis = 0; ivis < nb_frame; ivis++){
415
416 cpl_msg_info (cpl_func, " ***** P2VMREDUCED %d over %d ***** ", ivis+1, nb_frame);
417
418 frame = cpl_frameset_get_position (recipe_frameset, ivis);
419 p2vmred_data = gravi_data_load_frame (frame, used_frameset);
420 p2vm_qcs[ivis] = cpl_propertylist_new();
421
422 /* Compute rejection flags for averaging */
423 if (gravi_param_get_bool (parlist, "gravity.signal.use-existing-rejection")) {
424 cpl_msg_info (cpl_func,"Don't recompute SNR and selection, use the existing one");
425 } else {
426 /* Find outliers */
427 gravi_compute_outliers (p2vmred_data, parlist);
428 CPLCHECK_MSG ("Cannot compute outliers");
429
430 /* Compute the SNR/GDELAY */
431 gravi_compute_snr (p2vmred_data, parlist);
432 CPLCHECK_MSG ("Cannot compute SNR");
433
434 /* Compute rejection flags for averaging */
435 gravi_compute_rejection (p2vmred_data, parlist);
436 CPLCHECK_MSG ("Cannot recompute rejection flags signals");
437 }
438
439 /* Temporary copy for averaging over all frames */
440 gravi_copy_p2vm_qcs(p2vmred_data, p2vm_qcs[ivis]);
441 CPLCHECK_MSG ("Cannot copy QC for averaging");
442
443 /* Loop on the wanted sub-integration */
444 cpl_size current_frame = 0;
445 while (current_frame >= 0)
446 {
447
448 /* Visibility and flux are averaged and the followings
449 * are saved in Visibility data in tables VIS, VIS2 and T3 */
450 tmpvis_data = gravi_compute_vis (p2vmred_data, parlist, &current_frame);
451 CPLCHECK_CLEAN ("Cannot average the P2VMRED frames into VIS");
452
453 /* Set the mean TIME and mean MJD if required */
454 if (gravi_param_get_bool (parlist, "gravity.vis.force-same-time") ) {
455 cpl_msg_info (cpl_func,"Force same time for all quantities/baselines");
456 gravi_vis_force_time (tmpvis_data);
457 CPLCHECK_CLEAN ("Cannot average the TIME in OI_VIS");
458 }
459
460 /* Copy the acquisition camera if requested */
461 if (current_frame < 0 && !strcmp (gravi_param_get_string (parlist, "gravity.test.reduce-acq-cam"), "TRUE"))
462 {
463 cpl_msg_info (cpl_func, "Copy ACQ into the VIS file");
465 }
466
467 /* Merge with already existing */
468 if (vis_data == NULL) {
469 vis_data = tmpvis_data; tmpvis_data = NULL;
470 }
471 else {
472 cpl_msg_info (cpl_func,"Merge with previous OI_VIS");
473 gravi_data_append (vis_data, tmpvis_data, 1);
474 FREE (gravi_data_delete, tmpvis_data);
475 }
476 CPLCHECK_CLEAN ("Cannot merge the visibilities");
477
478 }
479
480 cpl_msg_info (cpl_func,"Free the p2vmreduced");
481 FREE (gravi_data_delete, p2vmred_data);
482 }
483 /* End loop on the input files to reduce */
484
485 /* Use the PCA calibration to flatten the VISPHI */
486 if (gravi_param_get_bool (parlist, "gravity.vis.flatten-visphi")) {
487 cpl_msg_info (cpl_func, "Flatten VISPHI using PCA");
488 gravi_flatten_vis(vis_data, pca_calib_data);
489 CPLCHECK_CLEAN ("Cannot apply the VISPHI flattening");
490 }
491
492 /* Compute QC parameters */
493 gravi_compute_vis_qc (vis_data, used_frameset, p2vm_qcs, nb_frame, input_data_type);
494
495 /* Perform the normalisation of the SC vis2 and visamp
496 * to match those of the FT */
497 if (!strcmp (gravi_param_get_string (parlist, "gravity.vis.vis-correction-sc"), "FORCE")) {
498
499 cpl_msg_info (cpl_func, "Align the SC visibilities on the FT");
500 gravi_normalize_sc_to_ft (vis_data);
501
502 } else {
503 cpl_msg_info (cpl_func, "Don't align the SC visibilities on the FT");
504 }
505
506 /* Co-add the observations if requested */
507 if (gravi_param_get_bool (parlist, "gravity.postprocess.average-vis")) {
508
509 cpl_msg_warning (cpl_func, "Average the different observation (if any) = EXPERIMENTAL");
510 gravi_average_vis (vis_data);
511
512 } else {
513 cpl_msg_info (cpl_func, "Don't average the different observation (if any)");
514 }
515
516 /* Recompute the TIME column from the MJD column
517 * in all OIFITS tables to follow standard */
518 gravi_vis_mjd_to_time (vis_data);
519
520 /* Save the output data file based on the first frame of the frameset */
521 frame = cpl_frameset_get_position (recipe_frameset, 0);
522
523 gravi_data_save_new (vis_data, frameset, NULL, NULL, parlist,
524 used_frameset, frame, "gravity_vis_from_p2vmred",
525 NULL, proCatg);
526
527 CPLCHECK_CLEAN ("Cannot save the VIS product");
528
529 /* Terminate the function */
530 goto cleanup;
531
532cleanup:
533 /* Deallocation of all variables */
534 cpl_msg_info(cpl_func,"Memory cleanup");
535
536 FREE (gravi_data_delete,p2vmred_data);
537 FREE (gravi_data_delete, pca_calib_data);
538 FREE (gravi_data_delete,vis_data);
539 FREE (gravi_data_delete,tmpvis_data);
540 FREE (cpl_frameset_delete,recipe_frameset);
541 FREE (cpl_frameset_delete,pcacalib_frameset);
542 FREE (cpl_frameset_delete,used_frameset);
543 FREE (cpl_free,proCatg);
544 FREE (cpl_free,mode);
545 FREE (cpl_free,input_data_type);
546 FREELOOP(cpl_propertylist_delete, p2vm_qcs, nb_frame);
547
549 return (int)cpl_error_get_code();
550}
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:1534
cpl_parameter * gravi_parameter_add_static_name(cpl_parameterlist *self)
Definition: gravi_dfs.c:461
cpl_error_code gravi_parameter_add_rejection(cpl_parameterlist *self, int isCalib)
Add rejection parameters to the input parameter list.
Definition: gravi_dfs.c:861
cpl_error_code gravi_parameter_add_compute_snr(cpl_parameterlist *self)
Definition: gravi_dfs.c:776
cpl_parameter * gravi_parameter_add_average_vis(cpl_parameterlist *self)
Definition: gravi_dfs.c:711
const char * gravi_param_get_string(const cpl_parameterlist *parlist, const char *name)
Definition: gravi_dfs.c:1547
cpl_parameter * gravi_parameter_add_pca(cpl_parameterlist *self)
Add pca parameters to the input parameter list.
Definition: gravi_dfs.c:321
cpl_frameset * gravi_frameset_extract_pca_calib(cpl_frameset *frameset)
Definition: gravi_dfs.c:1435
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:1324
cpl_error_code gravi_parameter_add_compute_vis(cpl_parameterlist *self, int isCalib)
Definition: gravi_dfs.c:940
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:2596
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:4163
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:2682
cpl_error_code gravi_compute_vis_qc(gravi_data *vis_data, cpl_frameset *frameset, cpl_propertylist **frame_qcs, cpl_size nb_frame, char *input_data_type)
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:3030