VISIR Pipeline Reference Manual  4.1.7
visir_spc_photom.c
1 /* $Id: visir_spc_photom.c,v 1.64 2013-03-04 09:00:00 jtaylor Exp $
2  *
3  * This file is part of the VISIR 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., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: jtaylor $
23  * $Date: 2013-03-04 09:00:00 $
24  * $Revision: 1.64 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 /*-----------------------------------------------------------------------------
33  Includes
34  -----------------------------------------------------------------------------*/
35 
36 #include <string.h>
37 #include <math.h>
38 #include <assert.h>
39 
40 #include "irplib_framelist.h"
41 
42 #include "visir_spc_photom.h"
43 
44 #include "visir_parameter.h"
45 #include "visir_utils.h"
46 #include "visir_pfits.h"
47 #include "visir_spc_distortion.h"
48 
49 /*-----------------------------------------------------------------------------
50  Private Function prototypes
51  -----------------------------------------------------------------------------*/
52 
53 static cpl_bivector * visir_spc_phot_model_from_cat(const char *, double,
54  double);
55 static int visir_spc_phot_model_rebin(const cpl_bivector *, cpl_table *);
56 
57 static cpl_error_code visir_spc_sens_stat(const visir_spc_config *,
58  double *, double *, double *,
59  const cpl_table *);
60 
61 static cpl_error_code visir_spc_phot_qc(cpl_propertylist *,
62  const char *, double, double, double,
63  double, double);
64 
65 /*----------------------------------------------------------------------------*/
69 /*----------------------------------------------------------------------------*/
70 
74 /*----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------*/
89 cpl_error_code
90 visir_spc_phot_sensit(const irplib_framelist * rawframes,
91  const visir_spc_config * pconfig,
92  const cpl_propertylist * plist,
93  const char * star_cat,
94  cpl_image ** pweight2d,
95  cpl_propertylist * qclist,
96  cpl_table * spc_table,
97  const char * dit_key)
98 
99 {
100  cpl_errorstate cleanstate = cpl_errorstate_get();
101  cpl_bivector * flux_model = NULL;
102  double * ext_array;
103  double * spc_array;
104  double * err_array;
105  double sens_median = -1.0; /* Avoid (false) uninit warning */
106  double sens_mean = -1.0; /* Avoid (false) uninit warning */
107  double sens_stdev = -1.0; /* Ditto */
108  double exptime, factor, exectime = -1.;
109  /* Get RA / DEC */
110  const double ra = visir_pfits_get_ra(plist);
111  const double dec = visir_pfits_get_dec(plist);
112  const char * star_name;
113 
114  skip_if (0);
115 
116  /* DIT must be present every where */
117  skip_if(irplib_framelist_contains(rawframes, dit_key,
118  CPL_TYPE_DOUBLE, CPL_FALSE, 0.0));
119  if(irplib_framelist_contains(rawframes, dit_key,
120  CPL_TYPE_DOUBLE, CPL_TRUE, 1e-5)) {
121  /* Allow 0.1 ms difference - or warn */
122  /* FIXME: The recipe does not properly handle non-uniform DITSs */
123  visir_error_reset("DIT differs by more than %g", 1e-5);
124  }
125 
126  /* FIXME: Verify the angular distance */
127  skip_if(irplib_framelist_contains(rawframes, VISIR_PFITS_DOUBLE_RA,
128  CPL_TYPE_DOUBLE, CPL_FALSE, 0.0));
129 
130  /* FIXME: Allow 1 degree difference */
131  skip_if(irplib_framelist_contains(rawframes, VISIR_PFITS_DOUBLE_DEC,
132  CPL_TYPE_DOUBLE, CPL_TRUE, 1.0));
133 
134  skip_if(irplib_framelist_contains(rawframes, VISIR_PFITS_INT_CHOP_NCYCLES,
135  CPL_TYPE_INT, CPL_TRUE, 0.0));
136 
137  skip_if(irplib_framelist_contains(rawframes, VISIR_PFITS_INT_NDIT,
138  CPL_TYPE_INT, CPL_TRUE, 0.0));
139 
140  if (irplib_framelist_contains(rawframes, VISIR_PFITS_STRING_STARNAME,
141  CPL_TYPE_STRING, CPL_TRUE, 0.0)) {
142  visir_error_reset("Rawframe(s) missing standard star name");
143  }
144 
145  if (cpl_propertylist_has(plist, "ESO QC EXPTIME"))
146  exptime = cpl_propertylist_get_double(plist, "ESO QC EXPTIME");
147  else {
148  const int nnod = irplib_framelist_get_size(rawframes);
149  exptime = visir_utils_get_exptime(nnod, plist);
150  }
151  cpl_msg_info(cpl_func, "Exposure time: %.3f", exptime);
152  if (cpl_propertylist_has(plist, "ESO QC EXECTIME"))
153  exectime = cpl_propertylist_get_double(plist, "ESO QC EXECTIME");
154 
155  skip_if (exptime <= 0.0);
156 
157  factor = sqrt(exptime)/6.0; /* sqrt(exptime/3600) * 10; */
158 
159  /* Get the standard star name */
160  star_name = visir_pfits_get_starname(plist);
161  if (star_name == NULL) visir_error_reset("Could not get standard star name");
162 
163  /* Get the flux model from the catalog */
164  if ((flux_model=visir_spc_phot_model_from_cat(star_cat, ra, dec)) == NULL) {
165  cpl_msg_error(cpl_func, "Cannot retrieve the flux model from the cat.");
166  skip_if(1);
167  }
168 
169  /* Extract the interesting part of the flux model and rebin it */
170  if (visir_spc_phot_model_rebin(flux_model, spc_table) == -1) {
171  cpl_msg_error(cpl_func, "Cannot rebin the flux model");
172  skip_if(1);
173  }
174  cpl_bivector_delete(flux_model);
175  flux_model = NULL;
176 
177  /* Compute the sensitivity */
178  /* Sensitivity = model * error * 10 * sqrt(DIT*NDIT*NFILES*NCHOP*2)
179  / extracted */
180  cpl_table_duplicate_column(spc_table, "SENSITIVITY", spc_table,
181  "STD_STAR_MODEL");
182  cpl_table_set_column_unit(spc_table, "SENSITIVITY", "mJy");
183 
184  ext_array = cpl_table_get_data_double(spc_table, "SENSITIVITY");
185  spc_array = cpl_table_get_data_double(spc_table, "SPC_EXTRACTED");
186  err_array = cpl_table_get_data_double(spc_table, "SPC_ERROR");
187 
188  for (cpl_size i = 0; i < cpl_table_get_nrow(spc_table); i++) {
189  ext_array[i] *= factor * err_array[i];
190  if (ext_array[i] < 0 || spc_array[i] <= 0) {
191  cpl_msg_warning(cpl_func, "Setting non-physical sensitivity in row %d "
192  "to 0: %g/%g", (int)i+1, ext_array[i], spc_array[i]);
193  ext_array[i] = 0;
194  } else {
195  ext_array[i] /= spc_array[i];
196  }
197  }
198 
199  skip_if(visir_spc_sens_stat(pconfig, &sens_median, &sens_mean, &sens_stdev, spc_table));
200 
201  /* This column is not part of the product */
202  skip_if (cpl_table_erase_column(spc_table, "SPC_EMISSIVITY"));
203 
204  skip_if (visir_spc_phot_qc(qclist, star_name, exptime, exectime,
205  sens_median, sens_mean, sens_stdev));
206 
207  /* Plot the results */
208  if (pconfig->plot) {
209  visir_table_plot("", "t 'Extracted spectrum' w lines", "", spc_table,
210  "WLEN", "SPC_EXTRACTED");
211  visir_table_plot("", "t 'Extracted spectrum error' w lines", "",
212  spc_table, "WLEN", "SPC_ERROR");
213  visir_table_plot("", "t 'Standard star model' w lines", "", spc_table,
214  "WLEN", "STD_STAR_MODEL");
215  visir_table_plot("set grid;", "t 'Sensitivity (mJy)' w lines", "",
216  spc_table, "WLEN", "SENSITIVITY");
217  visir_image_plot("", "t 'The weight map'", "", *pweight2d);
218  }
219 
220  end_skip;
221  cpl_bivector_delete(flux_model);
222 
223  return cpl_error_get_code();
224 }
225 
226 /*----------------------------------------------------------------------------*/
247 /*----------------------------------------------------------------------------*/
248 cpl_table *
249 visir_spc_phot_sensit_from_image(cpl_image ** combined,
250  const irplib_framelist * rawframes,
251  const visir_spc_config * pconfig,
252  const char * star_cat,
253  const char * spc_cal_lines,
254  const char * spc_cal_qeff,
255  cpl_image ** pweight2d,
256  cpl_propertylist * qclist,
257  cpl_boolean do_ech,
258  double wlen,
259  double slitw,
260  double temp,
261  double fwhm,
262  const visir_spc_resol resol,
263  const char * dit_key)
264 {
265  const cpl_propertylist * plist;
266  const cpl_frame * frm = NULL;
267  cpl_imagelist * hcycle = NULL;
268  cpl_image * imhcycle = NULL;
269  cpl_image * flipped = NULL;
270  cpl_image * comorder = NULL;
271  cpl_image * order = NULL;
272  cpl_table * spc_table = NULL;
273  visir_data_type dtype;
274 
275  *pweight2d = NULL;
276 
277  skip_if (rawframes == NULL);
278 
279  /* Get the first frame */
280  plist = irplib_framelist_get_propertylist_const(rawframes, 0);
281  frm = irplib_framelist_get_const(rawframes, 0);
282 
283  skip_if (visir_get_data_type(frm, plist, &dtype, NULL));
284 
285  /* Get the HCYCLE frame */
286  hcycle = visir_load_imagelist(rawframes, 0, CPL_FALSE);
287  skip_if (0);
288 
289  skip_if (pconfig->do_fixcombi &&
290  visir_spc_det_fix(combined, 1, CPL_TRUE,
291  wlen, resol,
292  pconfig->phi,
293  pconfig->ksi,
294  pconfig->eps,
295  pconfig->delta,
296  pconfig->plot));
297 
298 
299  imhcycle = cpl_imagelist_unset(hcycle, 0);
300  skip_if (0);
301 
302  skip_if (visir_spc_det_fix(&imhcycle, 1, CPL_FALSE,
303  wlen, resol,
304  pconfig->phi,
305  pconfig->ksi,
306  pconfig->eps,
307  pconfig->delta,
308  pconfig->plot));
309 
310  /* Convert the combined image */
311  flipped = visir_spc_flip(*combined, wlen, resol, dtype);
312  skip_if (0);
313  cpl_image_delete(*combined);
314  *combined = flipped;
315  flipped = NULL;
316 
317  /* Convert the half cycle image */
318  flipped = visir_spc_flip(imhcycle, wlen, resol, dtype);
319  skip_if (0);
320  cpl_image_delete(imhcycle);
321  imhcycle = flipped;
322  flipped = NULL;
323 
324  skip_if(visir_spc_extract_order(&order, &comorder,
325  *combined, imhcycle,
326  wlen, pconfig, do_ech,
327  visir_data_is_aqu(dtype)));
328 
329  if (do_ech) {
330  int icol1, icol2;
331  skip_if (visir_spc_echelle_limit(&icol1, &icol2, wlen,
332  pconfig->orderoffset,
333  1, cpl_image_get_size_y(*combined),
334  visir_data_is_aqu(dtype)));
335  skip_if(visir_qc_append_background(qclist, rawframes, icol1, icol2));
336  }
337  else
338  skip_if(visir_qc_append_background(qclist, rawframes, 0, 0));
339 
340  /* Extract the spectrum */
341  skip_if (visir_spc_extract_wcal(comorder,
342  order, wlen, slitw, temp, fwhm,
343  resol, pconfig->orderoffset,
344  spc_cal_lines, spc_cal_qeff,
345  &spc_table, pweight2d,
346  qclist,
347  pconfig->plot, CPL_FALSE,
348  visir_data_is_aqu(dtype)));
349 
350  visir_spc_phot_sensit(rawframes, pconfig, plist, star_cat, pweight2d,
351  qclist, spc_table, dit_key);
352 
353  cpl_imagelist_delete(hcycle);
354  hcycle = NULL;
355 
356 
357  end_skip;
358 
359  cpl_imagelist_delete(hcycle);
360 
361  cpl_image_delete(flipped);
362  cpl_image_delete(imhcycle);
363  cpl_image_delete(order);
364  cpl_image_delete(comorder);
365 
366  if (cpl_error_get_code()) {
367  cpl_table_delete(spc_table);
368  spc_table = NULL;
369  cpl_image_delete(*pweight2d);
370  *pweight2d = NULL;
371  }
372 
373  return spc_table;
374 }
375 
378 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 static cpl_bivector * visir_spc_phot_model_from_cat(const char * star_cat,
392  double ra,
393  double dec)
394 {
395  const double max_radius = VISIR_STAR_MAX_RADIUS;
396  const cpl_table * catalog = NULL; /* Flux model for all stars */
397  int nb_stars;
398  const double * dd;
399  const cpl_array * da;
400  cpl_vector * v_ra = NULL;
401  cpl_vector * v_dec = NULL;
402  int min_dist_ind;
403  cpl_bivector * model = NULL;
404  cpl_vector * model_x = NULL;
405  cpl_vector * model_y = NULL;
406  const double conv_mJy = 3.33E8; /* FIXME: 1e8/3 ? */
407  double star_dist;
408  int nb_vals;
409 
410 
411  bug_if (0);
412 
413  /* Open the star catalog */
414  catalog = cpl_table_load(star_cat, 1, 0);
415  if (catalog == NULL) {
416  cpl_msg_error(cpl_func, "Could not open the star catalog: %s",
417  star_cat ? star_cat : "<NULL>");
418  skip_if(1);
419  }
420 
421  nb_stars = cpl_table_get_nrow(catalog);
422 
423  skip_if(nb_stars < 1);
424 
425  /* Get the RA and DEC columns */
426  dd = cpl_table_get_data_double_const(catalog, "RA");
427  skip_if (dd == NULL);
428  IRPLIB_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
429  v_ra = cpl_vector_wrap(nb_stars, (double*)dd); /* v_ra is _not_ modified */
430  IRPLIB_DIAG_PRAGMA_POP;
431  bug_if( v_ra == NULL);
432 
433  dd = cpl_table_get_data_double_const(catalog, "DEC");
434  skip_if (dd == NULL);
435  IRPLIB_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
436  v_dec = cpl_vector_wrap(nb_stars, (double*)dd); /* v_dec is _not_ modified */
437  IRPLIB_DIAG_PRAGMA_POP;
438  bug_if( v_dec == NULL);
439 
440  /* Find the star closest to the given ra, dec */
441  min_dist_ind = visir_star_find(v_ra, v_dec, ra, dec, max_radius, &star_dist);
442 
443  skip_if (min_dist_ind < 0);
444 
445  cpl_msg_info(cpl_func, "The standard star closest to (RA,DEC)=(%g,%g) is "
446  "no. %d, '%s' at (RA,DEC)=(%g,%g) with the distance [degree]: "
447  "%g", ra, dec, 1+min_dist_ind,
448  cpl_table_get_string(catalog, "STARS", min_dist_ind),
449  cpl_table_get_double(catalog, "RA", min_dist_ind, NULL),
450  cpl_table_get_double(catalog, "DEC", min_dist_ind, NULL),
451  star_dist);
452 
453  /* Get the wavelengths of the star model */
454  da = cpl_table_get_array(catalog, "WAVELENGTHS", min_dist_ind);
455  skip_if (da == NULL);
456  dd = cpl_array_get_data_double_const(da);
457  skip_if (dd == NULL);
458 
459  nb_vals = cpl_array_get_size(da);
460 
461  model_x = cpl_vector_new(nb_vals);
462  memcpy(cpl_vector_get_data(model_x), dd, nb_vals * sizeof(double));
463 
464  /* Get the corresponding fluxes of the star model */
465  da = cpl_table_get_array(catalog, "MODEL_FLUX", min_dist_ind);
466  skip_if (da == NULL);
467  dd = cpl_array_get_data_double_const(da);
468  skip_if (dd == NULL);
469 
470  skip_if (nb_vals != cpl_array_get_size(da));
471 
472  model_y = cpl_vector_new(nb_vals);
473  memcpy(cpl_vector_get_data(model_y), dd, nb_vals * sizeof(double));
474 
475  /* Convert from W/m2/m to mJy with * 3.33 * 10^8 * lamda * lamda */
476  bug_if (cpl_vector_multiply_scalar(model_y, conv_mJy));
477  bug_if (cpl_vector_multiply(model_y, model_x));
478  bug_if (cpl_vector_multiply(model_y, model_x));
479 
480  /* Convert from microns to meters */
481  bug_if (cpl_vector_multiply_scalar(model_x, 1e-6));
482 
483  model = cpl_bivector_wrap_vectors(model_x, model_y);
484 
485  bug_if (model == NULL);
486 
487  end_skip;
488 
489  (void)cpl_vector_unwrap(v_ra);
490  (void)cpl_vector_unwrap(v_dec);
491  IRPLIB_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
492  cpl_table_delete((cpl_table*)catalog);
493  IRPLIB_DIAG_PRAGMA_POP;
494 
495  if (cpl_error_get_code()) {
496  /* At this point model is certain to be NULL */
497  cpl_vector_delete(model_x);
498  cpl_vector_delete(model_y);
499  }
500 
501  return model;
502 }
503 
504 /*----------------------------------------------------------------------------*/
510 /*----------------------------------------------------------------------------*/
511 static int visir_spc_phot_model_rebin(
512  const cpl_bivector * model,
513  cpl_table * spec_tab)
514 {
515  cpl_vector * bounds = NULL;
516  cpl_vector * spec = NULL;
517  double bin_pos;
518  const int nrow = cpl_table_get_nrow(spec_tab);
519  int i;
520 
521 
522  skip_if (0);
523 
524  /* Create bounds */
525  bounds = cpl_vector_new(nrow + 1);
526  for (i=1 ; i<cpl_vector_get_size(bounds) - 1 ; i++) {
527  bin_pos = (cpl_table_get(spec_tab, "WLEN", i-1, NULL) +
528  cpl_table_get(spec_tab, "WLEN", i, NULL)) / 2.0;
529  cpl_vector_set(bounds, i, bin_pos);
530  }
531  bin_pos = cpl_table_get(spec_tab, "WLEN", 0, NULL) -
532  ((cpl_table_get(spec_tab, "WLEN", 1, NULL) -
533  cpl_table_get(spec_tab, "WLEN", 0, NULL)) / 2.0);
534  cpl_vector_set(bounds, 0, bin_pos);
535  bin_pos =
536  cpl_table_get(spec_tab, "WLEN", nrow-1, NULL) +
537  ((cpl_table_get(spec_tab,"WLEN", 1, NULL) -
538  cpl_table_get(spec_tab, "WLEN", 0, NULL)) / 2.0);
539  cpl_vector_set(bounds, cpl_vector_get_size(bounds)-1, bin_pos);
540 
541  /* Create the interpolated spectrum */
542  spec = cpl_vector_new(nrow);
543 
544  /* Interpolate the spectrum */
545  if (visir_vector_resample(spec, bounds, model)) {
546  cpl_msg_error(cpl_func, "Cannot rebin the spectrum");
547  skip_if(1);
548  }
549 
550  /* Add the result in spec_tab */
551  cpl_table_new_column(spec_tab, "STD_STAR_MODEL", CPL_TYPE_DOUBLE);
552  cpl_table_set_column_unit(spec_tab, "STD_STAR_MODEL", "mJy");
553  for (i=0 ; i<nrow ; i++) {
554  cpl_table_set_double(spec_tab, "STD_STAR_MODEL", i,
555  cpl_vector_get(spec, i));
556  }
557 
558  end_skip;
559 
560  cpl_vector_delete(spec);
561  cpl_vector_delete(bounds);
562 
563  return cpl_error_get_code();
564 }
565 
566 /*----------------------------------------------------------------------------*/
576 /*----------------------------------------------------------------------------*/
577 static cpl_error_code visir_spc_sens_stat(const visir_spc_config * pconfig,
578  double * psens_median,
579  double * psens_mean,
580  double * psens_stdev,
581  const cpl_table * spc_table)
582 {
583 
584  cpl_vector * sens_ignore = NULL;
585  cpl_vector * sens_mini = NULL;
586  double emis_min, emis_max;
587  const int npix = cpl_table_get_nrow(spc_table);
588  const int npix_ignore = 3;
589  int i;
590  int iok;
591 
592  skip_if(0);
593 
594  skip_if(pconfig == NULL);
595 
596  /* Compute mean and stdev of the sensitivity signal
597  - ignore first and last npix_ignore elements */
598  /* FIXME: Use cpl_table_select() */
599  /* sens_ignore will _not_ be modified */
600  IRPLIB_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
601  sens_ignore = cpl_vector_wrap( npix - 2*npix_ignore, (double*)
602  cpl_table_get_data_double_const(spc_table,
603  "SENSITIVITY") + npix_ignore);
604  IRPLIB_DIAG_PRAGMA_POP;
605  skip_if(0);
606 
607  if (pconfig->plot)
608  visir_vector_plot("set grid;","t 'Truncated Sensitivity (mJy)' w lines",
609  "", sens_ignore);
610 
611  sens_mini = cpl_vector_duplicate(sens_ignore);
612  skip_if(0);
613 
614  emis_min = cpl_table_get_column_min(spc_table, "SPC_EMISSIVITY");
615  emis_max = cpl_table_get_column_max(spc_table, "SPC_EMISSIVITY");
616  skip_if(0);
617 
618  emis_max = emis_min + pconfig->phot_emis_tol * (emis_max - emis_min);
619 
620  iok = 0;
621  for (i=0; i < npix - 2*npix_ignore; i++) {
622  const double emis = cpl_table_get(spc_table, "SPC_EMISSIVITY",
623  i + npix_ignore, NULL);
624 
625  skip_if(0);
626 
627  if (emis > emis_max) continue;
628 
629  if (i > iok)
630  skip_if(cpl_vector_set(sens_mini, iok, cpl_vector_get(sens_mini, i)));
631 
632  iok++;
633 
634  }
635 
636  assert( iok > 0);
637 
638  skip_if(cpl_vector_set_size(sens_mini, iok));
639 
640  *psens_mean = cpl_vector_get_mean(sens_mini);
641 
642  if (iok == 1) {
643  cpl_msg_warning(cpl_func, "Sensitivity computed on only 1 wavelength "
644  "with emissivity %f", emis_max);
645  *psens_stdev = 0;
646  } else {
647  cpl_msg_info(cpl_func, "Sensitivity computed on %d wavelengths with "
648  "emissivity at most %f", iok, emis_max);
649 
650  *psens_stdev = cpl_vector_get_stdev(sens_mini);
651 
652  }
653 
654  *psens_median = cpl_vector_get_median(sens_mini);
655 
656  end_skip;
657 
658  cpl_vector_unwrap(sens_ignore);
659  cpl_vector_delete(sens_mini);
660 
661  return cpl_error_get_code();
662 
663 }
664 
665 
666 /*----------------------------------------------------------------------------*/
679 /*----------------------------------------------------------------------------*/
680 static cpl_error_code visir_spc_phot_qc(cpl_propertylist * self,
681  const char * star_name,
682  double exptime,
683  double exectime,
684  double sens_median,
685  double sens_mean,
686  double sens_stdev)
687 {
688 
689  bug_if (cpl_propertylist_append_double(self, "ESO QC EXPTIME", exptime));
690  if (exectime > 0) {
691  bug_if (cpl_propertylist_append_double(self, "ESO QC EXECTIME",
692  exectime));
693  }
694  bug_if (cpl_propertylist_append_double(self, "ESO QC SENS MEDIAN",
695  sens_median));
696  bug_if (cpl_propertylist_append_double(self, "ESO QC SENS MEAN", sens_mean));
697  bug_if (cpl_propertylist_append_double(self, "ESO QC SENS STDEV",
698  sens_stdev));
699  /* FIXME: Verify that this is the correct behaviour */
700  bug_if (cpl_propertylist_append_string(self, "ESO QC STARNAME",
701  star_name ? star_name : ""));
702 
703  end_skip;
704 
705  return cpl_error_get_code();
706 
707 }
double visir_pfits_get_dec(const cpl_propertylist *self)
The DEC.
Definition: visir_pfits.c:297
cpl_error_code visir_spc_phot_sensit(const irplib_framelist *rawframes, const visir_spc_config *pconfig, const cpl_propertylist *plist, const char *star_cat, cpl_image **pweight2d, cpl_propertylist *qclist, cpl_table *spc_table, const char *dit_key)
Compute the sensitivity from an extracted spectrum.
const char * visir_pfits_get_starname(const cpl_propertylist *self)
The std star name.
Definition: visir_pfits.c:775
const cpl_propertylist * irplib_framelist_get_propertylist_const(const irplib_framelist *self, int pos)
Get the propertylist of the specified frame in the framelist.
cpl_imagelist * visir_load_imagelist(const irplib_framelist *rawframes, int pos, cpl_boolean is_interm)
Load either a INTERM or Half-Cycle cube from a VISIR file.
const cpl_frame * irplib_framelist_get_const(const irplib_framelist *self, int pos)
Get the specified frame from the framelist.
cpl_table * visir_spc_phot_sensit_from_image(cpl_image **combined, const irplib_framelist *rawframes, const visir_spc_config *pconfig, const char *star_cat, const char *spc_cal_lines, const char *spc_cal_qeff, cpl_image **pweight2d, cpl_propertylist *qclist, cpl_boolean do_ech, double wlen, double slitw, double temp, double fwhm, const visir_spc_resol resol, const char *dit_key)
Extract spectrum from image and compute sensitivity.
cpl_error_code irplib_framelist_contains(const irplib_framelist *self, const char *key, cpl_type type, cpl_boolean is_equal, double fp_tol)
Verify that a property is present for all frames.
double visir_pfits_get_ra(const cpl_propertylist *self)
The RA.
Definition: visir_pfits.c:709
int irplib_framelist_get_size(const irplib_framelist *self)
Get the size of a framelist.