FORS Pipeline Reference Manual  4.12.5
test_simulate.c
1 /* $Id: test_simulate.c,v 1.34 2009-02-25 15:34:48 hlorch Exp $
2  *
3  * This file is part of the FORS Library
4  * Copyright (C) 2002-2006 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 02110-1301 USA
19  */
20 
21 /*
22  * $Author: hlorch $
23  * $Date: 2009-02-25 15:34:48 $
24  * $Revision: 1.34 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 #include <test_simulate.h>
33 
34 #include <fors_instrument.h>
35 #include <fors_image.h>
36 #include <fors_dfs.h>
37 #include <fors_data.h>
38 #include <fors_pfits.h>
39 #include <fors_utils.h>
40 
41 #include <cpl.h>
42 
43 #include <math.h>
44 
45 /* FIXME: - remove FORS_DATA_STD_* !!!
46  * - replace below in create_std_cat()
47  * 1.) by creation of a standard star list, and
48  * 2.) and a new function fors_std_cat_test_create_stetson()
49  * in fors_std_cat.c
50  */
51 const char *const FORS_DATA_STD_MAG[FORS_NUM_FILTER] =
52 {"U",
53  "B",
54  //"G",
55  "V", /* G uses V */
56  "V",
57  "R",
58  "I",
59  "Z"};
60 
61 const char *const FORS_DATA_STD_DMAG[FORS_NUM_FILTER] =
62 {"ERR_U",
63  "ERR_B",
64  //"ERR_G",
65  "ERR_V", /* G uses V */
66  "ERR_V",
67  "ERR_R",
68  "ERR_I",
69  "ERR_Z"};
70 
71 const char *const FORS_DATA_STD_COL[FORS_NUM_FILTER] =
72 {"U_B",
73  "B_V",
74  "B_V",
75  "B_V",
76  "V_R",
77  "V_R",
78  "?Z?"};
79 
80 const char *const FORS_DATA_STD_RA = "RA";
81 const char *const FORS_DATA_STD_DEC = "DEC";
82 const char *const FORS_DATA_STD_NAME = "OBJECT";
83 
94 static const int det_nx = 400; /* Unbinned detector pixels */
95 static const int det_ny = 400;
96 static const int pres_nx = 5;
97 static const int binx = 2;
98 static const int biny = 2;
99 static const double ron = 4.0; /* ADU */
100 static const double conad = 0.78; /* e- / ADU */
101 
102 static const double bias_avg = 200; /* ADU */
103 static const double dark_avg = 50; /* ADU */
104 static const char *const instrume = "fors2";
105 static const char *const chip_id = "Test chip 234";
106 static const char *const read_clock = "200Kps/2ports/low_gain";
107 
115 static cpl_frame *
116 frame_new(const char *filename, const char *tag, cpl_frame_group group)
117 {
118  cpl_frame *f = cpl_frame_new();
119 
120  cpl_frame_set_filename(f, filename);
121  cpl_frame_set_tag (f, tag);
122  cpl_frame_set_group (f, group);
123 
124  return f;
125 }
126 
132 void
133 create_standard_keys(cpl_propertylist *header, double exptime)
134 {
135  int nx = det_nx / binx;
136  int ny = det_ny / biny;
137 
138  cpl_propertylist_update_string(header, "ESO DPR TYPE", "some");
139  cpl_propertylist_update_string(header, "ESO TPL ID", "tpl id.");
140  cpl_propertylist_update_string(header, "ESO INS COLL NAME", "collimator name");
141  cpl_propertylist_update_string(header, "ARCFILE", "archive filename");
142 
143  cpl_propertylist_update_string(header, FORS_PFITS_INSTRUME, instrume);
144  cpl_propertylist_update_string(header, FORS_PFITS_FILTER_NAME, "R_SPECIAL");
145 
146  cpl_propertylist_update_double(header, FORS_PFITS_AIRMASS_START, 1.156);
147  cpl_propertylist_update_double(header, FORS_PFITS_AIRMASS_END , 1.619);
148 
149  cpl_propertylist_update_int (header, "HIERARCH ESO DET CHIP1 NX", nx);
150  cpl_propertylist_update_int (header, "HIERARCH ESO DET CHIP1 NY", ny);
151  cpl_propertylist_update_int (header, "HIERARCH ESO DET OUT1 X", 1);
152  cpl_propertylist_update_int (header, "HIERARCH ESO DET OUT1 Y", 1);
153  cpl_propertylist_update_double(header, "HIERARCH ESO DET CHIP1 PSZX", 15.0);
154  cpl_propertylist_update_double(header, "HIERARCH ESO DET CHIP1 PSZY", 15.0);
155  cpl_propertylist_update_int (header, FORS_PFITS_DET_NY, ny);
156  cpl_propertylist_update_int (header, FORS_PFITS_DET_NX, nx);
157  cpl_propertylist_update_int (header, FORS_PFITS_DET_NY, ny);
158  cpl_propertylist_update_int (header, FORS_PFITS_BINX, binx);
159  cpl_propertylist_update_int (header, FORS_PFITS_BINY, biny);
160  cpl_propertylist_update_int (header, FORS_PFITS_OVERSCANX, 0);
161  cpl_propertylist_update_int (header, FORS_PFITS_OVERSCANY, 0);
162  cpl_propertylist_update_int (header, FORS_PFITS_PRESCANX, pres_nx);
163  cpl_propertylist_update_int (header, FORS_PFITS_PRESCANY, 0);
164 
165  cpl_propertylist_update_double(header, FORS_PFITS_PIXSCALE, 0.126);
166 
167  cpl_propertylist_update_int(header, FORS_PFITS_OUTPUTS, 1);
168  cpl_propertylist_update_double(header, FORS_PFITS_CONAD[0], conad);
169  cpl_propertylist_update_double(header, "HIERARCH ESO DET OUT1 GAIN", 1./conad);
170 
171  /* Convert RON to e- units */
172  cpl_propertylist_update_double(header, FORS_PFITS_RON[0], ron*conad);
173  cpl_propertylist_update_double(header, FORS_PFITS_EXPOSURE_TIME, exptime);
174 
175  cpl_propertylist_update_string(header, FORS_PFITS_CHIP_ID, chip_id);
176  cpl_propertylist_update_string(header, FORS_PFITS_READ_CLOCK, read_clock);
177 
178  /* WCS info, fine tuned to match simulated catalogue */
179  {
180  struct {
181  const char *name;
182  double value;
183  } data[] = {
184  {"CRVAL1", 8.1368333333},
185  {"CRVAL2", -46.9576388889},
186  {"CRPIX1", 1},
187  {"CRPIX2", 1},
188 // {"CD1_1", 5.81347849634012E-21},
189 // {"CD1_2", 9.49444444444444E-05},
190 // {"CD2_1",-9.49444444444444E-05},
191 // {"CD2_2",-5.81347849634012E-21},
192  {"CD1_1", 5.81347849634012E-20},
193  {"CD1_2", 9.49444444444444E-04},
194  {"CD2_1",-9.49444444444444E-04},
195  {"CD2_2",-5.81347849634012E-20},
196  {"PV2_1", 1.0},
197  {"PV2_2", 0.0},
198  {"PV2_3", 42.0},
199  {"PV2_4", 0.0},
200  {"PV2_5", 0.0}
201  };
202 
203  unsigned i;
204  for (i = 0; i < sizeof(data) / sizeof(*data); i++) {
205  cpl_propertylist_append_double(header, data[i].name, data[i].value);
206  }
207  }
208 
209  return;
210 }
211 
212 
213 #undef cleanup
214 #define cleanup \
215 do { \
216  fors_image_delete(&bias); \
217  cpl_propertylist_delete(header); \
218 } while(0)
219 
229 cpl_frame *
230 create_bias(const char *filename, const char *tag, cpl_frame_group group)
231 {
232  int nx = det_nx / binx + pres_nx;
233  int ny = det_ny / biny;
234  double exptime = 0.0;
235 
236  cpl_image *data = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
237  cpl_image *variance = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
238  fors_image *bias = NULL;
239  cpl_propertylist *header = cpl_propertylist_new();
240 
241  create_standard_keys(header, exptime);
242  cpl_propertylist_erase(header, FORS_PFITS_FILTER_NAME); /* No filter */
243 
244  {
245  int x, y;
246  for (y = 1; y <= ny; y++)
247  for (x = 1; x <= nx; x++) {
248  cpl_image_set(data , x, y,
249  (int)(bias_avg + ron*fors_rand_gauss() + 0.5));
250  cpl_image_set(variance, x, y, ron*ron);
251  }
252  }
253 
254  bias = fors_image_new(data, variance);
255  fors_image_save(bias, header, filename);
256 
257  assure( !cpl_error_get_code(), return NULL,
258  "Saving bias to %s failed", filename );
259 
260  cleanup;
261  return frame_new(filename, tag, group);
262 }
263 
273 cpl_frame *
274 create_master_bias(const char *filename, const char *tag, cpl_frame_group group)
275 {
276  int nx = det_nx / binx;
277  int ny = det_ny / biny;
278  double exptime = 0.0;
279 
280  cpl_image *data = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
281  cpl_image *variance = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
282  fors_image *bias = NULL;
283  cpl_propertylist *header = cpl_propertylist_new();
284 
285  create_standard_keys(header, exptime);
286  cpl_propertylist_erase(header, FORS_PFITS_FILTER_NAME); /* No filter */
287 
288  {
289  int x, y;
290  for (y = 1; y <= ny; y++)
291  for (x = 1; x <= nx; x++) {
292  cpl_image_set(data , x, y,
293  (int)(ron*fors_rand_gauss() + 0.5)); //Overscan already removed
294  cpl_image_set(variance, x, y, ron*ron);
295  }
296  }
297 
298  bias = fors_image_new(data, variance);
299  fors_image_save(bias, header, filename);
300 
301  assure( !cpl_error_get_code(), return NULL,
302  "Saving master bias to %s failed", filename );
303 
304  cleanup;
305  return frame_new(filename, tag, group);
306 }
307 
308 #undef cleanup
309 #define cleanup \
310 do { \
311  fors_image_delete(&dark); \
312  cpl_propertylist_delete(header); \
313 } while(0)
314 
325 cpl_frame *
326 create_dark(const char *filename, const char *tag, cpl_frame_group group)
327 {
328  int nx = det_nx / binx + pres_nx;
329  int ny = det_ny / biny;
330  double exptime = 3.0;
331 
332  cpl_image *data = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
333  cpl_image *variance = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
334  fors_image *dark = NULL;
335  cpl_propertylist *header = cpl_propertylist_new();
336 
337  create_standard_keys(header, exptime);
338 
339  {
340  int x, y;
341  for (y = 1; y <= ny; y++)
342  for (x = 1; x <= nx; x++) {
343  double var = ron*ron + dark_avg/conad;
344 
345  cpl_image_set(data , x, y,
346  (int)(bias_avg + dark_avg +
347  sqrt(var)*fors_rand_gauss()
348  + 0.5));
349  cpl_image_set(variance, x, y, var);
350  }
351  //Fill the prescan region
352  for (y = 1; y <= ny; y++)
353  for (x = 1; x <= pres_nx; x++)
354  {
355  cpl_image_set(data , x, y,
356  (int)(bias_avg + ron*fors_rand_gauss() + 0.5));
357  cpl_image_set(variance, x, y, ron*ron);
358  }
359  }
360 
361  dark = fors_image_new(data, variance);
362  fors_image_save(dark, header, filename);
363 
364  assure( !cpl_error_get_code(), return NULL,
365  "Saving dark to %s failed", filename );
366 
367  cleanup;
368  return frame_new(filename, tag, group);
369 }
370 
371 
372 #undef cleanup
373 #define cleanup \
374 do { \
375  fors_image_delete(&sflat); \
376  cpl_propertylist_delete(header); \
377 } while(0)
378 
388 cpl_frame *
389 create_screen_flat(const char *filename, const char *tag, cpl_frame_group group)
390 {
391  int nx = det_nx / binx + pres_nx;
392  int ny = det_ny / biny;
393  double exptime = 3.0;
394 
395  cpl_image *data = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
396  cpl_image *variance = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
397  fors_image *sflat = NULL;
398  cpl_propertylist *header = cpl_propertylist_new();
399 
400  create_standard_keys(header, exptime);
401 
402  {
403  int x, y;
404  for (y = 1; y <= ny; y++)
405  for (x = 1; x <= nx; x++) {
406  double medium_scale_structure = 1000*(2 + sin(x*30.0/nx + y*30.0/ny));
407  double large_scale_structure = 1000*(1 + sin(x*4.0/nx));
408  double flat = 5000 + medium_scale_structure + large_scale_structure;
409  double var = ron*ron + flat/conad;
410 
411  cpl_image_set(data , x, y,
412  (int)(bias_avg + flat + sqrt(var)*fors_rand_gauss() + 0.5));
413  cpl_image_set(variance, x, y, var);
414  }
415  //Fill the prescan region
416  for (y = 1; y <= ny; y++)
417  for (x = 1; x <= pres_nx; x++)
418  {
419  cpl_image_set(data , x, y,
420  (int)(bias_avg + ron*fors_rand_gauss() + 0.5));
421  cpl_image_set(variance, x, y, ron*ron);
422  }
423  }
424 
425  sflat = fors_image_new(data, variance);
426  fors_image_save(sflat, header, filename);
427 
428  assure( !cpl_error_get_code(), return NULL,
429  "Saving screen flat to %s failed", filename );
430 
431  cleanup;
432  return frame_new(filename, tag, group);
433 }
434 
435 #undef cleanup
436 #define cleanup \
437 do { \
438  fors_image_delete(&sflat); \
439  cpl_propertylist_delete(header); \
440 } while(0)
441 
452 cpl_frame *
453 create_sky_flat(const char *filename, const char *tag, cpl_frame_group group,
454  double exptime)
455 {
456  int nx = det_nx / binx + pres_nx;
457  int ny = det_ny / biny;
458 
459  cpl_image *data = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
460  cpl_image *variance = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
461  fors_image *sflat = NULL;
462  cpl_propertylist *header = cpl_propertylist_new();
463 
464  create_standard_keys(header, exptime);
465 
466  {
467  int x, y;
468  for (y = 1; y <= ny; y++)
469  for (x = 1; x <= nx; x++) {
470  double medium_scale_structure = 1000*(2 + sin(x*30.0/nx - y*10.0/ny));
471  double large_scale_structure = 1000*(1 + sin(x*4.0/nx));
472  double flat = exptime*(5000 +
473  medium_scale_structure +
474  large_scale_structure);
475  double var = ron*ron + flat/conad;
476 
477  cpl_image_set(data , x, y,
478  (int)(flat + sqrt(var)*fors_rand_gauss() + 0.5));//Overscan already removed
479  cpl_image_set(variance, x, y, var);
480  }
481  //Fill the prescan region
482  for (y = 1; y <= ny; y++)
483  for (x = 1; x <= pres_nx; x++)
484  {
485  cpl_image_set(data , x, y,
486  (int)(bias_avg + ron*fors_rand_gauss() + 0.5));
487  cpl_image_set(variance, x, y, ron*ron);
488  }
489  }
490 
491  sflat = fors_image_new(data, variance);
492  fors_image_save(sflat, header, filename);
493 
494  assure( !cpl_error_get_code(), return NULL,
495  "Saving sky flat to %s failed", filename );
496 
497  cleanup;
498  return frame_new(filename, tag, group);
499 }
500 
512 cpl_frame *
513 create_master_sky_flat(const char *filename,
514  const char *tag, cpl_frame_group group,
515  double exptime)
516 {
517  int nx = det_nx / binx;
518  int ny = det_ny / biny;
519 
520  cpl_image *data = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
521  cpl_image *variance = cpl_image_new(nx, ny, FORS_IMAGE_TYPE);
522  fors_image *sflat = NULL;
523  cpl_propertylist *header = cpl_propertylist_new();
524 
525  create_standard_keys(header, exptime);
526 
527  {
528  int x, y;
529  for (y = 1; y <= ny; y++)
530  for (x = 1; x <= nx; x++) {
531  double medium_scale_structure = 1000*(2 + sin(x*30.0/nx - y*10.0/ny));
532  double large_scale_structure = 1000*(1 + sin(x*4.0/nx));
533  double flat = exptime*(5000 +
534  medium_scale_structure +
535  large_scale_structure);
536  double var = ron*ron + flat/conad;
537 
538  cpl_image_set(data , x, y,
539  (int)(flat + sqrt(var)*fors_rand_gauss() + 0.5));//Overscan already removed
540  cpl_image_set(variance, x, y, var);
541  }
542  }
543 
544  sflat = fors_image_new(data, variance);
545  fors_image_save(sflat, header, filename);
546 
547  assure( !cpl_error_get_code(), return NULL,
548  "Saving sky flat to %s failed", filename );
549 
550  cleanup;
551  return frame_new(filename, tag, group);
552 }
553 
561 cpl_frame *
562 create_standard(const char *filename, const char *tag, cpl_frame_group group)
563 {
564  // fixme: add stars
565  double exptime = 1.0;
566  return create_sky_flat(filename, tag, group, exptime);
567 }
568 
569 
570 #undef cleanup
571 #define cleanup \
572 do { \
573  cpl_table_delete(t); \
574 } while(0)
575 
583 cpl_frame *
584 create_std_cat(const char *filename, const char *tag, cpl_frame_group group)
585 {
586  cpl_table *t;
587  struct {
588  double ra, dec;
589  double magnitude, dmagnitude;
590  double col;
591  const char *name;
592  }
593  data[] = {
594  {8.15958, -47.0347, 15.824000, 0.001, 0.8, "object 1"},
595  {8.14792, -46.9664, 12.895000, 0.002, -0.2, ""},
596  {8.15083, -47.0092, 12.861000, 0.003, -0.3, " dff bject 1"},
597  {8.15583, -47.0222, 16.540001, 0.001, 0.7, "-9"},
598  {8.17167, -47.10 , 11.970000, 0.005, 0.12, NULL},
599  {8.14833, -47.0567, 13.861000, 0.003, -0.2, ""},
600  {8.1475 , -47.0411, 13.903000, 0.001, -0.8, "dddddddobject 1"},
601  {7.92542, 2.62917, 15.446000, 0.002, -0.2, "start 1"},
602  };
603 
604  int N = sizeof(data) / sizeof(*data);
605  int i;
606 
607  t = cpl_table_new(N);
608  cpl_table_new_column(t, FORS_DATA_STD_RA , CPL_TYPE_DOUBLE);
609  cpl_table_new_column(t, FORS_DATA_STD_DEC, CPL_TYPE_DOUBLE);
610  cpl_table_new_column(t, FORS_DATA_STD_NAME, CPL_TYPE_STRING);
611 
612  for (i = 0; i < FORS_NUM_FILTER; i++) {
613  if (!cpl_table_has_column(t, FORS_DATA_STD_MAG[i])) {
614  cpl_table_new_column(t, FORS_DATA_STD_MAG[i], CPL_TYPE_FLOAT);
615  }
616  if (!cpl_table_has_column(t, FORS_DATA_STD_DMAG[i])) {
617  cpl_table_new_column(t, FORS_DATA_STD_DMAG[i], CPL_TYPE_FLOAT);
618  }
619  if (!cpl_table_has_column(t, FORS_DATA_STD_COL[i])) {
620  cpl_table_new_column(t, FORS_DATA_STD_COL[i], CPL_TYPE_FLOAT);
621  }
622  }
623 
624  for (i = 0; i < N; i++) {
625  int j;
626 
627  cpl_table_set_double(t, FORS_DATA_STD_RA , i, data[i].ra);
628  cpl_table_set_double(t, FORS_DATA_STD_DEC , i, data[i].dec);
629  cpl_table_set_string(t, FORS_DATA_STD_NAME, i, data[i].name);
630 
631  for (j = 0; j < FORS_NUM_FILTER; j++) {
632  cpl_table_set_float (t, FORS_DATA_STD_MAG[j], i, data[i].magnitude);
633  cpl_table_set_float (t, FORS_DATA_STD_DMAG[j], i, data[i].dmagnitude);
634  cpl_table_set_float (t, FORS_DATA_STD_COL[j], i, data[i].col);
635  }
636  }
637 
638  cpl_table_save(t, NULL, NULL, filename, CPL_IO_DEFAULT);
639  assure( !cpl_error_get_code(), return NULL,
640  "Failed to save standard catalogue to %s", filename );
641 
642  cleanup;
643  return frame_new(filename, tag, group);
644 }
645 
646 
647 
648 #undef cleanup
649 #define cleanup \
650 do { \
651  cpl_table_delete(t); \
652 } while(0)
653 
661 cpl_frame *
662 create_phot_table(const char *filename, const char *tag, cpl_frame_group group)
663 {
664  cpl_table *t;
665  struct {
666  char band;
667  double ext_coeff, dext_coeff;
668  double color_term, dcolor_term;
669  double expected_zeropoint, dexpected_zeropoint;
670  }
671  data[FORS_NUM_FILTER] = {
672  {'U', 0.4 , 0.01, -0.076, 0.001, 20, 0.2},
673  {'B', 0.05 , 0.01, 0.033, 0.001, 21.123456, 0.2},
674  {'G', 0.1 , 0.01, 0.01 , 0.001, 22, 0.2},
675  {'V', 0.09 , 0.01, -0.02 , 0.001, -18, 0.2},
676  {'R', 0.2 , 0.01, 0.03 , 0.001, 0, 0.2},
677  {'I', 0.000, 0.01, -0.04 , 0.001, 1.0, 0.2},
678  };
679 
680  int N = fors_instrument_known_filters_get_number();
681  int i;
682 
683  t = cpl_table_new(N);
684  cpl_table_new_column(t, FORS_DATA_PHOT_FILTER , CPL_TYPE_STRING);
685  cpl_table_new_column(t, FORS_DATA_PHOT_EXTCOEFF , CPL_TYPE_DOUBLE);
686  cpl_table_new_column(t, FORS_DATA_PHOT_DEXTCOEFF , CPL_TYPE_DOUBLE);
687  cpl_table_new_column(t, FORS_DATA_PHOT_COLORTERM, CPL_TYPE_DOUBLE);
688  cpl_table_new_column(t, FORS_DATA_PHOT_DCOLORTERM, CPL_TYPE_DOUBLE);
689  cpl_table_new_column(t, FORS_DATA_PHOT_ZEROPOINT, CPL_TYPE_DOUBLE);
690  cpl_table_new_column(t, FORS_DATA_PHOT_DZEROPOINT, CPL_TYPE_DOUBLE);
691 
692  /* For each filtername (e.g. "U_BESS") find the matching filter (e.g. FILTER_U) */
693  for (i = 0; i < N; i++) {
694  cpl_table_set_string( t,
695  FORS_DATA_PHOT_FILTER,
696  i,
697  fors_instrument_known_filters_get_name(i));
698 
699  unsigned j;
700  for (j = 0; j < FORS_NUM_FILTER; j++) {
701  if (fors_instrument_known_filters_get_band(i) == data[j].band)
702  {
703  cpl_table_set_double(t, FORS_DATA_PHOT_EXTCOEFF , i, data[j].ext_coeff);
704  cpl_table_set_double(t, FORS_DATA_PHOT_DEXTCOEFF , i, data[j].dext_coeff);
705  cpl_table_set_double(t, FORS_DATA_PHOT_COLORTERM, i, data[j].color_term);
706  cpl_table_set_double(t, FORS_DATA_PHOT_DCOLORTERM, i, data[j].dcolor_term);
707  cpl_table_set_double(t, FORS_DATA_PHOT_ZEROPOINT, i, data[j].expected_zeropoint);
708  cpl_table_set_double(t, FORS_DATA_PHOT_DZEROPOINT, i, data[j].dexpected_zeropoint);
709  }
710  }
711  }
712 
713  cpl_table_save(t, NULL, NULL, filename, CPL_IO_DEFAULT);
714  assure( !cpl_error_get_code(), return NULL,
715  "Failed to save photometry table to %s", filename );
716 
717  cleanup;
718  return frame_new(filename, tag, group);
719 }
double fors_rand_gauss(void)
Pseudo-random gaussian distributed number.
Definition: fors_utils.c:181
cpl_frame * create_bias(const char *filename, const char *tag, cpl_frame_group group)
Simulate bias image.
fors_image * fors_image_new(cpl_image *data, cpl_image *variance)
Create image.
Definition: fors_image.c:102
cpl_frame * create_dark(const char *filename, const char *tag, cpl_frame_group group)
Simulate dark image.
cpl_frame * create_master_sky_flat(const char *filename, const char *tag, cpl_frame_group group, double exptime)
Simulate master sky flat image.
cpl_frame * create_master_bias(const char *filename, const char *tag, cpl_frame_group group)
Simulate master bias image.
#define assure(EXPR)
Definition: list.c:101
void create_standard_keys(cpl_propertylist *header, double exptime)
Write FORS standard keywords to simulated header.
cpl_frame * create_std_cat(const char *filename, const char *tag, cpl_frame_group group)
Create standard star catalogue.
static cpl_frame * frame_new(const char *filename, const char *tag, cpl_frame_group group)
Frame constructor.
cpl_frame * create_sky_flat(const char *filename, const char *tag, cpl_frame_group group, double exptime)
Simulate sky flat image.
cpl_frame * create_screen_flat(const char *filename, const char *tag, cpl_frame_group group)
Simulate screen flat image.
cpl_frame * create_phot_table(const char *filename, const char *tag, cpl_frame_group group)
Create photometry table.
void fors_image_save(const fors_image *image, const cpl_propertylist *header, const char *filename)
Save image.
Definition: fors_image.c:383
cpl_frame * create_standard(const char *filename, const char *tag, cpl_frame_group group)
Create standard star image.