VIRCAM Pipeline  2.3.10
vircam_jitter_microstep_process.c
1 /* $Id: vircam_jitter_microstep_process.c,v 1.70 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.70 $
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 <stdio.h>
35 #include <string.h>
36 #include <cpl.h>
37 #include <math.h>
38 
39 #include <casu_utils.h>
40 #include <casu_mods.h>
41 #include <casu_mask.h>
42 
43 #include "vircam_utils.h"
44 #include "vircam_pfits.h"
45 #include "vircam_dfs.h"
46 #include "vircam_mods.h"
47 #include "vircam_jmp_utils.h"
48 #include "vircam_paf.h"
49 
50 /* Function prototypes */
51 
52 static int vircam_jitter_microstep_process_create(cpl_plugin *);
53 static int vircam_jitter_microstep_process_exec(cpl_plugin *);
54 static int vircam_jitter_microstep_process_destroy(cpl_plugin *);
55 static int vircam_jitter_microstep_process(cpl_parameterlist *,
56  cpl_frameset *);
57 static cpl_propertylist *vircam_jitter_microstep_process_dummyqc(int type);
58 
59 
60 static char vircam_jitter_microstep_process_description[] =
61 "vircam_jitter_microstep_process -- VIRCAM science product recipe.\n\n"
62 "Process a complete pawprint for VIRCAM data. Remove instrumental\n"
63 "signature, interleave microstep sequences (if done), combine jitters\n"
64 "photometrically and astrometrically calibrate the pawprint image\n\n"
65 "The program accepts the following files in the SOF:\n\n"
66 " Tag Description\n"
67 " -----------------------------------------------------------------------\n"
68 " %-21s A list of raw science images or\n"
69 " %-21s A list of raw science images (extended)\n"
70 " %-21s A list of offset sky exposures (optional)\n"
71 " %-21s A master dark frame\n"
72 " %-21s A master twilight flat frame\n"
73 " %-21s A master sky frame (optional)\n"
74 " %-21s A channel table\n"
75 " %-21s A photometric calibration table\n"
76 " %-21s A readnoise/gain file\n"
77 " %-21s A master confidence map or\n"
78 " %-21s A master bad pixel mask\n"
79 " %-21s A master standard star index\n"
80 "All of the above are required\n"
81 "\n";
82 
220 /* Function code */
221 
222 /*---------------------------------------------------------------------------*/
230 /*---------------------------------------------------------------------------*/
231 
232 int cpl_plugin_get_info(cpl_pluginlist *list) {
233  cpl_recipe *recipe = cpl_calloc(1,sizeof(*recipe));
234  cpl_plugin *plugin = &recipe->interface;
235  char alldesc[SZ_ALLDESC];
236  (void)snprintf(alldesc,SZ_ALLDESC,
237  vircam_jitter_microstep_process_description,
238  VIRCAM_SCI_OBJECT_RAW,VIRCAM_SCI_OBJECT_EXT_RAW,
239  VIRCAM_OFFSET_SKY_RAW,VIRCAM_CAL_DARK,
240  VIRCAM_CAL_TWILIGHT_FLAT,VIRCAM_CAL_SKY,VIRCAM_CAL_CHANTAB,
241  VIRCAM_CAL_PHOTTAB,VIRCAM_CAL_READGAINFILE,VIRCAM_CAL_CONF,
242  VIRCAM_CAL_BPM,VIRCAM_CAL_2MASS);
243 
244  cpl_plugin_init(plugin,
245  CPL_PLUGIN_API,
246  VIRCAM_BINARY_VERSION,
247  CPL_PLUGIN_TYPE_RECIPE,
248  "vircam_jitter_microstep_process",
249  "VIRCAM jitter microstep recipe",
250  alldesc,
251  "Jim Lewis",
252  "jrl@ast.cam.ac.uk",
254  vircam_jitter_microstep_process_create,
255  vircam_jitter_microstep_process_exec,
256  vircam_jitter_microstep_process_destroy);
257 
258  cpl_pluginlist_append(list,plugin);
259 
260  return(0);
261 }
262 
263 /*---------------------------------------------------------------------------*/
272 /*---------------------------------------------------------------------------*/
273 
274 static int vircam_jitter_microstep_process_create(cpl_plugin *plugin) {
275  cpl_recipe *recipe;
276  cpl_parameter *p;
277 
278  /* Get the recipe out of the plugin */
279 
280  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
281  recipe = (cpl_recipe *)plugin;
282  else
283  return(-1);
284 
285  /* Create the parameters list in the cpl_recipe object */
286 
287  recipe->parameters = cpl_parameterlist_new();
288 
289  /* Fill in the minimum object size */
290 
291  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.ipix",
292  CPL_TYPE_INT,
293  "Minimum pixel area for each detected object",
294  "vircam.vircam_jitter_microstep_process",5);
295  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"ipix");
296  cpl_parameterlist_append(recipe->parameters,p);
297 
298  /* Fill in the detection threshold parameter */
299 
300  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.thresh",
301  CPL_TYPE_DOUBLE,
302  "Detection threshold in sigma above sky",
303  "vircam.vircam_jitter_microstep_process",2.0);
304  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"thr");
305  cpl_parameterlist_append(recipe->parameters,p);
306 
307  /* Fill in flag to use deblending software or not */
308 
309  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.icrowd",
310  CPL_TYPE_BOOL,"Use deblending?",
311  "vircam.vircam_jitter_microstep_process",1);
312  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"icrowd");
313  cpl_parameterlist_append(recipe->parameters,p);
314 
315  /* Fill in core radius */
316 
317  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.rcore",
318  CPL_TYPE_DOUBLE,"Value of Rcore in pixels",
319  "vircam.vircam_jitter_microstep_process",3.0);
320  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"rcore");
321  cpl_parameterlist_append(recipe->parameters,p);
322 
323  /* Fill in background smoothing box size */
324 
325  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.nbsize",
326  CPL_TYPE_INT,"Background smoothing box size",
327  "vircam.vircam_jitter_microstep_process",64);
328  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"nb");
329  cpl_parameterlist_append(recipe->parameters,p);
330 
331  /* Fill in flag to use save the output catalogue */
332 
333  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.savecat",
334  CPL_TYPE_BOOL,"Save catalogue?",
335  "vircam.vircam_jitter_microstep_process",1);
336  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"savecat");
337  cpl_parameterlist_append(recipe->parameters,p);
338 
339 
340  /* Fill in flag to destripe the images */
341 
342  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.destripe",
343  CPL_TYPE_BOOL,"Destripe images?",
344  "vircam.vircam_jitter_microstep_process",1);
345  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"destripe");
346  cpl_parameterlist_append(recipe->parameters,p);
347 
348  /* Fill in flag to correct sky background */
349 
350  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.skycor",
351  CPL_TYPE_BOOL,"Do a sky subtraction?",
352  "vircam.vircam_jitter_microstep_process",1);
353  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"skycor");
354  cpl_parameterlist_append(recipe->parameters,p);
355 
356  /* Fill in flag to save simple images */
357 
358  p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.savesimple",
359  CPL_TYPE_BOOL,"Save simple images?",
360  "vircam.vircam_jitter_microstep_process",0);
361  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"savesimple");
362  cpl_parameterlist_append(recipe->parameters,p);
363 
364  /* Extension number of input frames to use */
365 
366  p = cpl_parameter_new_range("vircam.vircam_jitter_microstep_process.extenum",
367  CPL_TYPE_INT,
368  "Extension number to be done, 0 == all",
369  "vircam.vircam_jitter_microstep_process",
370  0,0,16);
371  cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"ext");
372  cpl_parameterlist_append(recipe->parameters,p);
373 
374  /* Get out of here */
375 
376  return(0);
377 }
378 
379 
380 /*---------------------------------------------------------------------------*/
386 /*---------------------------------------------------------------------------*/
387 
388 static int vircam_jitter_microstep_process_exec(cpl_plugin *plugin) {
389  cpl_recipe *recipe;
390 
391  /* Get the recipe out of the plugin */
392 
393  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
394  recipe = (cpl_recipe *)plugin;
395  else
396  return(-1);
397 
398  return(vircam_jitter_microstep_process(recipe->parameters,recipe->frames));
399 }
400 
401 /*---------------------------------------------------------------------------*/
407 /*---------------------------------------------------------------------------*/
408 
409 static int vircam_jitter_microstep_process_destroy(cpl_plugin *plugin) {
410  cpl_recipe *recipe ;
411 
412  /* Get the recipe out of the plugin */
413 
414  if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
415  recipe = (cpl_recipe *)plugin;
416  else
417  return(-1);
418 
419  cpl_parameterlist_delete(recipe->parameters);
420  return(0);
421 }
422 
423 /*---------------------------------------------------------------------------*/
430 /*---------------------------------------------------------------------------*/
431 
432 static int vircam_jitter_microstep_process(cpl_parameterlist *parlist,
433  cpl_frameset *framelist) {
434  const char *fctid="vircam_jitter_microstep_process";
435  cpl_parameter *p;
436  int jst,jfn,status,j,i,retval,nusteps,isconf,live,ndit;
437  cpl_size nlab;
438  float readnoise,gain,gaincor_fac;
439  casu_fits *ff;
440  cpl_frame *catindex;
441  cpl_propertylist *pp;
442  int offsky;
443 
444  /* Check validity of input frameset */
445 
446  if (framelist == NULL || cpl_frameset_get_size(framelist) <= 0) {
447  cpl_msg_error(fctid,"Input framelist NULL or has no input data");
448  return(-1);
449  }
450 
451  /* Initialise some things */
452  struct psStruct ps;
453 
454  vircam_jmp_init(&ps);
455  vircam_set_recipename(fctid,RECSCI);
456  /*
457  (void)snprintf(vircam_recipepaf,VIRCAM_PATHSZ,"VIRCAM/%s",fctid);
458  recflag = RECSCI;
459  */
460 
461  /* Get the parameters */
462 
463  p = cpl_parameterlist_find(parlist,
464  "vircam.vircam_jitter_microstep_process.ipix");
465  vircam_jmp_set_config_ipix ( cpl_parameter_get_int(p) );
466  p = cpl_parameterlist_find(parlist,
467  "vircam.vircam_jitter_microstep_process.thresh");
468  vircam_jmp_set_config_threshold ( (float)cpl_parameter_get_double(p) );
469  p = cpl_parameterlist_find(parlist,
470  "vircam.vircam_jitter_microstep_process.icrowd");
471  vircam_jmp_set_config_icrowd ( cpl_parameter_get_bool(p) );
472  p = cpl_parameterlist_find(parlist,
473  "vircam.vircam_jitter_microstep_process.rcore");
474  vircam_jmp_set_config_rcore ( (float)cpl_parameter_get_double(p) );
475  p = cpl_parameterlist_find(parlist,
476  "vircam.vircam_jitter_microstep_process.nbsize");
477  vircam_jmp_set_config_nbsize ( cpl_parameter_get_int(p) );
478  p = cpl_parameterlist_find(parlist,
479  "vircam.vircam_jitter_microstep_process.savecat");
480  vircam_jmp_set_config_savecat ( cpl_parameter_get_bool(p) );
481  p = cpl_parameterlist_find(parlist,
482  "vircam.vircam_jitter_microstep_process.destripe");
483  vircam_jmp_set_config_destripe ( cpl_parameter_get_bool(p) );
484  p = cpl_parameterlist_find(parlist,
485  "vircam.vircam_jitter_microstep_process.skycor");
486  vircam_jmp_set_config_skycor ( cpl_parameter_get_bool(p) );
487  p = cpl_parameterlist_find(parlist,
488  "vircam.vircam_jitter_microstep_process.savesimple");
489  vircam_jmp_set_config_savesimple ( cpl_parameter_get_bool(p) );
490  p = cpl_parameterlist_find(parlist,
491  "vircam.vircam_jitter_microstep_process.extenum");
492  vircam_jmp_set_config_extenum ( cpl_parameter_get_int(p) );
493 
494  /* Sort out raw from calib frames */
495 
496  if (vircam_dfs_set_groups(framelist) != CASU_OK) {
497  cpl_msg_error(fctid,"Cannot identify RAW and CALIB frames");
498  vircam_jmp_tidy(&ps,0);
499  return(-1);
500  }
501 
502  /* Label the input frames */
503 
504  if ((ps.labels = cpl_frameset_labelise(framelist,casu_compare_tags,
505  &nlab)) == NULL) {
506  cpl_msg_error(fctid,"Cannot labelise the input frames");
507  vircam_jmp_tidy(&ps,0);
508  return(-1);
509  }
510 
511  /* Get the input science frames */
512 
513  if ((ps.science_frames =
514  casu_frameset_subgroup(framelist,ps.labels,nlab,
515  VIRCAM_SCI_OBJECT_RAW)) == NULL) {
516  if ((ps.science_frames =
517  casu_frameset_subgroup(framelist,ps.labels,nlab,
518  VIRCAM_SCI_OBJECT_EXT_RAW)) == NULL) {
519  cpl_msg_error(fctid,"No science images to process!");
520  vircam_jmp_tidy(&ps,0);
521  return(-1);
522  }
523  }
524 
525  /* Get the offset sky frames */
526 
527  if ((ps.master_sky = casu_frameset_subgroup_1(framelist,ps.labels,nlab,
528  VIRCAM_CAL_SKY)) == NULL) {
529  if ((ps.offset_skies =
530  casu_frameset_subgroup(framelist,ps.labels,nlab,
531  VIRCAM_OFFSET_SKY_RAW)) == NULL)
532  offsky = 0;
533  else
534  offsky = 1;
535  } else {
536  offsky = -1;
537  }
538 
539  vircam_jmp_set_offsky(offsky);
540 
541  /* Check to see if there is a master dark frame */
542 
543  if ((ps.master_dark =
544  casu_frameset_subgroup_1(framelist,ps.labels,nlab,
545  VIRCAM_CAL_DARK)) == NULL) {
546  cpl_msg_error(fctid,"No master dark found");
547  vircam_jmp_tidy(&ps,0);
548  return(-1);
549  }
550 
551  /* Check to see if there is a master twilight flat frame */
552 
553  if ((ps.master_twilight_flat =
554  casu_frameset_subgroup_1(framelist,ps.labels,nlab,
555  VIRCAM_CAL_TWILIGHT_FLAT)) == NULL) {
556  cpl_msg_error(fctid,"No master twilight flat found");
557  vircam_jmp_tidy(&ps,0);
558  return(-1);
559  }
560 
561  /* Get the gain corrections */
562 
563  status = CASU_OK;
564  if (casu_gaincor_calc(ps.master_twilight_flat,&i,&(ps.gaincors),
565  &status) != CASU_OK) {
566  cpl_msg_error(fctid,"Error calculating gain corrections");
567  vircam_jmp_tidy(&ps,0);
568  return(-1);
569  }
570 
571  /* Check to see if there is a readgain file */
572 
573  if ((ps.readgain_file =
574  casu_frameset_subgroup_1(framelist,ps.labels,nlab,
575  VIRCAM_CAL_READGAINFILE)) == NULL) {
576  cpl_msg_error(fctid,"No master readnoise/gain file found");
577  vircam_jmp_tidy(&ps,0);
578  return(-1);
579  }
580 
581  /* Check to see if there is a master confidence map. If there isn't
582  then look for a bad pixel mask that can be converted into a
583  confidence map (in an emergency) */
584 
585  isconf = 1;
586  if ((ps.master_conf =
587  casu_frameset_subgroup_1(framelist,ps.labels,nlab,
588  VIRCAM_CAL_CONF)) == NULL) {
589  isconf = 0;
590  if ((ps.master_conf =
591  casu_frameset_subgroup_1(framelist,ps.labels,nlab,
592  VIRCAM_CAL_BPM)) == NULL) {
593  cpl_msg_error(fctid,"No master confidence map found");
594  vircam_jmp_tidy(&ps,0);
595  return(-1);
596  }
597  }
598  ps.mask = casu_mask_define(framelist,ps.labels,nlab,VIRCAM_CAL_CONF,
599  VIRCAM_CAL_BPM);
600 
601  /* Check to see if there is a channel table */
602 
603  if ((ps.chantab = casu_frameset_subgroup_1(framelist,ps.labels,nlab,
604  VIRCAM_CAL_CHANTAB)) == NULL) {
605  cpl_msg_error(fctid,"No channel table found");
606  vircam_jmp_tidy(&ps,0);
607  return(-1);
608  }
609 
610  /* Check to see if there is a photometric table */
611 
612  if ((ps.phottab = casu_frameset_subgroup_1(framelist,ps.labels,nlab,
613  VIRCAM_CAL_PHOTTAB)) == NULL) {
614  cpl_msg_error(fctid,"No photometric table found");
615  vircam_jmp_tidy(&ps,0);
616  return(-1);
617  }
618  if ((ps.tphottab = cpl_table_load(cpl_frame_get_filename(ps.phottab),1,0)) == NULL) {
619  cpl_msg_error(fctid,"Unable to load photometric table");
620  vircam_jmp_tidy(&ps,0);
621  return(-1);
622  }
623 
624  /* Is the 2mass index file specified? */
625 
626  if ((catindex = casu_frameset_subgroup_1(framelist,ps.labels,nlab,
627  VIRCAM_CAL_2MASS)) == NULL) {
628  cpl_msg_info(fctid,"No 2MASS index found -- cannot continue");
629  vircam_jmp_tidy(&ps,0);
630  return(-1);
631  }
632 
633  /* Get catalogue parameters */
634 
635  if (casu_catpars(catindex,&(ps.catpath),&(ps.catname)) == CASU_FATAL) {
636  vircam_jmp_tidy(&ps,0);
637  cpl_frame_delete(catindex);
638  return(-1);
639  }
640  cpl_frame_delete(catindex);
641 
642  /* Set up the photometric calibration catalogue data */
643 
644  (void)strcpy(current_catpath,ps.catpath);
645  (void)strcpy(current_cat,ps.catname);
646 
647  /* Get the number of DITs */
648 
649  pp = cpl_propertylist_load(cpl_frame_get_filename(cpl_frameset_get_position(ps.science_frames,0)),0);
650  if (vircam_pfits_get_ndit(pp,&ndit) != CASU_OK) {
651  cpl_msg_error(fctid,"No value for NDIT available");
652  freepropertylist(pp);
653  vircam_jmp_tidy(&ps,0);
654  return(-1);
655  }
656  cpl_propertylist_delete(pp);
657 
658  /* Now, how many image extensions do we want to do? If the extension
659  number is zero, then we loop for all possible extensions. If it
660  isn't then we just do the extension specified */
661 
662  vircam_exten_range(vircam_jmp_get_config_extenum(),
663  (const cpl_frame *)cpl_frameset_get_position(ps.science_frames,0),
664  &jst,&jfn);
665  if (jst == -1 || jfn == -1) {
666  cpl_msg_error(fctid,"Unable to continue");
667  vircam_jmp_tidy(&ps,0);
668  return(-1);
669  }
670 
671  /* Now loop for all the extensions... */
672 
673  status = CASU_OK;
674  for (j = jst; j <= jfn; j++) {
675  vircam_jmp_set_isfirst (j == jst);
676  gaincor_fac = (ps.gaincors)[j-1];
677  cpl_msg_info(fctid,"Beginning extension [%" CPL_SIZE_FORMAT "]",
678  (cpl_size)j);
679 
680  /* Load up the calibration frames into casu_fits/casu_tfits structures
681  It is a fatal error if any one of them can't load properly */
682 
683  ps.fdark = casu_fits_load(ps.master_dark,CPL_TYPE_FLOAT,j);
684  if (ps.fdark == NULL) {
685  cpl_msg_error(fctid,
686  "Error loading master dark %s[%" CPL_SIZE_FORMAT "]\n%s",
687  cpl_frame_get_filename(ps.master_dark),(cpl_size)j,
688  cpl_error_get_message());
689  vircam_jmp_tidy(&ps,0);
690  return(-1);
691  }
692  ps.fflat = casu_fits_load(ps.master_twilight_flat,CPL_TYPE_FLOAT,j);
693  if (ps.fflat == NULL) {
694  cpl_msg_error(fctid,
695  "Error loading master flat %s[%" CPL_SIZE_FORMAT "]\n%s",
696  cpl_frame_get_filename(ps.master_twilight_flat),
697  (cpl_size)j,cpl_error_get_message());
698  vircam_jmp_tidy(&ps,0);
699  return(-1);
700  }
701  ps.fconf = casu_fits_load(ps.master_conf,CPL_TYPE_INT,j);
702  if (ps.fconf == NULL) {
703  cpl_msg_error(fctid,
704  "Error loading master conf %s[%" CPL_SIZE_FORMAT "]\n%s",
705  cpl_frame_get_filename(ps.master_conf),(cpl_size)j,
706  cpl_error_get_message());
707  vircam_jmp_tidy(&ps,0);
708  return(-1);
709  }
710  if (! isconf)
711  vircam_jmp_bpm2conf(&ps);
712  if (casu_mask_load(ps.mask,j,
713  (int)cpl_image_get_size_x(casu_fits_get_image(ps.fconf)),
714  (int)cpl_image_get_size_y(casu_fits_get_image(ps.fconf))) != CASU_OK) {
715  cpl_msg_error(fctid,
716  "Error loading mask from master conf %s[%" CPL_SIZE_FORMAT "]\n%s",
717  cpl_frame_get_filename(ps.master_conf),(cpl_size)j,
718  cpl_error_get_message());
719  vircam_jmp_tidy(&ps,0);
720  return(-1);
721  }
722  if (offsky == -1) {
723  ps.fsky = casu_fits_load(ps.master_sky,CPL_TYPE_FLOAT,j);
724  if (ps.fsky == NULL) {
725  cpl_msg_error(fctid,
726  "Error loading master sky %s[%" CPL_SIZE_FORMAT "]\n%s",
727  cpl_frame_get_filename(ps.master_sky),(cpl_size)j,
728  cpl_error_get_message());
729  vircam_jmp_tidy(&ps,0);
730  return(-1);
731  }
732  }
733  ps.fchantab = casu_tfits_load(ps.chantab,j);
734  if (ps.fchantab == NULL) {
735  cpl_msg_error(fctid,
736  "Error loading channel table %s[%" CPL_SIZE_FORMAT "]\n%s",
737  cpl_frame_get_filename(ps.chantab),(cpl_size)j,
738  cpl_error_get_message());
739  vircam_jmp_tidy(&ps,0);
740  return(-1);
741  }
742 
743  /* Load up the casu_fits structures for the science images */
744 
745  ps.nscience = cpl_frameset_get_size(ps.science_frames);
746  ps.sci_fits = casu_fits_load_list(ps.science_frames,CPL_TYPE_FLOAT,j);
747  if (ps.sci_fits == NULL) {
748  cpl_msg_error(fctid,
749  "Error loading science frames extension %" CPL_SIZE_FORMAT ": %s",
750  (cpl_size)j,cpl_error_get_message());
751  vircam_jmp_tidy(&ps,0);
752  return(-1);
753  }
754 
755  /* Set up something for the PAFs */
756 
757  /* Make sure to delete old stuff as we are in a loop */
758  freepropertylist(ps.phupaf);
759  ps.phupaf = vircam_paf_phu_items(casu_fits_get_phu(ps.sci_fits[0]));
760 
761  /* Load up the casu_fits structures for the offset skies (if needed) */
762 
763  if (offsky == 1) {
764  ps.noffsets = cpl_frameset_get_size(ps.offset_skies);
765  ps.offsky_fits = casu_fits_load_list(ps.offset_skies,
766  CPL_TYPE_FLOAT,j);
767  if (ps.offsky_fits == NULL) {
768  cpl_msg_error(fctid,
769  "Error loading offset skies extension %" CPL_SIZE_FORMAT ": %s",
770  (cpl_size)j,cpl_error_get_message());
771  vircam_jmp_tidy(&ps,0);
772  return(-1);
773  }
774  } else {
775  ps.noffsets = 0;
776  ps.offsky_fits = NULL;
777  }
778 
779  /* Loop through and mark the frames where the header says the detector
780  wasn't live. Also check to see if the CRVAL == 0 problem is
781  present. Check for live detectors in the offset skies too */
782 
783  for (i = 0; i < ps.nscience; i++) {
784  ff = ps.sci_fits[i];
786  if (! live)
787  casu_fits_set_error(ff,CASU_FATAL);
789  casu_fits_get_ehu(ff)) != CASU_OK) {
790  cpl_msg_error(fctid,"Unable to correct CRVAL in %s",
792  vircam_jmp_tidy(&ps,0);
793  return(-1);
794  }
795  }
796  for (i = 0; i < ps.noffsets; i++) {
797  ff = ps.offsky_fits[i];
799  if (! live)
800  casu_fits_set_error(ff,CASU_FATAL);
801  }
802 
803  /* Get the readnoise and gain estimate for this extension */
804 
805  vircam_jmp_get_readnoise_gain(&ps,j,&readnoise,&gain);
806 
807  /* Loop for all the science frames and do the 2d corrections. Then
808  do it for the offset skies */
809 
810  cpl_msg_info(fctid,"Doing stage1 corrections");
811  for (i = 0; i < ps.nscience; i++) {
812  ff = ps.sci_fits[i];
813  cpl_propertylist_update_float(casu_fits_get_ehu(ff),"READNOIS",
814  readnoise);
815  cpl_propertylist_set_comment(casu_fits_get_ehu(ff),"READNOIS",
816  "[e-] Readnoise used in processing");
817  cpl_propertylist_update_float(casu_fits_get_ehu(ff),"GAIN",gain);
818  cpl_propertylist_set_comment(casu_fits_get_ehu(ff),"GAIN",
819  "[e-/adu] Gain used in processing");
820  if (casu_fits_get_status(ff) == CASU_FATAL) {
821  cpl_msg_info(fctid,"Detector is flagged dead in %s",
823  continue;
824  }
825  status = CASU_OK;
826  (void)casu_darkcor(ff,ps.fdark,1.0,&status);
827  (void)vircam_lincor(ff,ps.fchantab,1,ndit,&status);
828  (void)casu_nditcor(ff,ndit,"EXPTIME",&status);
829  (void)casu_flatcor(ff,ps.fflat,&status);
830  (void)casu_gaincor(ff,gaincor_fac,&status);
831  casu_fits_set_error(ff,status);
832  }
833  for (i = 0; i < ps.noffsets; i++) {
834  ff = ps.offsky_fits[i];
835  if (casu_fits_get_status(ff) == CASU_FATAL) {
836  cpl_msg_info(fctid,"Detector is flagged dead in %s",
838  continue;
839  }
840  status = CASU_OK;
841  (void)casu_darkcor(ff,ps.fdark,1.0,&status);
842  (void)vircam_lincor(ff,ps.fchantab,1,ndit,&status);
843  (void)casu_nditcor(ff,ndit,"EXPTIME",&status);
844  (void)casu_flatcor(ff,ps.fflat,&status);
845  (void)casu_gaincor(ff,gaincor_fac,&status);
846  casu_fits_set_error(ff,status);
847  }
848 
849  /* Do a simple sky correction if requested */
850 
851  if (vircam_jmp_get_config_skycor()) {
852  cpl_msg_info(fctid,"Doing sky correction");
853  vircam_jmp_skycor(&ps);
854  } else {
855  for (i = 0; i < ps.nscience; i++) {
856  pp = casu_fits_get_ehu(ps.sci_fits[i]);
857  cpl_propertylist_update_string(pp,"ESO DRS SKYCOR","none");
858  cpl_propertylist_set_comment(pp,"ESO DRS SKYCOR",
859  "Sky correction method");
860  }
861  }
862 
863  /* Do destripe if requested */
864 
865  if (vircam_jmp_get_config_destripe()) {
866  for (i = 0; i < ps.nscience; i++) {
867  ff = ps.sci_fits[i];
868  (void)vircam_destripe(ff,ps.mask,&status);
869  casu_fits_set_error(ff,status);
870  }
871  for (i = 0; i < ps.noffsets; i++) {
872  ff = ps.offsky_fits[i];
873  (void)vircam_destripe(ff,ps.mask,&status);
874  casu_fits_set_error(ff,status);
875  }
876  }
877 
878  /* Look at the first frame in the list and see if the number of
879  microsteps is greater than 1. If so, then we'll have to go
880  through interleaving. */
881 
882  retval = vircam_pfits_get_nusteps(casu_fits_get_phu(ps.sci_fits[0]),
883  &nusteps);
884  if (retval != CASU_OK) {
885  cpl_msg_warning(fctid,"Unable to get nusteps from header.\nAssuming no microstepping");
886  nusteps = 1;
887  }
888 
889  /* If the number of microsteps is 1 then copy over the good frames
890  into a fits list for dithering. */
891 
892  ps.ndith = 0;
893  if (nusteps < 4) {
894  if (nusteps == 1)
895  cpl_msg_info(fctid,"No interleaving will be done");
896  else
897  cpl_msg_warning(fctid,"Illegal number of microsteps: %" CPL_SIZE_FORMAT "\nNo interleaving will be done",
898  (cpl_size)nusteps);
899  ps.dith_input = cpl_malloc(ps.nscience*sizeof(casu_fits *));
900  ps.dithc_input = cpl_malloc(sizeof(casu_fits *));
901  for (i = 0; i < ps.nscience; i++) {
902  if (casu_fits_get_status(ps.sci_fits[i]) == CASU_OK)
903  ps.dith_input[ps.ndith++] = ps.sci_fits[i];
904  }
905  ps.dithc_input[0] = ps.fconf;
906  ps.ndithc = 1;
907  interlv = 0;
908 
909  /* If the number of microsteps is more than 1, then we need
910  to do interleaving. The interleaving routine define
911  ps.dith_input. */
912 
913  } else {
914  cpl_msg_info(fctid,"Interleaving");
916  interlv = 1;
917  }
918 
919  /* Work out the jitter offsets and the stack the jitter frame */
920 
921  cpl_msg_info(fctid,"Working out jitter offsets");
922  vircam_jmp_dither_offsets(&ps, interlv);
923  cpl_msg_info(fctid,"Stacking jittered frame");
925 
926  /* Do a catalogue generation */
927 
928  cpl_msg_info(fctid,"Doing object extraction");
929  vircam_jmp_catalogue(&ps,interlv);
930 
931  /* Create a matched standards table */
932 
933  cpl_msg_info(fctid,"Matching objects with 2mass standards");
934  vircam_jmp_matched_stds(&ps,current_cat,current_catpath);
935 
936  /* Do a WCS fit for the dithered image */
937 
938  cpl_msg_info(fctid,"Fitting a WCS");
939  vircam_jmp_wcsfit(&ps);
940 
941  /* Finally do the photometric zeropoint fit */
942 
943  cpl_msg_info(fctid,"Doing photometric zeropoint calculation");
944  vircam_jmp_photcal(&ps);
945 
946  /* Save the simple images */
947 
948  if (vircam_jmp_get_config_savesimple()) {
949  cpl_msg_info(fctid,"Saving simple images");
950  if (vircam_jmp_save_simple(&ps,framelist,parlist) != 0) {
951  vircam_jmp_tidy(&ps,0);
952  return(-1);
953  }
954  }
955  if (offsky == 1) {
956  if (vircam_jmp_get_config_savesimple()) {
957  cpl_msg_info(fctid,"Saving offset sky simple images");
958  if (vircam_jmp_save_simple_offsets(&ps,framelist,parlist) != 0) {
959  vircam_jmp_tidy(&ps,0);
960  return(-1);
961  }
962  }
963  cpl_msg_info(fctid,"Saving mean offset sky image");
964  if (vircam_jmp_save_offsky(&ps,framelist,parlist) != 0) {
965  vircam_jmp_tidy(&ps,0);
966  return(-1);
967  }
968  }
969  casu_mask_clear(ps.mask);
970 
971  /* Save super frames */
972 
973  if (interlv) {
974  cpl_msg_info(fctid,"Saving superframe images");
975  if (vircam_jmp_save_super(&ps,framelist,parlist) != 0) {
976  vircam_jmp_tidy(&ps,0);
977  return(-1);
978  }
979  }
980 
981  /* Save the dithered images */
982 
983  cpl_msg_info(fctid,"Saving stacked image");
984  dummyqc = vircam_jitter_microstep_process_dummyqc(1);
985  if (vircam_jmp_save_stack(&ps,framelist,parlist,dummyqc) != 0) {
986  vircam_jmp_tidy(&ps,0);
987  freepropertylist(dummyqc);
988  return(-1);
989  }
990  freepropertylist(dummyqc);
991  if (vircam_jmp_get_config_savecat()) {
992  cpl_msg_info(fctid,"Saving stacked image catalogue");
993  dummyqc = vircam_jitter_microstep_process_dummyqc(2);
994  if (vircam_jmp_save_catalogue(&ps,framelist,parlist,dummyqc) != 0) {
995  vircam_jmp_tidy(&ps,0);
996  freepropertylist(dummyqc);
997  return(-1);
998  }
999  freepropertylist(dummyqc);
1000  }
1001 
1002  /* Clean up on aisle 12! */
1003 
1004  vircam_jmp_tidy(&ps,1);
1005  }
1006 
1007  /* Final cleanup */
1008 
1009  vircam_jmp_tidy(&ps,0);
1010  return(0);
1011 }
1012 
1013 static cpl_propertylist *vircam_jitter_microstep_process_dummyqc(int type) {
1014  cpl_propertylist *p;
1015 
1016  /* Get an empty property list */
1017 
1018  p = cpl_propertylist_new();
1019 
1020  /* Now switch for the various products */
1021 
1022  switch (type) {
1023 
1024  /* Stack images */
1025 
1026  case 1:
1027  cpl_propertylist_update_double(p,"ESO QC WCS_DCRVAL1",0.0);
1028  cpl_propertylist_set_comment(p,"ESO QC WCS_DCRVAL1",
1029  "[deg] change in crval1");
1030  cpl_propertylist_update_double(p,"ESO QC WCS_DCRVAL2",0.0);
1031  cpl_propertylist_set_comment(p,"ESO QC WCS_DCRVAL2",
1032  "[deg] change in crval2");
1033  cpl_propertylist_update_double(p,"ESO QC WCS_DTHETA",0.0);
1034  cpl_propertylist_set_comment(p,"ESO QC WCS_DTHETA",
1035  "[deg] change in rotation");
1036  cpl_propertylist_update_double(p,"ESO QC WCS_SCALE",0.0);
1037  cpl_propertylist_set_comment(p,"ESO QC WCS_SCALE",
1038  "[arcsec] mean plate scale");
1039  cpl_propertylist_update_double(p,"ESO QC WCS_SHEAR",0.0);
1040  cpl_propertylist_set_comment(p,"ESO QC WCS_SHEAR",
1041  "[deg] abs(xrot) - abs(yrot)");
1042  cpl_propertylist_update_double(p,"ESO QC WCS_RMS",0.0);
1043  cpl_propertylist_set_comment(p,"ESO QC WCS_RMS",
1044  "[arcsec] Average error in WCS fit");
1045  cpl_propertylist_update_float(p,"ESO QC MAGZPT",0.0);
1046  cpl_propertylist_set_comment(p,"ESO QC MAGZPT",
1047  "[mag] photometric zeropoint");
1048  cpl_propertylist_update_float(p,"ESO QC MAGZERR",0.0);
1049  cpl_propertylist_set_comment(p,"ESO QC MAGZERR",
1050  "[mag] photometric zeropoint error");
1051  cpl_propertylist_update_int(p,"ESO QC MAGNZPT",0);
1052  cpl_propertylist_set_comment(p,"ESO QC MAGNZPT",
1053  "number of stars in magzpt calc");
1054  cpl_propertylist_update_int(p,"ESO QC MAGNCUT",0);
1055  cpl_propertylist_set_comment(p,"ESO QC MAGNCUT",
1056  "number of stars cut from magzpt calc");
1057  cpl_propertylist_update_float(p,"ESO QC LIMITING_MAG",0.0);
1058  cpl_propertylist_set_comment(p,"ESO QC LIMITING_MAG",
1059  "[mag] 5 sigma limiting mag");
1060  break;
1061 
1062  /* Catalogues */
1063 
1064  case 2:
1065  cpl_propertylist_update_float(p,"ESO QC SATURATION",0.0);
1066  cpl_propertylist_set_comment(p,"ESO QC SATURATION",
1067  "[adu] Saturation level");
1068  cpl_propertylist_update_float(p,"ESO QC MEAN_SKY",0.0);
1069  cpl_propertylist_set_comment(p,"ESO QC MEAN_SKY",
1070  "[adu] Median sky brightness");
1071  cpl_propertylist_update_float(p,"ESO QC SKY_NOISE",0.0);
1072  cpl_propertylist_set_comment(p,"ESO QC SKY_NOISE",
1073  "[adu] Pixel noise at sky level");
1074  cpl_propertylist_update_float(p,"ESO QC IMAGE_SIZE",0.0);
1075  cpl_propertylist_set_comment(p,"ESO QC IMAGE_SIZE",
1076  "[pixels] Average FWHM of stellar objects")
1077 ;
1078  cpl_propertylist_update_float(p,"ESO QC ELLIPTICITY",0.0);
1079  cpl_propertylist_set_comment(p,"ESO QC ELLIPTICITY",
1080  "Average stellar ellipticity (1-b/a)");
1081  cpl_propertylist_update_float(p,"ESO QC APERTURE_CORR",0.0);
1082  cpl_propertylist_set_comment(p,"ESO QC APERTURE_CORR",
1083  "Stellar ap-corr 1x core flux");
1084  cpl_propertylist_update_int(p,"ESO QC NOISE_OBJ",0);
1085  cpl_propertylist_set_comment(p,"ESO QC NOISE_OBJ",
1086  "Number of noise objects");
1087  break;
1088  default:
1089  break;
1090  }
1091 
1092  /* Get out of here */
1093 
1094  return(p);
1095 }
1096 
1099 /*
1100 
1101 $Log: not supported by cvs2svn $
1102 Revision 1.69 2012/01/15 17:40:09 jim
1103 Minor modifications to take into accout the changes in cpl API for v6
1104 
1105 Revision 1.68 2011/05/09 09:58:10 jim
1106 Cosmetic changes to stop compiler warnings
1107 
1108 Revision 1.67 2010/12/09 13:19:44 jim
1109 Modified comments
1110 
1111 Revision 1.66 2010/09/13 11:43:13 jim
1112 Added flag DRS SKYCOR if background correction isn't being done
1113 
1114 Revision 1.65 2010/09/10 11:25:19 jim
1115 Modified so that a master sky can now be used.
1116 
1117 Revision 1.64 2010/09/09 12:15:35 jim
1118 Added new QC parameter MAGNCUT
1119 
1120 Revision 1.63 2010/06/03 11:30:40 jim
1121 Modified so that object deblending is done by default. Also fixed bug where
1122 offset sky images were saved when --savesimple was switched off
1123 
1124 Revision 1.62 2010/03/21 06:47:42 jim
1125 Added code to trap for problems in saving products
1126 
1127 Revision 1.61 2010/03/12 10:44:07 lbilbao
1128 Added missing header inclusion.
1129 
1130 Revision 1.60 2010/02/08 16:35:26 jim
1131 Moved the definition of propertylist ps.phupaf to the recipes so that
1132 this doesn't fail when we don't save the simple images
1133 
1134 Revision 1.59 2010/01/31 18:57:15 jim
1135 Now simple images are only saved when you really want them
1136 
1137 Revision 1.58 2009/12/11 06:52:56 jim
1138 Minor mods to documentation
1139 
1140 Revision 1.57 2009/09/22 12:29:37 jim
1141 Modified to do offset sky exposures
1142 
1143 Revision 1.56 2009/07/03 12:30:04 jim
1144 Default value of rcore is now 3
1145 
1146 Revision 1.55 2009/02/04 09:23:29 jim
1147 Moved destriping to after sky subtraction
1148 
1149 Revision 1.54 2009/01/19 14:36:02 jim
1150 Added vircam_nditcor
1151 
1152 Revision 1.53 2008/12/08 06:38:41 jim
1153 Added trap for crval==0 error. Also added a trap for illegal 2x1 microstep
1154 sequences
1155 
1156 Revision 1.52 2008/11/27 09:14:47 jim
1157 Fixed PRO CATG keyword values for interleaved confidence maps in docs
1158 
1159 Revision 1.51 2008/11/25 18:55:59 jim
1160 took out extra sky stuff
1161 
1162 Revision 1.50 2008/11/25 12:03:21 jim
1163 Fixed doc
1164 
1165 Revision 1.49 2008/11/25 11:53:50 jim
1166 Changed type for 'skycor' parameter to an enum. Recipe now allows for standard
1167 or object masked sky estimate
1168 
1169 Revision 1.48 2008/10/01 04:59:13 jim
1170 Added call to vircam_frameset_fexists to check input frameset
1171 
1172 Revision 1.47 2008/05/06 12:15:20 jim
1173 Changed to use new version of vircam_catpars
1174 
1175 Revision 1.46 2007/11/26 09:59:06 jim
1176 Recipe now takes ndit into account when doing linearity correction
1177 
1178 Revision 1.45 2007/10/25 18:39:22 jim
1179 Altered to remove some lint messages
1180 
1181 Revision 1.44 2007/10/19 06:55:06 jim
1182 Modifications made to use new method for directing the recipes to the
1183 standard catalogues using the sof
1184 
1185 Revision 1.43 2007/07/09 13:21:55 jim
1186 Modified to use new version of vircam_exten_range
1187 
1188 Revision 1.42 2007/06/13 08:11:27 jim
1189 Modified docs to reflect changes in DFS tags
1190 
1191 Revision 1.41 2007/05/15 08:55:19 jim
1192 Moved the saving of the products to later in the loop so that the jitter
1193 and microstep offsets will be written to the product headers
1194 
1195 Revision 1.40 2007/05/08 21:31:15 jim
1196 fixed typo
1197 
1198 Revision 1.39 2007/05/08 10:42:44 jim
1199 Added gain correction
1200 
1201 Revision 1.38 2007/04/04 16:05:59 jim
1202 Modified to make paf information a bit more correct
1203 
1204 Revision 1.37 2007/04/04 10:36:18 jim
1205 Modified to use new dfs tags
1206 
1207 Revision 1.36 2007/03/29 12:19:38 jim
1208 Little changes to improve documentation
1209 
1210 Revision 1.35 2007/03/14 14:49:13 jim
1211 Fixed problem with missing paf files in jmp recipes if detlive = F. Also
1212 fixed problem where extra dummy products were being created
1213 
1214 Revision 1.34 2007/03/06 12:00:48 jim
1215 Fixed stupid typo in header
1216 
1217 Revision 1.33 2007/03/01 12:41:49 jim
1218 Modified slightly after code checking
1219 
1220 Revision 1.32 2007/02/07 10:12:39 jim
1221 Removed calls to vircam_ndit_correct as this is now no longer necessary
1222 
1223 Revision 1.31 2006/12/19 13:31:27 jim
1224 Fixed path2mass alias name. Also detectors flagged as dead now only generate
1225 an INFO message
1226 
1227 Revision 1.30 2006/11/29 12:28:45 jim
1228 Modified so that the correct recipe names would appear in the headers of
1229 data products
1230 
1231 Revision 1.29 2006/11/27 12:17:25 jim
1232 Almost all support routines are now in vircam/vircam_jmp_utils.c
1233 
1234 Revision 1.28 2006/11/22 21:57:06 jim
1235 Modified how readnoise and gain are read
1236 
1237 Revision 1.27 2006/11/10 09:23:06 jim
1238 Added sky correction and destriping along with the relevant command line
1239 parameters. Also fixed save routines so that dummy products will get the
1240 IMADUMMY flag.
1241 
1242 Revision 1.26 2006/09/09 16:49:40 jim
1243 Header comment update
1244 
1245 Revision 1.25 2006/08/07 14:21:03 jim
1246 Made a few more changes to make sure that if things fail then it doesn't try
1247 and run further processing steps
1248 
1249 Revision 1.24 2006/08/07 12:59:52 jim
1250 Fixed DET LIVE problem (I think)
1251 
1252 Revision 1.23 2006/08/01 11:28:14 jim
1253 Modified to use new smoothing kernel width parameter in imcore
1254 
1255 Revision 1.22 2006/07/19 10:42:50 jim
1256 Fixed a bug where the product frame lists were being deleted too early
1257 
1258 Revision 1.21 2006/07/17 12:51:48 jim
1259 Plugged a great number of memory leaks (mainly to do with propertylists)
1260 
1261 Revision 1.20 2006/07/17 09:31:24 jim
1262 Fixed a small memory leak and a bug in vircam_jmp_dither_offsets
1263 
1264 Revision 1.19 2006/07/11 14:56:17 jim
1265 Changes in the interleaving and jitter routines so that missing data
1266 and frames that are flagged as bad are dealt with properly
1267 
1268 Revision 1.18 2006/07/07 09:34:21 jim
1269 Fixed a few bugs relating to interleaving
1270 
1271 Revision 1.17 2006/07/04 09:19:03 jim
1272 replaced all sprintf statements with snprintf
1273 
1274 Revision 1.16 2006/06/20 19:07:01 jim
1275 Corrects for ndit != 1
1276 
1277 Revision 1.15 2006/06/19 20:50:35 jim
1278 Put a better algorithm for working out an output file name into
1279 vircam_jmp_save_smple
1280 
1281 Revision 1.14 2006/06/15 09:58:58 jim
1282 Minor changes to docs
1283 
1284 Revision 1.13 2006/06/14 14:17:13 jim
1285 minor documentation fix
1286 
1287 Revision 1.12 2006/06/13 21:28:39 jim
1288 Uses new VIRCAM_CALIB_READGAIN_FILE as an input now.
1289 
1290 Revision 1.11 2006/06/13 14:10:59 jim
1291 Fixed routine that saves catalogues to remove WCS stuff from extension header.
1292 
1293 Revision 1.10 2006/06/09 22:25:06 jim
1294 tidied up a few bugs
1295 
1296 Revision 1.9 2006/06/09 11:26:25 jim
1297 Small changes to keep lint happy
1298 
1299 Revision 1.8 2006/06/08 14:52:52 jim
1300 Fixed a few little bugs
1301 
1302 Revision 1.7 2006/06/06 13:03:30 jim
1303 Added QC parameters to docs
1304 
1305 Revision 1.6 2006/06/01 14:34:06 jim
1306 Now accepts a bad pixel mask in place of a confidence map for emergency use
1307 
1308 Revision 1.5 2006/05/30 14:27:54 jim
1309 Added illcor parameter to call for photcal
1310 
1311 Revision 1.4 2006/05/30 12:15:42 jim
1312 Cosmetic changes
1313 
1314 Revision 1.3 2006/05/27 21:25:49 jim
1315 Added some more docs
1316 
1317 Revision 1.2 2006/05/26 15:06:06 jim
1318 Fixed lots of little bugs
1319 
1320 Revision 1.1 2006/05/24 13:39:29 jim
1321 First cut
1322 
1323 
1324 */
int casu_fits_get_status(casu_fits *p)
Definition: casu_fits.c:711
cpl_image * casu_fits_get_image(casu_fits *p)
Definition: casu_fits.c:436
casu_fits * casu_fits_load(cpl_frame *frame, cpl_type type, int nexten)
Definition: casu_fits.c:80
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
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
int casu_flatcor(casu_fits *infile, casu_fits *flatsrc, int *status)
Correct input data for flat field response.
Definition: casu_flatcor.c:79
int casu_nditcor(casu_fits *infile, int ndit, const char *expkey, int *status)
Correct input data for number of dits.
Definition: casu_nditcor.c:85
int casu_darkcor(casu_fits *infile, casu_fits *darksrc, float darkscl, int *status)
Correct input data for dark current.
Definition: casu_darkcor.c:86
int casu_gaincor(casu_fits *infile, float gainscl, int *status)
Gain correct input data frame.
Definition: casu_gaincor.c:77
casu_tfits * casu_tfits_load(cpl_frame *table, int nexten)
Definition: casu_tfits.c:78
cpl_frame * casu_frameset_subgroup_1(cpl_frameset *frameset, cpl_size *labels, cpl_size nlab, const char *tag)
Extract a frame of a given label from a frameset.
Definition: casu_utils.c:206
int casu_compare_tags(const cpl_frame *frame1, const cpl_frame *frame2)
Compare input tags.
Definition: casu_utils.c:96
int casu_catpars(cpl_frame *indx, char **catpath, char **catname)
Find the name of the standard catalogue and its location.
Definition: casu_utils.c:899
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 casu_gaincor_calc(cpl_frame *frame, int *n, float **cors, int *status)
Work out gain corrections.
Definition: casu_utils.c:757
int vircam_destripe(casu_fits *in, casu_mask *inbpm, int *status)
Remove stripes from the background of an image.
int vircam_lincor(casu_fits *infile, casu_tfits *lchantab, int kconst, int ndit, int *status)
Apply linearity curves to data.
int vircam_dfs_set_groups(cpl_frameset *set)
Definition: vircam_dfs.c:115
int vircam_jmp_save_offsky(struct psStruct *ps, cpl_frameset *framelist, cpl_parameterlist *parlist)
void vircam_jmp_dither_images(struct psStruct *ps)
void vircam_jmp_init(struct psStruct *ps)
void vircam_jmp_get_readnoise_gain(struct psStruct *ps, int jext, float *readnoise, float *gain)
void vircam_jmp_matched_stds(struct psStruct *ps, char *cata, char *catapath)
int vircam_jmp_save_super(struct psStruct *ps, cpl_frameset *framelist, cpl_parameterlist *parlist)
void vircam_jmp_bpm2conf(struct psStruct *ps)
int vircam_jmp_save_catalogue(struct psStruct *ps, cpl_frameset *framelist, cpl_parameterlist *parlist, cpl_propertylist *dummyqcprops)
void vircam_jmp_wcsfit(struct psStruct *ps)
void vircam_jmp_photcal(struct psStruct *ps)
int vircam_jmp_save_stack(struct psStruct *ps, cpl_frameset *framelist, cpl_parameterlist *parlist, cpl_propertylist *dummyqcprops)
int vircam_jmp_save_simple_offsets(struct psStruct *ps, cpl_frameset *framelist, cpl_parameterlist *parlist)
void vircam_jmp_dither_offsets(struct psStruct *ps, int inter_lv)
void vircam_jmp_tidy(struct psStruct *ps, int level)
int vircam_jmp_save_simple(struct psStruct *ps, cpl_frameset *framelist, cpl_parameterlist *parlist)
void vircam_jmp_skycor(struct psStruct *ps)
void vircam_jmp_interleave(struct psStruct *ps)
void vircam_jmp_catalogue(struct psStruct *ps, int inter_lv)
int vircam_pfits_get_ndit(const cpl_propertylist *plist, int *ndit)
Get the value of NDIT.
Definition: vircam_pfits.c:583
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_nusteps(const cpl_propertylist *plist, int *nusteps)
Get the value of the number of microsteps in a sequence.
Definition: vircam_pfits.c:422
int vircam_check_crval(cpl_propertylist *phu, cpl_propertylist *ehu)
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