VIRCAM Pipeline  1.3.4
vircam_dark_current.c
1 /* $Id: vircam_dark_current.c,v 1.52 2012-01-16 12:32:18 jim Exp $
2  *
3  * This file is part of the VIRCAM Pipeline
4  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
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 /*
22  * $Author: jim $
23  * $Date: 2012-01-16 12:32:18 $
24  * $Revision: 1.52 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 /* Includes */
29 
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33 
34 #include <cpl.h>
35 #include <stdio.h>
36 #include <math.h>
37 
38 #include "vircam_utils.h"
39 #include "vircam_mask.h"
40 #include "vircam_pfits.h"
41 #include "vircam_dfs.h"
42 #include "vircam_stats.h"
43 #include "vircam_paf.h"
44 
45 /* Function prototypes */
46 
47 static int vircam_dark_current_create(cpl_plugin *) ;
48 static int vircam_dark_current_exec(cpl_plugin *) ;
49 static int vircam_dark_current_destroy(cpl_plugin *) ;
50 static int vircam_dark_current(cpl_parameterlist *, cpl_frameset *) ;
51 static int vircam_dark_current_save(cpl_frameset *filelist,
52  cpl_parameterlist *parlist);
53 static int vircam_dark_current_lastbit(int jext, cpl_frameset *framelist,
54  cpl_parameterlist *parlist);
55 static void vircam_dark_current_init(void);
56 static void vircam_dark_current_tidy(void);
57 
58 /* Static global variables */
59 
60 static struct {
61 
62  /* Input */
63 
64  float thresh;
65  int extenum;
66 
67  /* Output */
68 
69  float mean_dark_current;
70 } vircam_dark_current_config;
71 
72 static struct {
73  cpl_size *labels;
74  cpl_frameset *darklist;
75  vir_mask *master_mask;
76  int nframes;
77  float **data;
78  vir_fits **allfits;
79  double *subset;
80  double *exps;
81  cpl_image *outimage;
82  vir_fits **good;
83  int ngood;
84  cpl_propertylist *phupaf;
85 } ps;
86 
87 static cpl_frame *product_frame = NULL;
88 static int isfirst;
89 static int dummy;
90 
91 static char vircam_dark_current_description[] =
92 "vircam_dark_current -- VIRCAM recipe for measuring dark current.\n"
93 "A list of dark frames is given. A robust estimate of the dark current\n"
94 "is calculated by fitting a median slope to the dark value vs exposure time\n"
95 "for each pixel. The output is to a dark current map which shows the dark\n"
96 "current in counts per second for each input pixel.\n\n"
97 "The program requires the following files in the SOF:\n\n"
98 " Tag Description\n"
99 " -----------------------------------------------------------------------\n"
100 " %-21s A list of raw dark images with various exposure times\n"
101 " %-21s Optional master bad pixel map or\n"
102 " %-21s Optional master confidence map\n"
103 "\n";
104 
167 /* Function code */
168 
169 /*---------------------------------------------------------------------------*/
177 /*---------------------------------------------------------------------------*/
178 
179 int cpl_plugin_get_info(cpl_pluginlist *list) {
180  cpl_recipe *recipe = cpl_calloc(1,sizeof(*recipe));
181  cpl_plugin *plugin = &recipe->interface;
182  char alldesc[SZ_ALLDESC];
183  (void)snprintf(alldesc,SZ_ALLDESC,vircam_dark_current_description,
184  VIRCAM_DARKCUR_RAW,VIRCAM_CAL_BPM,VIRCAM_CAL_CONF);
185 
186  cpl_plugin_init(plugin,
187  CPL_PLUGIN_API,
188  VIRCAM_BINARY_VERSION,
189  CPL_PLUGIN_TYPE_RECIPE,
190  "vircam_dark_current",
191  "VIRCAM recipe to determine detector dark current",
192  alldesc,
193  "Jim Lewis",
194  "jrl@ast.cam.ac.uk",
196  vircam_dark_current_create,
197  vircam_dark_current_exec,
198  vircam_dark_current_destroy);
199 
200  cpl_pluginlist_append(list,plugin);
201 
202  return(0);
203 }
204 
205 /*---------------------------------------------------------------------------*/
214 /*---------------------------------------------------------------------------*/
215 
216 static int vircam_dark_current_create(cpl_plugin *plugin) {
217  cpl_recipe *recipe;
218  cpl_parameter *p;
219 
220  /* Get the recipe out of the plugin */
221 
222  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
223  recipe = (cpl_recipe *)plugin;
224  else
225  return(-1);
226 
227  /* Create the parameters list in the cpl_recipe object */
228 
229  recipe->parameters = cpl_parameterlist_new();
230 
231  /* Fill in the rejection threshold parameter */
232 
233  p = cpl_parameter_new_value("vircam.vircam_dark_current.thresh",
234  CPL_TYPE_DOUBLE,
235  "Rejection threshold in sigma above background", "vircam.vircam_dark_current",5.0);
236  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"thresh");
237  cpl_parameterlist_append(recipe->parameters,p);
238 
239  /* Extension number of input frames to use */
240 
241  p = cpl_parameter_new_range("vircam.vircam_dark_current.extenum",
242  CPL_TYPE_INT,
243  "Extension number to be done, 0 == all",
244  "vircam.vircam_dark_current",
245  1,0,16);
246  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"ext");
247  cpl_parameterlist_append(recipe->parameters,p);
248 
249  /* Get out of here */
250 
251  return(0);
252 }
253 
254 
255 /*---------------------------------------------------------------------------*/
261 /*---------------------------------------------------------------------------*/
262 
263 static int vircam_dark_current_destroy(cpl_plugin *plugin) {
264  cpl_recipe *recipe ;
265 
266  /* Get the recipe out of the plugin */
267 
268  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
269  recipe = (cpl_recipe *)plugin;
270  else
271  return(-1);
272 
273  cpl_parameterlist_delete(recipe->parameters);
274  return(0);
275 }
276 
277 
278 /*---------------------------------------------------------------------------*/
284 /*---------------------------------------------------------------------------*/
285 
286 static int vircam_dark_current_exec(cpl_plugin *plugin) {
287  cpl_recipe *recipe;
288 
289  /* Get the recipe out of the plugin */
290 
291  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
292  recipe = (cpl_recipe *)plugin;
293  else
294  return(-1);
295 
296  return(vircam_dark_current(recipe->parameters,recipe->frames));
297 }
298 
299 /*---------------------------------------------------------------------------*/
306 /*---------------------------------------------------------------------------*/
307 
308 static int vircam_dark_current(cpl_parameterlist *parlist,
309  cpl_frameset *framelist) {
310  int jst,jfn,i,j,nx,ny,n,retval,live;
311  cpl_size nlab;
312  long npts;
313  double intercept,slope,sig;
314  const char *fctid = "vircam_dark_current";
315  float *outdata,val;
316  unsigned char *bpm;
317  vir_fits *ff;
318  cpl_frame *cur_frame;
319  cpl_propertylist *plist;
320  cpl_parameter *p;
321 
322  /* Check validity of input frameset */
323 
324  if (framelist == NULL || cpl_frameset_get_size(framelist) <= 0) {
325  cpl_msg_error(fctid,"Input framelist NULL or has no input data");
326  return(-1);
327  }
328 
329  /* Check the files in the frameset */
330 
331  if (vircam_frameset_fexists(framelist) != VIR_OK) {
332  cpl_msg_error(fctid,"Input frameset is missing files. Check SOF");
333  return(-1);
334  }
335 
336  /* Initialise some variables */
337 
338  vircam_dark_current_init();
339 
340  /* Get the parameters */
341 
342  p = cpl_parameterlist_find(parlist,"vircam.vircam_dark_current.thresh");
343  vircam_dark_current_config.thresh = (float)cpl_parameter_get_double(p);
344  p = cpl_parameterlist_find(parlist,"vircam.vircam_dark_current.extenum");
345  vircam_dark_current_config.extenum = cpl_parameter_get_int(p);
346 
347  /* Sort out raw from calib frames */
348 
349  if (vircam_dfs_set_groups(framelist) != VIR_OK) {
350  cpl_msg_error(fctid,"Cannot identify RAW and CALIB frames");
351  return(-1);
352  }
353 
354  /* Get dark frames. Make sure there are at least 2 of them */
355 
356  if ((ps.labels = cpl_frameset_labelise(framelist,vircam_compare_tags,
357  &nlab)) == NULL) {
358  cpl_msg_error(fctid,"Cannot labelise the input frameset");
359  vircam_dark_current_tidy();
360  return(-1);
361  }
362  if ((ps.darklist = vircam_frameset_subgroup(framelist,ps.labels,nlab,
363  VIRCAM_DARKCUR_RAW)) == NULL) {
364  cpl_msg_error(fctid,"Cannot find dark frames in input frameset");
365  vircam_dark_current_tidy();
366  return(-1);
367  }
368  ps.nframes = cpl_frameset_get_size(ps.darklist);
369  if (ps.nframes < 2) {
370  cpl_msg_error(fctid,"Dark frameset doesn't have enough frames");
371  vircam_dark_current_tidy();
372  return(-1);
373  }
374 
375  /* Check to see if there is a master bad pixel map. If there isn't one
376  then look for a confidence map */
377 
378  ps.master_mask = vircam_mask_define(framelist,ps.labels,nlab);
379 
380  /* Get some workspace for the data arrays */
381 
382  ps.data = cpl_malloc(ps.nframes*sizeof(float *));
383  ps.subset = cpl_malloc(ps.nframes*sizeof(double));
384  ps.exps = cpl_malloc(ps.nframes*sizeof(double));
385 
386  /* Fill in the exposure times */
387 
388  for (i = 0; i < ps.nframes; i++) {
389  cur_frame = cpl_frameset_get_frame(ps.darklist,i);
390  plist = cpl_propertylist_load(cpl_frame_get_filename(cur_frame),0);
391  if (vircam_pfits_get_exptime(plist,&val) != VIR_OK) {
392  cpl_msg_error(fctid,"Unable to get exposure time for %s",
393  cpl_frame_get_filename(cur_frame));
394  return(-1);
395  }
396  ps.exps[i] = (double)val;
397  cpl_propertylist_delete(plist);
398  }
399 
400  /* Now, how many image extensions do we want to do? If the extension
401  number is zero, then we loop for all possible extensions. If it
402  isn't then we just do the extension specified */
403 
404  vircam_exten_range(vircam_dark_current_config.extenum,
405  (const cpl_frame *)cpl_frameset_get_frame(ps.darklist,0),
406  &jst,&jfn);
407  if (jst == -1 || jfn == -1) {
408  cpl_msg_error(fctid,"Unable to continue");
409  vircam_dark_current_tidy();
410  return(-1);
411  }
412 
413  /* Get some space for the good frames */
414 
415  ps.good = cpl_malloc(ps.nframes*sizeof(vir_fits *));
416 
417  /* Now loop for all the extensions... */
418 
419  for (j = jst; j <= jfn; j++) {
420  isfirst = (j == jst);
421  dummy = 0;
422  vircam_dark_current_config.mean_dark_current = 0.0;
423 
424  /* Load the image data from each frame. If there was an
425  error loading, then just create a dummy output */
426 
427  ps.allfits = vircam_fits_load_list(ps.darklist,CPL_TYPE_FLOAT,j);
428  if (ps.allfits == NULL) {
429  cpl_msg_info(fctid,
430  "Extension %" CPL_SIZE_FORMAT " darks wouldn't load",
431  (cpl_size)j);
432  dummy = 1;
433  retval = vircam_dark_current_lastbit(j,framelist,parlist);
434  if (retval != 0)
435  return(-1);
436  continue;
437  }
438 
439  /* Are any of these images good? */
440 
441  ps.ngood = 0;
442  for (i = 0; i < ps.nframes; i++) {
443  ff = ps.allfits[i];
445  if (! live) {
446  cpl_msg_info(fctid,"Detector flagged dead %s",
448  vircam_fits_set_error(ff,VIR_FATAL);
449  } else {
450  ps.good[ps.ngood] = ff;
451  ps.ngood += 1;
452  }
453  }
454 
455  /* If there are too few good images, then signal that we need to
456  create some dummy products and move on */
457 
458  if (ps.ngood < 2) {
459  cpl_msg_warning(fctid,
460  "Need at least 2 good images -- %" CPL_SIZE_FORMAT" found",
461  (cpl_size)(ps.ngood));
462  dummy = 1;
463  retval = vircam_dark_current_lastbit(j,framelist,parlist);
464  freefitslist(ps.allfits,ps.nframes);
465  freeimage(ps.outimage);
466  if (retval != 0)
467  return(-1);
468  continue;
469  }
470 
471  /* Get the data arrays */
472 
473  for (i = 0; i < ps.ngood; i++)
474  ps.data[i] = cpl_image_get_data(vircam_fits_get_image(ps.allfits[i]));
475 
476  /* Load the BPM */
477 
478  nx = (int)cpl_image_get_size_x(vircam_fits_get_image(ps.good[0]));
479  ny = (int)cpl_image_get_size_y(vircam_fits_get_image(ps.good[0]));
480  retval = vircam_mask_load(ps.master_mask,j,nx,ny);
481  if (retval == VIR_FATAL) {
482  cpl_msg_info(fctid,
483  "Unable to load mask image %s[%" CPL_SIZE_FORMAT "]",
484  vircam_mask_get_filename(ps.master_mask),(cpl_size)j);
485  cpl_msg_info(fctid,"Forcing all pixels to be good from now on");
486  vircam_mask_force(ps.master_mask,nx,ny);
487  }
488  bpm = vircam_mask_get_data(ps.master_mask);
489 
490  /* Get an output image */
491 
492  ps.outimage = cpl_image_new((cpl_size)nx,(cpl_size)ny,CPL_TYPE_FLOAT);
493  outdata = cpl_image_get_data(ps.outimage);
494 
495  /* Now loop over all pixels and work out the slope */
496 
497  cpl_msg_info(fctid,
498  "Doing dark current fits for extension %" CPL_SIZE_FORMAT,
499  (cpl_size)j);
500  npts = (long)(nx*ny);
501  for (n = 0; n < npts; n++) {
502  if (bpm[n] != 0) {
503  slope = 0.0;
504  } else {
505  for (i = 0; i < ps.ngood; i++)
506  ps.subset[i] = (double)(ps.data[i][n]);
507  vircam_linfit(ps.ngood,ps.exps,ps.subset,&intercept,&slope,
508  &sig);
509  }
510 
511  /* Store the slope away */
512 
513  outdata[n] = (float)slope;
514  }
515 
516  /* Get the median value of the dark current */
517 
518  vircam_dark_current_config.mean_dark_current =
519  vircam_med(outdata,bpm,npts);
520 
521  /* Save the last part of the processing and saving */
522 
523  (void)vircam_dark_current_lastbit(j,framelist,parlist);
524 
525  /* Tidy up */
526 
527  freeimage(ps.outimage);
528  vircam_mask_clear(ps.master_mask);
529  freefitslist(ps.allfits,ps.nframes);
530  }
531 
532  /* Tidy up */
533 
534  vircam_dark_current_tidy();
535 
536  return(0);
537 }
538 
539 /*---------------------------------------------------------------------------*/
546 /*---------------------------------------------------------------------------*/
547 
548 static int vircam_dark_current_save(cpl_frameset *framelist,
549  cpl_parameterlist *parlist) {
550  cpl_propertylist *plist,*p;
551  const char *fctid = "vircam_dark_current_save";
552  const char *outfile = "darkcurrent.fits";
553  const char *outpaf = "darkcurrent";
554  const char *recipeid = "vircam_dark_current";
555  float darkcur_med;
556 
557  /* If we need to make a PHU then do that now based on the first frame
558  in the input frame list */
559 
560  darkcur_med = vircam_dark_current_config.mean_dark_current;
561  if (isfirst) {
562 
563  /* Create a new product frame object and define some tags */
564 
565  product_frame = cpl_frame_new();
566  cpl_frame_set_filename(product_frame,outfile);
567  cpl_frame_set_tag(product_frame,VIRCAM_PRO_DARKCUR);
568  cpl_frame_set_type(product_frame,CPL_FRAME_TYPE_IMAGE);
569  cpl_frame_set_group(product_frame,CPL_FRAME_GROUP_PRODUCT);
570  cpl_frame_set_level(product_frame,CPL_FRAME_LEVEL_FINAL);
571 
572  /* Set the PHU header */
573 
574  plist = vircam_fits_get_phu(ps.allfits[0]);
575  ps.phupaf = vircam_paf_phu_items(plist);
576  vircam_dfs_set_product_primary_header(plist,product_frame,framelist,
577  parlist,(char *)recipeid,
578  "PRO-1.15",NULL,0);
579  vircam_paf_append(ps.phupaf,plist,"ESO PRO CATG");
580 
581  /* 'Save' the PHU image */
582 
583  if (cpl_image_save(NULL,outfile,CPL_TYPE_UCHAR,plist,
584  CPL_IO_DEFAULT) != CPL_ERROR_NONE) {
585  cpl_msg_error(fctid,"Cannot save product PHU");
586  cpl_propertylist_delete(plist);
587  return(-1);
588  }
589  cpl_frameset_insert(framelist,product_frame);
590  }
591 
592  /* Get the header for the extension */
593 
594  plist = vircam_fits_get_ehu(ps.allfits[0]);
595  vircam_dfs_set_product_exten_header(plist,product_frame,framelist,
596  parlist,(char *)recipeid,
597  "PRO-1.15",NULL);
598 
599  /* Add the mean dark current to the header as a QC parameter */
600 
601  cpl_propertylist_update_float(plist,"ESO QC DARKCURRENT",darkcur_med);
602  cpl_propertylist_set_comment(plist,"ESO QC DARKCURRENT",
603  "[ADU/s] Median dark current");
604  if (dummy)
605  vircam_dummy_property(plist);
606 
607  /* Now save the image */
608 
609  if (cpl_image_save(ps.outimage,outfile,CPL_TYPE_FLOAT,plist,
610  CPL_IO_EXTEND) != CPL_ERROR_NONE) {
611  cpl_msg_error(fctid,"Cannot save product image extension");
612  cpl_propertylist_delete(plist);
613  return(-1);
614  }
615 
616  /* Write a PAF now */
617 
618  p = vircam_paf_req_items(plist);
619  vircam_merge_propertylists(p,ps.phupaf);
620  if (vircam_paf_print((char *)outpaf,"VIRCAM/vircam_dark_current","QC file",
621  p) != VIR_OK)
622  cpl_msg_warning(fctid,"Unable to write PAF");
623  cpl_propertylist_delete(p);
624 
625  /* Get out of here */
626 
627  return(0);
628 }
629 
630 /*---------------------------------------------------------------------------*/
638 /*---------------------------------------------------------------------------*/
639 
640 static int vircam_dark_current_lastbit(int jext, cpl_frameset *framelist,
641  cpl_parameterlist *parlist) {
642  int retval;
643  const char *fctid="vircam_dark_current_lastbit";
644 
645  /* If this is a dummy result then create it now */
646 
647  if (dummy)
648  ps.outimage = vircam_dummy_image(ps.allfits[0]);
649 
650  /* Save the result */
651 
652  cpl_msg_info(fctid,"Saving products for extension %" CPL_SIZE_FORMAT,
653  (cpl_size)jext);
654  retval = vircam_dark_current_save(framelist,parlist);
655  if (retval != 0) {
656  vircam_dark_current_tidy();
657  return(-1);
658  }
659  return(0);
660 }
661 
662 
663 /*---------------------------------------------------------------------------*/
667 /*---------------------------------------------------------------------------*/
668 
669 static void vircam_dark_current_init(void) {
670  ps.labels = NULL;
671  ps.darklist = NULL;
672  ps.master_mask = NULL;
673  ps.data = NULL;
674  ps.allfits = NULL;
675  ps.subset = NULL;
676  ps.exps = NULL;
677  ps.outimage = NULL;
678  ps.nframes = 0;
679  ps.good = NULL;
680  ps.phupaf = NULL;
681 }
682 
683 /*---------------------------------------------------------------------------*/
687 /*---------------------------------------------------------------------------*/
688 
689 static void vircam_dark_current_tidy(void) {
690 
691  freespace(ps.labels);
692  freeframeset(ps.darklist);
693  freemask(ps.master_mask);
694  freespace(ps.data);
695  freespace(ps.subset);
696  freespace(ps.exps);
697  freeimage(ps.outimage);
698  freefitslist(ps.allfits,ps.nframes);
699  ps.nframes = 0;
700  freespace(ps.good);
701  freepropertylist(ps.phupaf);
702 }
703 
706 /*
707 
708 $Log: not supported by cvs2svn $
709 Revision 1.51 2012/01/15 17:40:09 jim
710 Minor modifications to take into accout the changes in cpl API for v6
711 
712 Revision 1.50 2010/06/30 12:42:00 jim
713 A few fixes to stop compiler compaints
714 
715 Revision 1.49 2009/09/09 09:50:21 jim
716 Modified to try and get headers right
717 
718 Revision 1.48 2008/10/01 04:59:13 jim
719 Added call to vircam_frameset_fexists to check input frameset
720 
721 Revision 1.47 2008/09/30 11:33:23 jim
722 Added PRO CATG to pafs
723 
724 Revision 1.46 2007/11/20 09:40:27 jim
725 changed values for linear fit to doubles
726 
727 Revision 1.45 2007/11/14 14:47:53 jim
728 vircam_linfit now works only with doubles
729 
730 Revision 1.44 2007/10/25 18:39:22 jim
731 Altered to remove some lint messages
732 
733 Revision 1.43 2007/10/15 12:53:26 jim
734 Modified for compatibiliity with cpl_4.0
735 
736 Revision 1.42 2007/09/06 21:37:53 jim
737 fixed call to vircam_dfs_setup_product_ routines to use the full input
738 frameset
739 
740 Revision 1.41 2007/08/23 09:01:34 jim
741 Error when there aren't enough frames is now just a warning
742 
743 Revision 1.40 2007/07/18 15:35:41 jim
744 Added better error handling for missing or corrupt mask extensions
745 
746 Revision 1.39 2007/07/09 13:21:55 jim
747 Modified to use new version of vircam_exten_range
748 
749 Revision 1.38 2007/06/13 08:11:27 jim
750 Modified docs to reflect changes in DFS tags
751 
752 Revision 1.37 2007/04/04 10:36:18 jim
753 Modified to use new dfs tags
754 
755 Revision 1.36 2007/03/29 12:19:38 jim
756 Little changes to improve documentation
757 
758 Revision 1.35 2007/03/01 12:41:48 jim
759 Modified slightly after code checking
760 
761 Revision 1.34 2007/02/25 06:26:35 jim
762 Plugged a few memory leaks
763 
764 Revision 1.33 2007/02/15 06:59:37 jim
765 Added ability to write QC paf files
766 
767 Revision 1.32 2007/02/07 10:12:39 jim
768 Removed calls to vircam_ndit_correct as this is now no longer necessary
769 
770 Revision 1.31 2007/02/06 13:11:11 jim
771 Fixed entry for PRO dictionary in cpl_dfs_set_product_header
772 
773 Revision 1.30 2006/11/27 12:13:21 jim
774 Swapped calls to cpl_propertylist_append to cpl_propertylist_update
775 
776 Revision 1.29 2006/11/10 09:19:47 jim
777 fixed typo
778 
779 Revision 1.28 2006/09/29 11:19:30 jim
780 changed aliases on parameter names
781 
782 Revision 1.27 2006/09/09 16:49:39 jim
783 Header comment update
784 
785 Revision 1.26 2006/09/04 23:02:14 jim
786 Modified to deal with det live issues. Also does a better job of dealing
787 with duff input
788 
789 Revision 1.25 2006/06/20 19:07:00 jim
790 Corrects for ndit != 1
791 
792 Revision 1.24 2006/06/15 09:58:57 jim
793 Minor changes to docs
794 
795 Revision 1.23 2006/06/09 11:32:59 jim
796 A few more minor fixes for lint
797 
798 Revision 1.22 2006/06/09 11:26:25 jim
799 Small changes to keep lint happy
800 
801 Revision 1.21 2006/05/17 11:15:38 jim
802 plugged memory leak
803 
804 Revision 1.20 2006/05/04 11:53:14 jim
805 Fixed the way the _save routine works to be more consistent with the
806 standard CPL way of doing things
807 
808 Revision 1.19 2006/04/27 09:46:01 jim
809 Modified DFS frame types to conform to new dictionary
810 
811 Revision 1.18 2006/04/25 13:45:56 jim
812 Fixed to adhere to new calling sequence for vircam_dfs routines
813 
814 Revision 1.17 2006/03/23 21:18:45 jim
815 Minor changes mainly to comment headers
816 
817 Revision 1.16 2006/03/22 12:13:51 jim
818 Modified to use new vircam_mask capability
819 
820 Revision 1.15 2006/03/15 10:43:40 jim
821 Fixed a few things
822 
823 Revision 1.14 2006/03/03 14:29:06 jim
824 Now calls routines with vir_fits.
825 
826 Revision 1.13 2006/02/18 11:50:43 jim
827 Modified the way the dfs product keywords are written using the vircam
828 routines, rather than the cpl routine that doesn't understand image
829 extensions
830 
831 Revision 1.12 2006/01/23 10:35:55 jim
832 Now allows either an BPM or CPM to be used as a mask
833 
834 Revision 1.11 2005/12/14 22:19:12 jim
835 fixed docs
836 
837 Revision 1.10 2005/12/09 09:47:58 jim
838 Many changes to add more documentation
839 
840 Revision 1.9 2005/12/02 10:45:37 jim
841 The tags used in the sof are now written to the description string in the
842 constructor. This is so that if they change in the vircam_dfs.h file, they
843 aren't then hardcopied into each of the recipes...
844 
845 Revision 1.8 2005/12/01 16:25:06 jim
846 Fixed default output file extension
847 
848 Revision 1.7 2005/11/25 09:37:10 jim
849 Fitting now done by vircam_linfit
850 
851 Revision 1.6 2005/11/23 14:57:40 jim
852 A bit of tidying in response to splint messages
853 
854 Revision 1.5 2005/11/08 12:47:44 jim
855 Made garbage collection a little better
856 
857 Revision 1.4 2005/11/03 15:16:28 jim
858 Lots of changes mainly to strengthen error reporting
859 
860 Revision 1.3 2005/08/09 11:09:39 jim
861 Replaced dodgy call to cpl_framelist_delete with correct cpl_frameset_delete
862 
863 Revision 1.2 2005/08/09 10:24:38 jim
864 Replaced dodgy calls to cpl_msg_err with correct cpl_msg_error
865 
866 Revision 1.1.1.1 2005/08/05 08:29:09 jim
867 Initial import
868 
869 
870 */
const char * vircam_get_license(void)
Definition: vircam_utils.c:92
void vircam_mask_force(vir_mask *m, int nx, int ny)
Definition: vircam_mask.c:385
int vircam_compare_tags(const cpl_frame *frame1, const cpl_frame *frame2)
Definition: vircam_utils.c:141
void vircam_merge_propertylists(cpl_propertylist *p1, cpl_propertylist *p2)
vir_fits ** vircam_fits_load_list(cpl_frameset *f, cpl_type type, int exten)
Definition: vircam_fits.c:231
void vircam_mask_clear(vir_mask *m)
Definition: vircam_mask.c:349
cpl_image * vircam_dummy_image(vir_fits *model)
int vircam_pfits_get_exptime(const cpl_propertylist *plist, float *exptime)
Get the value of exposure time.
Definition: vircam_pfits.c:245
int vircam_mask_load(vir_mask *m, int nexten, int nx, int ny)
Definition: vircam_mask.c:210
char * vircam_fits_get_fullname(vir_fits *p)
Definition: vircam_fits.c:560
unsigned char * vircam_mask_get_data(vir_mask *m)
Definition: vircam_mask.c:535
void vircam_linfit(int npts, double *xdata, double *ydata, double *intercept, double *slope, double *sig)
Definition: vircam_utils.c:570
cpl_image * vircam_fits_get_image(vir_fits *p)
Definition: vircam_fits.c:349
cpl_frameset * vircam_frameset_subgroup(cpl_frameset *frameset, cpl_size *labels, cpl_size nlab, const char *tag)
Definition: vircam_utils.c:193
void vircam_dfs_set_product_exten_header(cpl_propertylist *plist, cpl_frame *frame, cpl_frameset *frameset, cpl_parameterlist *parlist, char *recipeid, const char *dict, cpl_frame *inherit)
Definition: vircam_dfs.c:273
void vircam_dfs_set_product_primary_header(cpl_propertylist *plist, cpl_frame *frame, cpl_frameset *frameset, cpl_parameterlist *parlist, char *recipeid, const char *dict, cpl_frame *inherit, int synch)
Definition: vircam_dfs.c:203
int vircam_fits_set_error(vir_fits *p, int status)
Definition: vircam_fits.c:627
float vircam_med(float *data, unsigned char *bpm, long npts)
Definition: vircam_stats.c:89
void vircam_dummy_property(cpl_propertylist *p)
cpl_propertylist * vircam_fits_get_phu(vir_fits *p)
Definition: vircam_fits.c:416
cpl_propertylist * vircam_fits_get_ehu(vir_fits *p)
Definition: vircam_fits.c:457
int vircam_frameset_fexists(cpl_frameset *frameset)
Definition: vircam_utils.c:285
const char * vircam_mask_get_filename(vir_mask *m)
Definition: vircam_mask.c:438
vir_mask * vircam_mask_define(cpl_frameset *framelist, cpl_size *labels, cpl_size nlab)
Definition: vircam_mask.c:86
int vircam_pfits_get_detlive(const cpl_propertylist *plist, int *detlive)
Get the value of DET_LIVE.
Definition: vircam_pfits.c:624
void vircam_exten_range(int inexten, const cpl_frame *fr, int *out1, int *out2)
Definition: vircam_utils.c:353
int vircam_dfs_set_groups(cpl_frameset *set)
Definition: vircam_dfs.c:87