GRAVI Pipeline Reference Manual 1.9.2
Loading...
Searching...
No Matches
gravi_eop.c
Go to the documentation of this file.
1/*
2 * This file is part of the GRAVI Pipeline
3 * Copyright (C) 2002,2003 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
34/*-----------------------------------------------------------------------------
35 Includes
36 -----------------------------------------------------------------------------*/
37
38#ifdef HAVE_CONFIG_H
39#include <config.h>
40#endif
41
42#include <stdlib.h>
43#include <string.h>
44#include <stdio.h>
45#include <time.h>
46#include <unistd.h>
47
48#include <erfa.h>
49
50#include "gravi_eop.h"
51#include "gravi_cpl.h"
52#include "gravi_pfits.h"
53
54#include "gravi_utils.h"
55
56/*-----------------------------------------------------------------------------
57 Private prototypes and define
58 -----------------------------------------------------------------------------*/
59
60
61cpl_error_code gravi_eop_interpolate (cpl_size n, double *mjd,
62 double *pmx, double *pmy,
63 double *dut, cpl_table * eop_table,
64 cpl_propertylist * header);
65
66void eraAtboq (double rc, double dc, eraASTROM *astrom, double enuob[3]);
67void eraAtcoq (double rc, double dc, double pmr, double pmd, double px,
68 double rv, eraASTROM *astrom, double enuob[3]);
69void dtp2s (double xi, double eta, double raz,
70 double decz, double *ra, double *dec);
71void rotate_vector (double in[3], double angle, double axis[3], double out[3]);
72void difference (double x[3], double y[3], double z[3]);
73void multiply (double xyz[3], double factor);
74void normalize (double xyz[3]);
75void cross (double x[3], double y[3], double z[3]);
76
77/*-----------------------------------------------------------------------------
78 Functions code
79 -----------------------------------------------------------------------------*/
80
81/*
82 * Private function to interpolate EOP parameter from EOP_PARAM
83 * and manipulate coordinates and 3D vectors
84 */
85
86cpl_error_code gravi_eop_interpolate (cpl_size n, double *mjd,
87 double *pmx, double *pmy,
88 double *dut,
89 cpl_table * eop_table,
90 cpl_propertylist * header)
91{
93 cpl_ensure_code (eop_table, CPL_ERROR_NULL_INPUT);
94 cpl_ensure_code (header, CPL_ERROR_NULL_INPUT);
95 cpl_ensure_code (n>0, CPL_ERROR_ILLEGAL_INPUT);
96 cpl_ensure_code (mjd, CPL_ERROR_NULL_INPUT);
97 cpl_ensure_code (pmx, CPL_ERROR_NULL_INPUT);
98 cpl_ensure_code (pmy, CPL_ERROR_NULL_INPUT);
99 cpl_ensure_code (dut, CPL_ERROR_NULL_INPUT);
100
101 /* Wrap inputs in vectors */
102 cpl_vector *vmjd = cpl_vector_wrap (n, mjd);
103 cpl_vector *vpmx = cpl_vector_wrap (n, pmx);
104 cpl_vector *vpmy = cpl_vector_wrap (n, pmy);
105 cpl_vector *vdut = cpl_vector_wrap (n, dut);
106
107 /* Check validity of input mjd with table */
108 if (cpl_vector_get_min (vmjd) < cpl_table_get_column_min (eop_table, "MJD") ||
109 cpl_vector_get_max (vmjd) > cpl_table_get_column_max (eop_table, "MJD"))
110 {
111 cpl_msg_warning (cpl_func, "Some MJD are outside the EOP_PARAM range (MJD=%.2f, %.2f..%.2f). Use EOP and DUT=0.0s",
112 cpl_vector_get_mean (vmjd),
113 cpl_table_get_column_min (eop_table, "MJD"),
114 cpl_table_get_column_max (eop_table, "MJD"));
115 cpl_vector_unwrap (vmjd);
116 cpl_vector_unwrap (vpmx);
117 cpl_vector_unwrap (vpmy);
118 cpl_vector_unwrap (vdut);
120 return CPL_ERROR_NONE;
121 }
122
123 /* Check if within the prediction range */
124 if(cpl_vector_get_max (vmjd) > cpl_propertylist_get_double (header, "ESO QC EOP MJD LAST FINAL"))
125 {
126 cpl_msg_warning (cpl_func, "Some MJD are inside the EOP_PARAM prediction range...");
127 }
128
129 /* Wrap output vectors */
130 cpl_size nrow = cpl_table_get_nrow (eop_table);
131 cpl_vector * eop_mjd = cpl_vector_wrap (nrow, cpl_table_get_data_double (eop_table, "MJD"));
132 cpl_vector * eop_pmx = cpl_vector_wrap (nrow, cpl_table_get_data_double (eop_table, "PMX"));
133 cpl_vector * eop_pmy = cpl_vector_wrap (nrow, cpl_table_get_data_double (eop_table, "PMY"));
134 cpl_vector * eop_dut = cpl_vector_wrap (nrow, cpl_table_get_data_double (eop_table, "DUT"));
135
136 /* Perform interpolations */
137 cpl_bivector *mjd_pmx = cpl_bivector_wrap_vectors (vmjd, vpmx);
138 cpl_bivector *eop_mjd_pmx = cpl_bivector_wrap_vectors (eop_mjd, eop_pmx);
139 cpl_bivector_interpolate_linear (mjd_pmx, eop_mjd_pmx);
140 cpl_bivector_unwrap_vectors (mjd_pmx);
141 cpl_bivector_unwrap_vectors (eop_mjd_pmx);
142
143 cpl_bivector *mjd_pmy = cpl_bivector_wrap_vectors (vmjd, vpmy);
144 cpl_bivector *eop_mjd_pmy = cpl_bivector_wrap_vectors (eop_mjd, eop_pmy);
145 cpl_bivector_interpolate_linear (mjd_pmy, eop_mjd_pmy);
146 cpl_bivector_unwrap_vectors (mjd_pmy);
147 cpl_bivector_unwrap_vectors (eop_mjd_pmy);
148
149 cpl_bivector *mjd_dut = cpl_bivector_wrap_vectors (vmjd, vdut);
150 cpl_bivector *eop_mjd_dut = cpl_bivector_wrap_vectors (eop_mjd, eop_dut);
151 cpl_bivector_interpolate_linear (mjd_dut, eop_mjd_dut);
152 cpl_bivector_unwrap_vectors (mjd_dut);
153 cpl_bivector_unwrap_vectors (eop_mjd_dut);
154
155 /* Print diagnostics */
156 cpl_msg_info(cpl_func, "EOP averages: MJD=%.2f DUT1=%.3f PMX=%.3farcsec PMY=%.3farcsec",
157 cpl_vector_get_mean (vmjd), cpl_vector_get_mean (vdut),
158 cpl_vector_get_mean (vpmx), cpl_vector_get_mean (vpmy));
159
160 /* Unwrap vectors */
161 cpl_vector_unwrap (vmjd);
162 cpl_vector_unwrap (vpmx);
163 cpl_vector_unwrap (vpmy);
164 cpl_vector_unwrap (vdut);
165 cpl_vector_unwrap (eop_mjd);
166 cpl_vector_unwrap (eop_pmx);
167 cpl_vector_unwrap (eop_pmy);
168 cpl_vector_unwrap (eop_dut);
169
170 CPLCHECK_MSG ("Cannot interpolate EOP");
171
173 return CPL_ERROR_NONE;
174}
175
176/*
177 * Quick transform from BCRS to Observed
178 * rc,dc double ICRS right ascension at J2000.0 (radians)
179 */
180void eraAtboq (double rc, double dc, eraASTROM *astrom, double enuob[3])
181{
182 double ri, di;
183 double aob, zob, hob, dob, rob;
184
185 /* Transform from BCRS to Intermediate */
186 eraAtciq (rc, dc, 0.0, 0.0, 0.0, 0.0, astrom, &ri, &di);
187
188 /* Transform from Intermediate to Observed. */
189 eraAtioq (ri, di, astrom, &aob, &zob, &hob, &dob, &rob);
190
191 /* Convert from equatorial to cartesian */
192 eraS2c(CPL_MATH_PI/2.0-aob, CPL_MATH_PI/2.0-zob, enuob);
193}
194
195void rotate_vector (double in[3], double angle, double axis[3], double out[3])
196{
197 double rv[3];
198 double rm[3][3];
199 eraSxp(angle, axis, rv);
200 eraRv2m(rv, rm);
201 eraRxp(rm, in, out);
202}
203
204/*----------------------------------------------------------------------------*/
226/*----------------------------------------------------------------------------*/
227
228cpl_error_code gravi_eop_pointing_uv (cpl_table * input_table,
229 cpl_propertylist * header,
230 cpl_table * eop_table,
231 cpl_propertylist * eop_header,
232 int save_pointing,
233 cpl_table * array_table)
234{
236 cpl_ensure_code (input_table, CPL_ERROR_NULL_INPUT);
237 cpl_ensure_code (header, CPL_ERROR_NULL_INPUT);
238
239 /* Check and announce the optional parameters */
240 if (save_pointing > 0) {
241 cpl_msg_info (cpl_func, "Will save [E_U,E_V,E_W,E_AZ,E_ZD]");
242 }
243 int compute_uv;
244 if (array_table != NULL) {
245 cpl_msg_info (cpl_func, "Will compute [UCOORD,VCOORD]");
246 compute_uv = 1;
247 } else {
248 compute_uv = 0;
249 }
250
251 double t_skip = 1./24/3600, mjd0 = -1.0, mjd1 = -1.0;
252 cpl_msg_info (cpl_func, "Compute pointing with full ERFA every %.2f s",t_skip*24*3600.0);
253
254 /* If requested, loop on bases to compute the physical 3D baseline as T2-T1
255 * Note: The telescope locations STAXYZ are given in the [West,South,Up]
256 * frame (ESO convention), whereas the UVW, calculated later on, are in
257 * the [East,North,Up] frame. Hence the sign changes below on X and Y. */
258 double baseline[GRAVI_NBASE][3];
259 double * uCoord;
260 double * vCoord;
261 if (compute_uv) {
262 for ( int base = 0; base < GRAVI_NBASE; base ++) {
263 int tel1=0; while ( cpl_table_get (array_table, "STA_INDEX", tel1, NULL) != gravi_table_get_value (input_table, "STA_INDEX", base, 0) ) tel1++;
264 int tel2=0; while ( cpl_table_get (array_table, "STA_INDEX", tel2, NULL) != gravi_table_get_value (input_table, "STA_INDEX", base, 1) ) tel2++;
265 baseline[base][0] = -(gravi_table_get_value (array_table, "STAXYZ", tel2, 0) - gravi_table_get_value (array_table, "STAXYZ", tel1, 0));
266 baseline[base][1] = -(gravi_table_get_value (array_table, "STAXYZ", tel2, 1) - gravi_table_get_value (array_table, "STAXYZ", tel1, 1));
267 baseline[base][2] = +(gravi_table_get_value (array_table, "STAXYZ", tel2, 2) - gravi_table_get_value (array_table, "STAXYZ", tel1, 2));
268 }
269 uCoord = cpl_table_get_data_double (input_table, "UCOORD");
270 vCoord = cpl_table_get_data_double (input_table, "VCOORD");
271 }
272
273 /* Read UTC as MJD */
274 double *mjd = cpl_table_get_data_double (input_table, "MJD");
275 double mean_mjd = cpl_table_get_column_mean (input_table, "MJD");
276
277 /* If requested, create [E_U,E_V,E_V,E_AZ,E_ZD] columns */
278 cpl_array ** p_u;
279 cpl_array ** p_v;
280 cpl_array ** p_w;
281 cpl_array ** p_az;
282 cpl_array ** p_zd;
283 if (save_pointing) {
284 cpl_msg_info (cpl_func, "Saving E_U, E_V, E_W, E_AZ, E_ZD");
285 cpl_table_new_column_array (input_table, "E_U", CPL_TYPE_DOUBLE, 3);
286 cpl_table_new_column_array (input_table, "E_V", CPL_TYPE_DOUBLE, 3);
287 cpl_table_new_column_array (input_table, "E_W", CPL_TYPE_DOUBLE, 3);
288 cpl_table_new_column_array (input_table, "E_AZ", CPL_TYPE_DOUBLE, 3);
289 cpl_table_new_column_array (input_table, "E_ZD", CPL_TYPE_DOUBLE, 3);
290 p_u = cpl_table_get_data_array (input_table,"E_U");
291 p_v = cpl_table_get_data_array (input_table,"E_V");
292 p_w = cpl_table_get_data_array (input_table,"E_W");
293 p_az = cpl_table_get_data_array (input_table,"E_AZ");
294 p_zd = cpl_table_get_data_array (input_table,"E_ZD");
295 CPLCHECK_MSG ("Cannot create [E_U, E_V, E_W, E_AZ, E_ZD]");
296 }
297
298 /* Get the location of the observer from the header */
299 double elev = gravi_pfits_get_geoelev (header); // Height in [m]
300 double lon = gravi_pfits_get_geolon (header) * CPL_MATH_RAD_DEG; // Lat in [rad]
301 double lat = gravi_pfits_get_geolat (header) * CPL_MATH_RAD_DEG; // Lon in [rad], East positive
302 CPLCHECK_MSG ("Cannot get the observer location");
303
304 /* If EOP are supplied, interpolate to the mean MJD */
305 double dut1 = 0, pmx = 0, pmy = 0;
306 if (eop_table != NULL) {
307 gravi_eop_interpolate (1, &mean_mjd, &pmx, &pmy, &dut1,
308 eop_table, eop_header);
309 CPLCHECK_MSG ("Cannot interpolate");
310 } else {
311 cpl_msg_warning (cpl_func, "No EOP_PARAM. Use EOP and DUT=0.0s");
312 }
313
314 /* We use the mid-point between FT and SC to compute the UV coordinates */
315 double rc = gravi_pfits_get_mid_raep (header); // [rad]
316 double dc = gravi_pfits_get_mid_decep (header); // [rad]
317 double pmr = gravi_pfits_get_pmra (header) * CPL_MATH_RAD_DEG / 3600.0 / cos(dc); // dRA/dt, not cos(Dec)xdRA/dt [rad/year]
318 double pmd = gravi_pfits_get_pmdec (header) * CPL_MATH_RAD_DEG / 3600.0; // dDec/dt [rad/year]
319 double parallax = gravi_pfits_get_plx (header); // [as]
320 double sysvel = 0.0;
321 CPLCHECK_MSG ("Cannot get the header data");
322
323 /* Prepare the following loop computations */
324 eraASTROM astrom;
325 double eo;
326 double eps = 10.0 / 3600.0 * CPL_MATH_RAD_DEG; // 10 arcsec has been chosen for optimal accuracy
327 double rb, db;
328 double eUb[3], eVb[3], eWb[3], eZb[3];
329 double eWo_up[3], eWo_um[3], eWo_vp[3], eWo_vm[3];
330 double eWb_up[3], eWb_um[3], eWb_vp[3], eWb_vm[3];
331 double rb_up, db_up, rb_um, db_um, rb_vp, db_vp, rb_vm, db_vm;
332 double eUo[3], eVo[3], eWo[3], eAZo[3], eZDo[3];
333 double ez[3] = {0.0, 0.0, 1.0}; // Zenith direction in ENU frame
334 double norm;
335 double pressure = 0.0; // Pressure at zero to disable atmospheric refraction
336 double temperature = 0.0;
337 double humidity = 0.0;
338 double wavelength = 0.0;
339
340 /* Loop on rows. The baselines are not assumed to share the
341 * same MJD since this function is called after the averaging */
342 cpl_size n_row = cpl_table_get_nrow (input_table);
343 for (cpl_size row = 0 ; row < n_row ; row++) {
344
345 /* If the time is strickly the same as previous row, we skip this computation */
346 if (mjd[row] != mjd1 ) {
347
348 /* Full transformation from ICRS to Observed
349 * update every t_skip, otherwise rotate earth only */
350 if ( fabs (mjd[row]-mjd0) > t_skip ) {
351 eraApco13 (2400000.5, mjd[row], dut1, lon, lat, elev,
352 pmx/3600.0*CPL_MATH_RAD_DEG, pmy/3600.0*CPL_MATH_RAD_DEG,
353 pressure, temperature, humidity, wavelength,
354 &astrom, &eo);
355 mjd0 = mjd[row];
356 }
357 else
358 eraAper13 (2400000.5, mjd[row] + dut1/(24.0*3600.0), &astrom);
359
360 /* Apply proper motion (ICRS->BCRS) */
361 eraPmpx(rc, dc, pmr, pmd, parallax, sysvel, astrom.pmt, astrom.eb, eWb);
362 eraC2s(eWb, &rb, &db);
363
364 /* Create (eU,eV,eW) in the BCRS */
365 eraS2c(0.0, CPL_MATH_PI/2.0, eZb); // eZc is the unit vector to the ICRS pole
366 eraPxp(eZb, eWb, eUb); // eUc is the cross product of eZc and eWc
367 eraPn(eUb, &norm, eUb); // eUc is normalized to a unit vector
368 eraPxp(eWb, eUb, eVb); // eWc is the cross product of eWc and eUc
369
370 /* Create a 10 arcsec cardinal asterism around eWb in the BCRS */
371 rotate_vector(eWb, -eps, eVb, eWb_up);
372 rotate_vector(eWb, +eps, eVb, eWb_um);
373 rotate_vector(eWb, +eps, eUb, eWb_vp);
374 rotate_vector(eWb, -eps, eUb, eWb_vm);
375 eraC2s(eWb_up, &rb_up, &db_up);
376 eraC2s(eWb_um, &rb_um, &db_um);
377 eraC2s(eWb_vp, &rb_vp, &db_vp);
378 eraC2s(eWb_vm, &rb_vm, &db_vm);
379
380 /* Transform the pointing direction and the cardinal asterism from BCRS to observed */
381 eraAtboq (rb , db , &astrom, eWo );
382 eraAtboq (rb_up, db_up, &astrom, eWo_up);
383 eraAtboq (rb_um, db_um, &astrom, eWo_um);
384 eraAtboq (rb_vp, db_vp, &astrom, eWo_vp);
385 eraAtboq (rb_vm, db_vm, &astrom, eWo_vm);
386
387 /* Compute the observed (eUo,eVo,eWo) reference frame */
388 eraPxp(eWo_up, eWo_um, eUo);
389 eraPxp(eWo, eUo, eUo);
390 eraSxp(1./(2.0*eps), eUo, eUo);
391 eraPxp(eWo_vp, eWo_vm, eVo);
392 eraPxp(eWo, eVo, eVo);
393 eraSxp(1./(2.0*eps), eVo, eVo);
394
395 /* Using eWo and zenith directions, compute eAz */
396 eraPxp(eWo, ez, eAZo);
397 eraPn(eAZo, &norm, eAZo);
398
399 /* Using eWo and azimuth directions, compute eZd */
400 eraPxp(eWo, eAZo, eZDo);
401 eraPn(eZDo, &norm, eZDo);
402 }
403
404 /* If requested, store [E_U,E_V,E_V,E_AZ,E_ZD] columns */
405 if (save_pointing) {
406 if (mjd[row] != mjd1 ) {
407 double * eU = cpl_malloc (sizeof(double) * 3);
408 double * eV = cpl_malloc (sizeof(double) * 3);
409 double * eW = cpl_malloc (sizeof(double) * 3);
410 double * eAZ = cpl_malloc (sizeof(double) * 3);
411 double * eZD = cpl_malloc (sizeof(double) * 3);
412 for ( cpl_size c = 0; c < 3; c++) {
413 eU[c] = eUo[c];
414 eV[c] = eVo[c];
415 eW[c] = eWo[c];
416 eAZ[c] = eAZo[c];
417 eZD[c] = eZDo[c];
418 }
419 /* Wrap into vectors. It makes the data valid, and is the fastest
420 * This and the duplication take most of the time of this function */
421 p_u[row] = cpl_array_wrap_double (eU, 3);
422 p_v[row] = cpl_array_wrap_double (eV, 3);
423 p_w[row] = cpl_array_wrap_double (eW, 3);
424 p_az[row] = cpl_array_wrap_double (eAZ, 3);
425 p_zd[row] = cpl_array_wrap_double (eZD, 3);
426 } else {
427 p_u[row] = cpl_array_duplicate (p_u [row-1]);
428 p_v[row] = cpl_array_duplicate (p_v [row-1]);
429 p_w[row] = cpl_array_duplicate (p_w [row-1]);
430 p_az[row] = cpl_array_duplicate (p_az[row-1]);
431 p_zd[row] = cpl_array_duplicate (p_zd[row-1]);
432 }
433 }
434
435 /* If requested, compute the projected baseline [UCOORD,VCOORD]
436 * Note: The baseline length is corrected by the air refractive index
437 * at the HeNe wavelength and Paranal pressure. We want to use
438 * the vacuum baseline. */
439 double n_air = 1.0002028;
440 if (compute_uv) {
441 int base = row % GRAVI_NBASE;
442 uCoord[row] = (eUo[0] * baseline[base][0] + eUo[1] * baseline[base][1] + eUo[2] * baseline[base][2])/n_air;
443 vCoord[row] = (eVo[0] * baseline[base][0] + eVo[1] * baseline[base][1] + eVo[2] * baseline[base][2])/n_air;
444 }
445
446 mjd1 = mjd[row];
447 CPLCHECK_MSG ("Cannot run the ERFA transform");
448 } /* End loop on rows */
449
451 return CPL_ERROR_NONE;
452}
453
454/*----------------------------------------------------------------------------*/
464/*----------------------------------------------------------------------------*/
465
466cpl_error_code gravi_compute_pointing_uv (gravi_data * p2vmred_data, gravi_data * eop_data)
467{
469 cpl_ensure_code (p2vmred_data, CPL_ERROR_NULL_INPUT);
470
471 /* Get the header */
472 cpl_propertylist * hdr_data = gravi_data_get_header (p2vmred_data);
473
474 /* Get the OI_ARRAY table */
475 cpl_table * oi_array = gravi_data_get_table (p2vmred_data, GRAVI_OI_ARRAY_EXT);
476
477 /* For each type of data SC / FT */
478 int type_data, ntype_data = 2;
479 for (type_data = 0; type_data < ntype_data ; type_data ++) {
480
481 int npol = gravi_pfits_get_pola_num (hdr_data, type_data);
482 cpl_table * oi_vis = gravi_data_get_oi_vis (p2vmred_data, type_data, 0, npol);
483
484 /* Verbose */
485 cpl_msg_info(cpl_func, "Compute pointing for %s ",type_data==GRAVI_FT?"FT":"SC");
486
487 /* Compute for this polarisation */
488 gravi_eop_pointing_uv (oi_vis, hdr_data,
489 (eop_data ? gravi_data_get_table_x (eop_data, 0) : NULL),
490 (eop_data ? gravi_data_get_header (eop_data) : NULL),
491 type_data==GRAVI_FT?0:1,
492 oi_array);
493 CPLCHECK_MSG ("Cannot compute pointing");
494
495 /* If second polarisation, for SC only, duplicate [E_U,E_V,E_V,E_AZ,E_ZD] */
496 if ((npol > 1) && (type_data==GRAVI_SC)) {
497 cpl_msg_debug (cpl_func,"Duplicate in the 2nd polarisation");
498
499 cpl_table * oi_vis_1 = gravi_data_get_oi_vis (p2vmred_data, type_data, 1, npol);
500 cpl_table_duplicate_column (oi_vis_1, "E_U", oi_vis, "E_U");
501 cpl_table_duplicate_column (oi_vis_1, "E_V", oi_vis, "E_V");
502 cpl_table_duplicate_column (oi_vis_1, "E_W", oi_vis, "E_W");
503 cpl_table_duplicate_column (oi_vis_1, "E_AZ", oi_vis, "E_AZ");
504 cpl_table_duplicate_column (oi_vis_1, "E_ZD", oi_vis, "E_ZD");
505
506 CPLCHECK_MSG ("Cannot duplicate");
507 }
508
509 /* If second polarisation, duplicate [UCOORD,VCOORD] */
510 if (npol > 1) {
511 cpl_msg_info (cpl_func,"Duplicate in the 2nd polarisation");
512
513 cpl_table * oi_vis_1 = gravi_data_get_oi_vis (p2vmred_data, type_data, 1, npol);
514 cpl_table_copy_data_double (oi_vis_1, "UCOORD", cpl_table_get_data_double (oi_vis, "UCOORD"));
515 cpl_table_copy_data_double (oi_vis_1, "VCOORD", cpl_table_get_data_double (oi_vis, "VCOORD"));
516 }
517 CPLCHECK_MSG ("Cannot duplicate");
518
519 } /* End loop on FT/SC */
520
522 return CPL_ERROR_NONE;
523}
524
#define gravi_table_get_value(table, name, row, value)
Definition: gravi_cpl.h:49
typedefCPL_BEGIN_DECLS struct _gravi_data_ gravi_data
Definition: gravi_data.h:39
#define gravi_data_get_header(data)
Definition: gravi_data.h:75
#define gravi_data_get_oi_vis(data, type, pol, npol)
Definition: gravi_data.h:46
cpl_msg_debug(cpl_func, "Spectra has <50 pixels -> don't flat")
cpl_propertylist * header
Definition: gravi_old.c:2004
cpl_msg_info(cpl_func, "Compute WAVE_SCAN for %s", GRAVI_TYPE(type_data))
#define GRAVI_OI_ARRAY_EXT
Definition: gravi_pfits.h:83
#define gravi_pfits_get_mid_decep(plist)
Definition: gravi_pfits.h:208
#define GRAVI_SC
Definition: gravi_pfits.h:165
#define gravi_pfits_get_mid_raep(plist)
Definition: gravi_pfits.h:209
#define GRAVI_FT
Definition: gravi_pfits.h:166
#define gravi_msg_function_exit(flag)
Definition: gravi_utils.h:85
#define gravi_msg_function_start(flag)
Definition: gravi_utils.h:84
#define CPLCHECK_MSG(msg)
Definition: gravi_utils.h:45
#define GRAVI_NBASE
Definition: gravi_utils.h:105
cpl_table * gravi_data_get_table(gravi_data *self, const char *extname)
Return a pointer on a table extension by its EXTNAME.
Definition: gravi_data.c:2096
cpl_table * gravi_data_get_table_x(gravi_data *self, int i)
Get the table of an extension by position.
Definition: gravi_data.c:1901
void dtp2s(double xi, double eta, double raz, double decz, double *ra, double *dec)
cpl_error_code gravi_eop_interpolate(cpl_size n, double *mjd, double *pmx, double *pmy, double *dut, cpl_table *eop_table, cpl_propertylist *header)
Definition: gravi_eop.c:86
void difference(double x[3], double y[3], double z[3])
void cross(double x[3], double y[3], double z[3])
void eraAtboq(double rc, double dc, eraASTROM *astrom, double enuob[3])
Definition: gravi_eop.c:180
void multiply(double xyz[3], double factor)
cpl_error_code gravi_eop_pointing_uv(cpl_table *input_table, cpl_propertylist *header, cpl_table *eop_table, cpl_propertylist *eop_header, int save_pointing, cpl_table *array_table)
Compute the pointing directions and projected baselines.
Definition: gravi_eop.c:228
cpl_error_code gravi_compute_pointing_uv(gravi_data *p2vmred_data, gravi_data *eop_data)
Compute the pointing directions and projected baselines in OI_VIS.
Definition: gravi_eop.c:466
void rotate_vector(double in[3], double angle, double axis[3], double out[3])
Definition: gravi_eop.c:195
void eraAtcoq(double rc, double dc, double pmr, double pmd, double px, double rv, eraASTROM *astrom, double enuob[3])
void normalize(double xyz[3])
int gravi_pfits_get_pola_num(const cpl_propertylist *plist, int type_data)
Definition: gravi_pfits.c:263
double gravi_pfits_get_geolon(const cpl_propertylist *plist)
Definition: gravi_pfits.c:419
double gravi_pfits_get_pmra(const cpl_propertylist *plist)
Definition: gravi_pfits.c:119
double gravi_pfits_get_plx(const cpl_propertylist *plist)
Definition: gravi_pfits.c:133
double gravi_pfits_get_geolat(const cpl_propertylist *plist)
Definition: gravi_pfits.c:411
double gravi_pfits_get_pmdec(const cpl_propertylist *plist)
Definition: gravi_pfits.c:126
double gravi_pfits_get_geoelev(const cpl_propertylist *plist)
Definition: gravi_pfits.c:427