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