vircam_jitter_microstep_process.c

00001 /* $Id: vircam_jitter_microstep_process.c,v 1.70 2012/01/16 12:32:18 jim Exp $
00002  *
00003  * This file is part of the VIRCAM Pipeline
00004  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: jim $
00023  * $Date: 2012/01/16 12:32:18 $
00024  * $Revision: 1.70 $
00025  * $Name: vcam-1_3_0 $
00026  */
00027 
00028 /* Includes */
00029 
00030 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033 
00034 #include <stdio.h>
00035 #include <string.h>
00036 #include <cpl.h>
00037 #include <math.h>
00038 
00039 #include "vircam_utils.h"
00040 #include "vircam_mask.h"
00041 #include "vircam_pfits.h"
00042 #include "vircam_dfs.h"
00043 #include "vircam_mods.h"
00044 #include "vircam_fits.h"
00045 #include "vircam_tfits.h"
00046 #include "vircam_jmp_utils.h"
00047 #include "vircam_paf.h"
00048 
00049 /* Function prototypes */
00050 
00051 static int vircam_jitter_microstep_process_create(cpl_plugin *);
00052 static int vircam_jitter_microstep_process_exec(cpl_plugin *);
00053 static int vircam_jitter_microstep_process_destroy(cpl_plugin *);
00054 static int vircam_jitter_microstep_process(cpl_parameterlist *, 
00055                                            cpl_frameset *);
00056 static cpl_propertylist *vircam_jitter_microstep_process_dummyqc(int type);
00057 
00058 
00059 static char vircam_jitter_microstep_process_description[] =
00060 "vircam_jitter_microstep_process -- VIRCAM science product recipe.\n\n"
00061 "Process a complete pawprint for VIRCAM data. Remove instrumental\n"
00062 "signature, interleave microstep sequences (if done), combine jitters\n"
00063 "photometrically and astrometrically calibrate the pawprint image\n\n"
00064 "The program accepts the following files in the SOF:\n\n"
00065 "    Tag                   Description\n"
00066 "    -----------------------------------------------------------------------\n"
00067 "    %-21s A list of raw science images or\n"
00068 "    %-21s A list of raw science images (extended)\n"
00069 "    %-21s A list of offset sky exposures (optional)\n"
00070 "    %-21s A master dark frame\n"
00071 "    %-21s A master twilight flat frame\n"
00072 "    %-21s A master sky frame (optional)\n"
00073 "    %-21s A channel table\n"
00074 "    %-21s A photometric calibration table\n"
00075 "    %-21s A readnoise/gain file\n"
00076 "    %-21s A master confidence map or\n"
00077 "    %-21s A master bad pixel mask\n"
00078 "    %-21s A master standard star index\n"
00079 "All of the above are required\n"
00080 "\n";
00081 
00219 /* Function code */
00220 
00221 /*---------------------------------------------------------------------------*/
00229 /*---------------------------------------------------------------------------*/
00230 
00231 int cpl_plugin_get_info(cpl_pluginlist *list) {
00232     cpl_recipe  *recipe = cpl_calloc(1,sizeof(*recipe));
00233     cpl_plugin  *plugin = &recipe->interface;
00234     char alldesc[SZ_ALLDESC];
00235     (void)snprintf(alldesc,SZ_ALLDESC,
00236                    vircam_jitter_microstep_process_description,
00237                    VIRCAM_SCI_OBJECT_RAW,VIRCAM_SCI_OBJECT_EXT_RAW,
00238                    VIRCAM_OFFSET_SKY_RAW,VIRCAM_CAL_DARK,
00239                    VIRCAM_CAL_TWILIGHT_FLAT,VIRCAM_CAL_SKY,VIRCAM_CAL_CHANTAB,
00240                    VIRCAM_CAL_PHOTTAB,VIRCAM_CAL_READGAINFILE,VIRCAM_CAL_CONF,
00241                    VIRCAM_CAL_BPM,VIRCAM_CAL_2MASS);
00242 
00243     cpl_plugin_init(plugin,
00244                     CPL_PLUGIN_API,
00245                     VIRCAM_BINARY_VERSION,
00246                     CPL_PLUGIN_TYPE_RECIPE,
00247                     "vircam_jitter_microstep_process",
00248                     "VIRCAM jitter microstep recipe",
00249                     alldesc,
00250                     "Jim Lewis",
00251                     "jrl@ast.cam.ac.uk",
00252                     vircam_get_license(),
00253                     vircam_jitter_microstep_process_create,
00254                     vircam_jitter_microstep_process_exec,
00255                     vircam_jitter_microstep_process_destroy);
00256 
00257     cpl_pluginlist_append(list,plugin);
00258 
00259     return(0);
00260 }
00261 
00262 /*---------------------------------------------------------------------------*/
00271 /*---------------------------------------------------------------------------*/
00272 
00273 static int vircam_jitter_microstep_process_create(cpl_plugin *plugin) {
00274     cpl_recipe      *recipe;
00275     cpl_parameter   *p;
00276 
00277     /* Get the recipe out of the plugin */
00278 
00279     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00280         recipe = (cpl_recipe *)plugin;
00281     else 
00282         return(-1);
00283 
00284     /* Create the parameters list in the cpl_recipe object */
00285 
00286     recipe->parameters = cpl_parameterlist_new();
00287 
00288     /* Fill in the minimum object size */
00289 
00290     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.ipix",
00291                                 CPL_TYPE_INT,
00292                                 "Minimum pixel area for each detected object",
00293                                 "vircam.vircam_jitter_microstep_process",5);
00294     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"ipix");
00295     cpl_parameterlist_append(recipe->parameters,p);
00296 
00297     /* Fill in the detection threshold parameter */
00298 
00299     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.thresh",
00300                                 CPL_TYPE_DOUBLE,
00301                                 "Detection threshold in sigma above sky",
00302                                 "vircam.vircam_jitter_microstep_process",2.0);
00303     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"thr");
00304     cpl_parameterlist_append(recipe->parameters,p);
00305 
00306     /* Fill in flag to use deblending software or not */
00307 
00308     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.icrowd",
00309                                 CPL_TYPE_BOOL,"Use deblending?",
00310                                 "vircam.vircam_jitter_microstep_process",1);
00311     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"icrowd");
00312     cpl_parameterlist_append(recipe->parameters,p);
00313 
00314     /* Fill in core radius */
00315 
00316     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.rcore",
00317                                 CPL_TYPE_DOUBLE,"Value of Rcore in pixels",
00318                                 "vircam.vircam_jitter_microstep_process",3.0);
00319     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"rcore");
00320     cpl_parameterlist_append(recipe->parameters,p);
00321 
00322     /* Fill in background smoothing box size */
00323 
00324     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.nbsize",
00325                                 CPL_TYPE_INT,"Background smoothing box size",
00326                                 "vircam.vircam_jitter_microstep_process",64);
00327     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"nb");
00328     cpl_parameterlist_append(recipe->parameters,p);
00329 
00330     /* Fill in flag to use save the output catalogue */
00331 
00332     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.savecat",
00333                                 CPL_TYPE_BOOL,"Save catalogue?",
00334                                 "vircam.vircam_jitter_microstep_process",1);
00335     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"savecat");
00336     cpl_parameterlist_append(recipe->parameters,p);
00337 
00338 
00339     /* Fill in flag to destripe the images */
00340 
00341     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.destripe",
00342                                 CPL_TYPE_BOOL,"Destripe images?",
00343                                 "vircam.vircam_jitter_microstep_process",1);
00344     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"destripe");
00345     cpl_parameterlist_append(recipe->parameters,p);
00346 
00347     /* Fill in flag to correct sky background */
00348 
00349     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.skycor",
00350                                 CPL_TYPE_BOOL,"Do a sky subtraction?",
00351                                 "vircam.vircam_jitter_microstep_process",1);
00352     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"skycor");
00353     cpl_parameterlist_append(recipe->parameters,p);
00354 
00355     /* Fill in flag to save simple images */
00356 
00357     p = cpl_parameter_new_value("vircam.vircam_jitter_microstep_process.savesimple",
00358                                 CPL_TYPE_BOOL,"Save simple images?",
00359                                 "vircam.vircam_jitter_microstep_process",0);
00360     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"savesimple");
00361     cpl_parameterlist_append(recipe->parameters,p);
00362 
00363     /* Extension number of input frames to use */
00364 
00365     p = cpl_parameter_new_range("vircam.vircam_jitter_microstep_process.extenum",
00366                                 CPL_TYPE_INT,
00367                                 "Extension number to be done, 0 == all",
00368                                 "vircam.vircam_jitter_microstep_process",
00369                                 1,0,16);
00370     cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,"ext");
00371     cpl_parameterlist_append(recipe->parameters,p);
00372         
00373     /* Get out of here */
00374 
00375     return(0);
00376 }
00377     
00378     
00379 /*---------------------------------------------------------------------------*/
00385 /*---------------------------------------------------------------------------*/
00386 
00387 static int vircam_jitter_microstep_process_exec(cpl_plugin *plugin) {
00388     cpl_recipe  *recipe;
00389 
00390     /* Get the recipe out of the plugin */
00391 
00392     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00393         recipe = (cpl_recipe *)plugin;
00394     else 
00395         return(-1);
00396 
00397     return(vircam_jitter_microstep_process(recipe->parameters,recipe->frames));
00398 }
00399                                 
00400 /*---------------------------------------------------------------------------*/
00406 /*---------------------------------------------------------------------------*/
00407 
00408 static int vircam_jitter_microstep_process_destroy(cpl_plugin *plugin) {
00409     cpl_recipe *recipe ;
00410 
00411     /* Get the recipe out of the plugin */
00412 
00413     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00414         recipe = (cpl_recipe *)plugin;
00415     else 
00416         return(-1);
00417 
00418     cpl_parameterlist_delete(recipe->parameters);
00419     return(0);
00420 }
00421 
00422 /*---------------------------------------------------------------------------*/
00429 /*---------------------------------------------------------------------------*/
00430 
00431 static int vircam_jitter_microstep_process(cpl_parameterlist *parlist, 
00432                                            cpl_frameset *framelist) {
00433     const char *fctid="vircam_jitter_microstep_process";
00434     cpl_parameter *p;
00435     int jst,jfn,status,j,i,retval,nusteps,isconf,live,ndit;
00436     cpl_size nlab;
00437     float readnoise,gain,gaincor_fac;
00438     vir_fits *ff;
00439     cpl_frame *catindex;
00440     cpl_propertylist *pp;
00441 
00442     /* Check validity of input frameset */
00443 
00444     if (framelist == NULL || cpl_frameset_get_size(framelist) <= 0) {
00445         cpl_msg_error(fctid,"Input framelist NULL or has no input data");
00446         return(-1);
00447     }
00448 
00449     /* Check the files in the frameset */
00450 
00451     if (vircam_frameset_fexists(framelist) != VIR_OK) {
00452         cpl_msg_error(fctid,"Input frameset is missing files. Check SOF");
00453         return(-1);
00454     }
00455 
00456     /* Initialise some things */
00457 
00458     vircam_jmp_init();
00459     (void)strncpy(vircam_recipename,fctid,VIRCAM_PATHSZ);
00460     (void)snprintf(vircam_recipepaf,VIRCAM_PATHSZ,"VIRCAM/%s",fctid);
00461     recflag = RECSCI;
00462 
00463     /* Get the parameters */
00464 
00465     p = cpl_parameterlist_find(parlist,
00466                                "vircam.vircam_jitter_microstep_process.ipix");
00467     vircam_jmp_config.ipix = cpl_parameter_get_int(p);
00468     p = cpl_parameterlist_find(parlist,
00469                                "vircam.vircam_jitter_microstep_process.thresh");
00470     vircam_jmp_config.threshold = (float)cpl_parameter_get_double(p);
00471     p = cpl_parameterlist_find(parlist,
00472                                "vircam.vircam_jitter_microstep_process.icrowd");
00473     vircam_jmp_config.icrowd = cpl_parameter_get_bool(p);
00474     p = cpl_parameterlist_find(parlist,
00475                                "vircam.vircam_jitter_microstep_process.rcore");
00476     vircam_jmp_config.rcore = (float)cpl_parameter_get_double(p);
00477     p = cpl_parameterlist_find(parlist,
00478                                "vircam.vircam_jitter_microstep_process.nbsize");
00479     vircam_jmp_config.nbsize = cpl_parameter_get_int(p);
00480     p = cpl_parameterlist_find(parlist,
00481                                "vircam.vircam_jitter_microstep_process.savecat");
00482     vircam_jmp_config.savecat = cpl_parameter_get_bool(p);
00483     p = cpl_parameterlist_find(parlist,
00484                                "vircam.vircam_jitter_microstep_process.destripe");
00485     vircam_jmp_config.destripe = cpl_parameter_get_bool(p);
00486     p = cpl_parameterlist_find(parlist,
00487                                "vircam.vircam_jitter_microstep_process.skycor");
00488     vircam_jmp_config.skycor = cpl_parameter_get_bool(p);
00489     p = cpl_parameterlist_find(parlist,
00490                                "vircam.vircam_jitter_microstep_process.savesimple");
00491     vircam_jmp_config.savesimple = cpl_parameter_get_bool(p);
00492     p = cpl_parameterlist_find(parlist,
00493                                "vircam.vircam_jitter_microstep_process.extenum");
00494     vircam_jmp_config.extenum = cpl_parameter_get_int(p);
00495 
00496     /* Sort out raw from calib frames */
00497 
00498     if (vircam_dfs_set_groups(framelist) != VIR_OK) {
00499         cpl_msg_error(fctid,"Cannot identify RAW and CALIB frames");
00500         vircam_jmp_tidy(0);
00501         return(-1);
00502     }
00503 
00504     /* Label the input frames */
00505 
00506     if ((ps.labels = cpl_frameset_labelise(framelist,vircam_compare_tags,
00507                                            &nlab)) == NULL) {
00508         cpl_msg_error(fctid,"Cannot labelise the input frames");
00509         vircam_jmp_tidy(0);
00510         return(-1);
00511     }
00512 
00513     /* Get the input science frames */
00514 
00515     if ((ps.science_frames = 
00516          vircam_frameset_subgroup(framelist,ps.labels,nlab,
00517                                   VIRCAM_SCI_OBJECT_RAW)) == NULL) {
00518         if ((ps.science_frames =
00519              vircam_frameset_subgroup(framelist,ps.labels,nlab,
00520                                       VIRCAM_SCI_OBJECT_EXT_RAW)) == NULL) {
00521             cpl_msg_error(fctid,"No science images to process!");
00522             vircam_jmp_tidy(0);
00523             return(-1);
00524         }
00525     }
00526 
00527     /* Get the offset sky frames */
00528     
00529     if ((ps.master_sky = vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00530                                                     VIRCAM_CAL_SKY)) == NULL) { 
00531         if ((ps.offset_skies = 
00532              vircam_frameset_subgroup(framelist,ps.labels,nlab,
00533                                       VIRCAM_OFFSET_SKY_RAW)) == NULL)
00534             offsky = 0;
00535         else 
00536             offsky = 1;
00537     } else {
00538         offsky = -1;
00539     }
00540 
00541     /* Check to see if there is a master dark frame */
00542 
00543     if ((ps.master_dark = 
00544          vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00545                                     VIRCAM_CAL_DARK)) == NULL) {
00546         cpl_msg_error(fctid,"No master dark found");
00547         vircam_jmp_tidy(0);
00548         return(-1);
00549     }
00550         
00551     /* Check to see if there is a master twilight flat frame */
00552 
00553     if ((ps.master_twilight_flat = 
00554          vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00555                                     VIRCAM_CAL_TWILIGHT_FLAT)) == NULL) {
00556         cpl_msg_error(fctid,"No master twilight flat found");
00557         vircam_jmp_tidy(0);
00558         return(-1);
00559     }
00560 
00561     /* Get the gain corrections */
00562 
00563     status = VIR_OK;
00564     if (vircam_gaincor_calc(ps.master_twilight_flat,&i,&(ps.gaincors),
00565                             &status) != VIR_OK) {
00566         cpl_msg_error(fctid,"Error calculating gain corrections");
00567         vircam_jmp_tidy(0);
00568         return(-1);
00569     }
00570         
00571     /* Check to see if there is a readgain file */
00572 
00573     if ((ps.readgain_file = 
00574          vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00575                                     VIRCAM_CAL_READGAINFILE)) == NULL) {
00576         cpl_msg_error(fctid,"No master readnoise/gain file found");
00577         vircam_jmp_tidy(0);
00578         return(-1);
00579     }
00580         
00581     /* Check to see if there is a master confidence map. If there isn't
00582        then look for a bad pixel mask that can be converted into a 
00583        confidence map (in an emergency) */
00584 
00585     isconf = 1;
00586     if ((ps.master_conf = 
00587          vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00588                                     VIRCAM_CAL_CONF)) == NULL) {
00589         isconf = 0;
00590         if ((ps.master_conf = 
00591              vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00592                                         VIRCAM_CAL_BPM)) == NULL) {
00593             cpl_msg_error(fctid,"No master confidence map found");
00594             vircam_jmp_tidy(0);
00595             return(-1);
00596         }
00597     }
00598     ps.mask = vircam_mask_define(framelist,ps.labels,nlab);
00599         
00600     /* Check to see if there is a channel table */
00601 
00602     if ((ps.chantab = vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00603                                                  VIRCAM_CAL_CHANTAB)) == NULL) {
00604         cpl_msg_error(fctid,"No channel table found");
00605         vircam_jmp_tidy(0);
00606         return(-1);
00607     }
00608 
00609     /* Check to see if there is a photometric table */
00610 
00611     if ((ps.phottab = vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00612                                                  VIRCAM_CAL_PHOTTAB)) == NULL) {
00613         cpl_msg_error(fctid,"No photometric table found");
00614         vircam_jmp_tidy(0);
00615         return(-1);
00616     }
00617     if ((ps.tphottab = cpl_table_load(cpl_frame_get_filename(ps.phottab),1,0)) == NULL) {
00618         cpl_msg_error(fctid,"Unable to load photometric table");
00619         vircam_jmp_tidy(0);
00620         return(-1);
00621     }
00622 
00623     /* Is the 2mass index file specified? */
00624 
00625     if ((catindex = vircam_frameset_subgroup_1(framelist,ps.labels,nlab,
00626                                                VIRCAM_CAL_2MASS)) == NULL) {
00627         cpl_msg_info(fctid,"No 2MASS index found -- cannot continue");
00628         vircam_jmp_tidy(0);
00629         return(-1);
00630     }
00631     
00632     /* Get catalogue parameters */
00633 
00634     if (vircam_catpars(catindex,&(ps.catpath),&(ps.catname)) == VIR_FATAL) {
00635         vircam_jmp_tidy(0);
00636         cpl_frame_delete(catindex);
00637         return(-1);
00638     }
00639     cpl_frame_delete(catindex);
00640 
00641     /* Set up the photometric calibration catalogue data */
00642 
00643     (void)strcpy(current_catpath,ps.catpath);
00644     (void)strcpy(current_cat,ps.catname);
00645 
00646     /* Get the number of DITs */
00647 
00648     pp = cpl_propertylist_load(cpl_frame_get_filename(cpl_frameset_get_frame(ps.science_frames,0)),0);
00649     if (vircam_pfits_get_ndit(pp,&ndit) != VIR_OK) {
00650         cpl_msg_error(fctid,"No value for NDIT available");
00651         freepropertylist(pp);
00652         vircam_jmp_tidy(0);
00653         return(-1);
00654     }
00655     cpl_propertylist_delete(pp);
00656 
00657     /* Now, how many image extensions do we want to do? If the extension
00658        number is zero, then we loop for all possible extensions. If it
00659        isn't then we just do the extension specified */
00660 
00661     vircam_exten_range(vircam_jmp_config.extenum,
00662                        (const cpl_frame *)cpl_frameset_get_frame(ps.science_frames,0),
00663                        &jst,&jfn);
00664     if (jst == -1 || jfn == -1) {
00665         cpl_msg_error(fctid,"Unable to continue");
00666         vircam_jmp_tidy(0);
00667         return(-1);
00668     }
00669 
00670     /* Now loop for all the extensions... */
00671 
00672     status = VIR_OK;
00673     for (j = jst; j <= jfn; j++) {
00674         isfirst = (j == jst);
00675         gaincor_fac = (ps.gaincors)[j-1];
00676         cpl_msg_info(fctid,"Beginning extension [%" CPL_SIZE_FORMAT "]",
00677                      (cpl_size)j);
00678 
00679         /* Load up the calibration frames into vir_fits/vir_tfits structures 
00680            It is a fatal error if any one of them can't load properly */
00681         
00682         ps.fdark = vircam_fits_load(ps.master_dark,CPL_TYPE_FLOAT,j);
00683         if (ps.fdark == NULL) {
00684             cpl_msg_error(fctid,
00685                           "Error loading master dark %s[%" CPL_SIZE_FORMAT "]\n%s",
00686                           cpl_frame_get_filename(ps.master_dark),(cpl_size)j,
00687                           cpl_error_get_message());
00688             vircam_jmp_tidy(0);
00689             return(-1);
00690         }
00691         ps.fflat = vircam_fits_load(ps.master_twilight_flat,CPL_TYPE_FLOAT,j);
00692         if (ps.fflat == NULL) {
00693             cpl_msg_error(fctid,
00694                           "Error loading master flat %s[%" CPL_SIZE_FORMAT "]\n%s",
00695                           cpl_frame_get_filename(ps.master_twilight_flat),
00696                           (cpl_size)j,cpl_error_get_message());
00697             vircam_jmp_tidy(0);
00698             return(-1);
00699         }
00700         ps.fconf = vircam_fits_load(ps.master_conf,CPL_TYPE_INT,j);
00701         if (ps.fconf == NULL) {
00702             cpl_msg_error(fctid,
00703                           "Error loading master conf %s[%" CPL_SIZE_FORMAT "]\n%s",
00704                           cpl_frame_get_filename(ps.master_conf),(cpl_size)j,
00705                           cpl_error_get_message());
00706             vircam_jmp_tidy(0);
00707             return(-1);
00708         }
00709         if (! isconf) 
00710             vircam_jmp_bpm2conf();
00711         if (vircam_mask_load(ps.mask,j,
00712                              (int)cpl_image_get_size_x(vircam_fits_get_image(ps.fconf)),
00713                              (int)cpl_image_get_size_y(vircam_fits_get_image(ps.fconf))) != VIR_OK) {
00714             cpl_msg_error(fctid,
00715                           "Error loading mask from master conf %s[%" CPL_SIZE_FORMAT "]\n%s",
00716                           cpl_frame_get_filename(ps.master_conf),(cpl_size)j,
00717                           cpl_error_get_message());
00718             vircam_jmp_tidy(0);
00719             return(-1);
00720         }
00721         if (offsky == -1) {
00722             ps.fsky = vircam_fits_load(ps.master_sky,CPL_TYPE_FLOAT,j);
00723             if (ps.fsky == NULL) {
00724                 cpl_msg_error(fctid,
00725                               "Error loading master sky %s[%" CPL_SIZE_FORMAT "]\n%s",
00726                               cpl_frame_get_filename(ps.master_sky),(cpl_size)j,
00727                               cpl_error_get_message());
00728                 vircam_jmp_tidy(0);
00729                 return(-1);
00730             }
00731         }
00732         ps.fchantab = vircam_tfits_load(ps.chantab,j);
00733         if (ps.fchantab == NULL) {
00734             cpl_msg_error(fctid,
00735                           "Error loading channel table %s[%" CPL_SIZE_FORMAT "]\n%s",
00736                           cpl_frame_get_filename(ps.chantab),(cpl_size)j,
00737                           cpl_error_get_message());
00738             vircam_jmp_tidy(0);
00739             return(-1);
00740         }
00741 
00742         /* Load up the vir_fits structures for the science images */
00743 
00744         ps.nscience = cpl_frameset_get_size(ps.science_frames);
00745         ps.sci_fits = vircam_fits_load_list(ps.science_frames,CPL_TYPE_FLOAT,j);
00746         if (ps.sci_fits == NULL) {
00747             cpl_msg_error(fctid,
00748                           "Error loading science frames extension %" CPL_SIZE_FORMAT ": %s",
00749                           (cpl_size)j,cpl_error_get_message());
00750             vircam_jmp_tidy(0);
00751             return(-1);
00752         }
00753 
00754         /* Set up something for the PAFs */
00755 
00756         ps.phupaf = vircam_paf_phu_items(vircam_fits_get_phu(ps.sci_fits[0]));
00757 
00758         /* Load up the vir_fits structures for the offset skies (if needed) */
00759 
00760         if (offsky == 1) {
00761             ps.noffsets = cpl_frameset_get_size(ps.offset_skies);
00762             ps.offsky_fits = vircam_fits_load_list(ps.offset_skies,
00763                                                    CPL_TYPE_FLOAT,j);
00764             if (ps.offsky_fits == NULL) {
00765                 cpl_msg_error(fctid,
00766                               "Error loading offset skies extension %" CPL_SIZE_FORMAT ": %s",
00767                               (cpl_size)j,cpl_error_get_message());
00768                 vircam_jmp_tidy(0);
00769                 return(-1);
00770             }
00771         } else {
00772             ps.noffsets = 0;
00773             ps.offsky_fits = NULL;
00774         }
00775 
00776         /* Loop through and mark the frames where the header says the detector
00777            wasn't live. Also check to see if the CRVAL == 0 problem is 
00778            present. Check for live detectors in the offset skies too */
00779 
00780         for (i = 0; i < ps.nscience; i++) {
00781             ff = ps.sci_fits[i];
00782             vircam_pfits_get_detlive(vircam_fits_get_ehu(ff),&live);
00783             if (! live) 
00784                 vircam_fits_set_error(ff,VIR_FATAL);
00785             if (vircam_check_crval(vircam_fits_get_phu(ff),
00786                                    vircam_fits_get_ehu(ff)) != VIR_OK) {
00787                 cpl_msg_error(fctid,"Unable to correct CRVAL in %s",
00788                               vircam_fits_get_fullname(ff));
00789                 vircam_jmp_tidy(0);
00790                 return(-1);
00791             }
00792         }
00793         for (i = 0; i < ps.noffsets; i++) {
00794             ff = ps.offsky_fits[i];
00795             vircam_pfits_get_detlive(vircam_fits_get_ehu(ff),&live);
00796             if (! live) 
00797                 vircam_fits_set_error(ff,VIR_FATAL);
00798         }
00799 
00800         /* Get the readnoise and gain estimate for this extension */
00801 
00802         vircam_jmp_get_readnoise_gain(j,&readnoise,&gain);
00803 
00804         /* Loop for all the science frames and do the 2d corrections. Then
00805            do it for the offset skies */
00806 
00807         cpl_msg_info(fctid,"Doing stage1 corrections");
00808         for (i = 0; i < ps.nscience; i++) {
00809             ff = ps.sci_fits[i];
00810             cpl_propertylist_update_float(vircam_fits_get_ehu(ff),"READNOIS",
00811                                           readnoise);
00812             cpl_propertylist_set_comment(vircam_fits_get_ehu(ff),"READNOIS",
00813                                          "[e-] Readnoise used in processing");
00814             cpl_propertylist_update_float(vircam_fits_get_ehu(ff),"GAIN",gain);
00815             cpl_propertylist_set_comment(vircam_fits_get_ehu(ff),"GAIN",
00816                                          "[e-/adu] Gain used in processing");
00817             if (vircam_fits_get_status(ff) == VIR_FATAL) {
00818                 cpl_msg_info(fctid,"Detector is flagged dead in %s",
00819                              vircam_fits_get_fullname(ff));
00820                 continue;
00821             }
00822             status = VIR_OK;
00823             (void)vircam_darkcor(ff,ps.fdark,1.0,&status);
00824             (void)vircam_lincor(ff,ps.fchantab,1,ndit,&status);
00825             (void)vircam_nditcor(ff,ndit,&status);
00826             (void)vircam_flatcor(ff,ps.fflat,&status);
00827             (void)vircam_gaincor(ff,gaincor_fac,&status);
00828             vircam_fits_set_error(ff,status);
00829         }
00830         for (i = 0; i < ps.noffsets; i++) {
00831             ff = ps.offsky_fits[i];
00832             if (vircam_fits_get_status(ff) == VIR_FATAL) {
00833                 cpl_msg_info(fctid,"Detector is flagged dead in %s",
00834                              vircam_fits_get_fullname(ff));
00835                 continue;
00836             }
00837             status = VIR_OK;
00838             (void)vircam_darkcor(ff,ps.fdark,1.0,&status);
00839             (void)vircam_lincor(ff,ps.fchantab,1,ndit,&status);
00840             (void)vircam_nditcor(ff,ndit,&status);
00841             (void)vircam_flatcor(ff,ps.fflat,&status);
00842             (void)vircam_gaincor(ff,gaincor_fac,&status);
00843             vircam_fits_set_error(ff,status);
00844         }
00845 
00846         /* Do a simple sky correction if requested */
00847 
00848         if (vircam_jmp_config.skycor) {
00849             cpl_msg_info(fctid,"Doing sky correction");
00850             vircam_jmp_skycor();
00851         } else {
00852             for (i = 0; i < ps.nscience; i++) {
00853                 pp = vircam_fits_get_ehu(ps.sci_fits[i]);
00854                 cpl_propertylist_update_string(pp,"ESO DRS SKYCOR","none");
00855                 cpl_propertylist_set_comment(pp,"ESO DRS SKYCOR",
00856                                              "Sky correction method");
00857             }
00858         }
00859 
00860         /* Do destripe if requested */
00861 
00862         if (vircam_jmp_config.destripe) {
00863             for (i = 0; i < ps.nscience; i++) {
00864                 ff = ps.sci_fits[i];
00865                 (void)vircam_destripe(ff,ps.mask,&status);
00866                 vircam_fits_set_error(ff,status);
00867             }
00868             for (i = 0; i < ps.noffsets; i++) {
00869                 ff = ps.offsky_fits[i];
00870                 (void)vircam_destripe(ff,ps.mask,&status);
00871                 vircam_fits_set_error(ff,status);
00872             }
00873         }
00874 
00875         /* Look at the first frame in the list and see if the number of
00876            microsteps is greater than 1. If so, then we'll have to go
00877            through interleaving. */
00878 
00879         retval = vircam_pfits_get_nusteps(vircam_fits_get_phu(ps.sci_fits[0]),
00880                                           &nusteps);
00881         if (retval != VIR_OK) {
00882             cpl_msg_warning(fctid,"Unable to get nusteps from header.\nAssuming no microstepping");
00883             nusteps = 1;
00884         }
00885         
00886         /* If the number of microsteps is 1 then copy over the good frames
00887            into a fits list for dithering. */
00888 
00889         ps.ndith = 0;
00890         if (nusteps < 4) {
00891             if (nusteps == 1) 
00892                 cpl_msg_info(fctid,"No interleaving will be done");
00893             else
00894                 cpl_msg_warning(fctid,"Illegal number of microsteps: %" CPL_SIZE_FORMAT "\nNo interleaving will be done",
00895                                 (cpl_size)nusteps);
00896             ps.dith_input = cpl_malloc(ps.nscience*sizeof(vir_fits *));
00897             ps.dithc_input = cpl_malloc(sizeof(vir_fits *));
00898             for (i = 0; i < ps.nscience; i++) {
00899                 if (vircam_fits_get_status(ps.sci_fits[i]) == VIR_OK) 
00900                     ps.dith_input[ps.ndith++] = ps.sci_fits[i];
00901             }
00902             ps.dithc_input[0] = ps.fconf;
00903             ps.ndithc = 1;
00904             interlv = 0;
00905 
00906         /* If the number of microsteps is more than 1, then we need
00907            to do interleaving. The interleaving routine define
00908            ps.dith_input. */
00909 
00910         } else {
00911             cpl_msg_info(fctid,"Interleaving");
00912             vircam_jmp_interleave();
00913             interlv = 1;
00914         }
00915 
00916         /* Work out the jitter offsets and the stack the jitter frame */
00917 
00918         cpl_msg_info(fctid,"Working out jitter offsets");
00919         vircam_jmp_dither_offsets();
00920         cpl_msg_info(fctid,"Stacking jittered frame");
00921         vircam_jmp_dither_images();
00922 
00923         /* Do a catalogue generation */
00924 
00925         cpl_msg_info(fctid,"Doing object extraction");
00926         vircam_jmp_catalogue();
00927 
00928         /* Create a matched standards table */
00929 
00930         cpl_msg_info(fctid,"Matching objects with 2mass standards");
00931         vircam_jmp_matched_stds();
00932 
00933         /* Do a WCS fit for the dithered image */
00934 
00935         cpl_msg_info(fctid,"Fitting a WCS");
00936         vircam_jmp_wcsfit();
00937 
00938         /* Finally do the photometric zeropoint fit */
00939 
00940         cpl_msg_info(fctid,"Doing photometric zeropoint calculation");
00941         vircam_jmp_photcal();
00942 
00943         /* Save the simple images */ 
00944 
00945         if (vircam_jmp_config.savesimple) {
00946             cpl_msg_info(fctid,"Saving simple images");
00947             if (vircam_jmp_save_simple(framelist,parlist) != 0) {
00948                 vircam_jmp_tidy(0);
00949                 return(-1);
00950             }
00951         }
00952         if (offsky == 1) {
00953             if (vircam_jmp_config.savesimple) {
00954                 cpl_msg_info(fctid,"Saving offset sky simple images");
00955                 if (vircam_jmp_save_simple_offsets(framelist,parlist) != 0) {
00956                     vircam_jmp_tidy(0);
00957                     return(-1);
00958                 }
00959             }
00960             cpl_msg_info(fctid,"Saving mean offset sky image");
00961             if (vircam_jmp_save_offsky(framelist,parlist) != 0) {
00962                 vircam_jmp_tidy(0);
00963                 return(-1);
00964             }
00965         }
00966         vircam_mask_clear(ps.mask);
00967 
00968         /* Save super frames */
00969 
00970         if (interlv) {
00971             cpl_msg_info(fctid,"Saving superframe images");
00972             if (vircam_jmp_save_super(framelist,parlist) != 0) {
00973                 vircam_jmp_tidy(0);
00974                 return(-1);
00975             }
00976         }
00977 
00978         /* Save the dithered images */
00979 
00980         cpl_msg_info(fctid,"Saving stacked image");     
00981         dummyqc = vircam_jitter_microstep_process_dummyqc(1);
00982         if (vircam_jmp_save_stack(framelist,parlist) != 0) {
00983             vircam_jmp_tidy(0);
00984             freepropertylist(dummyqc);
00985             return(-1);
00986         }
00987         freepropertylist(dummyqc);
00988         if (vircam_jmp_config.savecat) {
00989             cpl_msg_info(fctid,"Saving stacked image catalogue");
00990             dummyqc = vircam_jitter_microstep_process_dummyqc(2);
00991             if (vircam_jmp_save_catalogue(framelist,parlist) != 0) {
00992                 vircam_jmp_tidy(0);
00993                 freepropertylist(dummyqc);
00994                 return(-1);
00995             }
00996             freepropertylist(dummyqc);
00997         }
00998 
00999         /* Clean up on aisle 12! */
01000 
01001         vircam_jmp_tidy(1);
01002     }
01003 
01004     /* Final cleanup */
01005 
01006     vircam_jmp_tidy(0);
01007     return(0);
01008 }
01009 
01010 static cpl_propertylist *vircam_jitter_microstep_process_dummyqc(int type) {
01011     cpl_propertylist *p;
01012 
01013     /* Get an empty property list */
01014 
01015     p = cpl_propertylist_new();
01016 
01017     /* Now switch for the various products */
01018 
01019     switch (type) {
01020 
01021     /* Stack images */
01022 
01023     case 1:
01024         cpl_propertylist_update_double(p,"ESO QC WCS_DCRVAL1",0.0);
01025         cpl_propertylist_set_comment(p,"ESO QC WCS_DCRVAL1",
01026                                      "[deg] change in crval1");
01027         cpl_propertylist_update_double(p,"ESO QC WCS_DCRVAL2",0.0);
01028         cpl_propertylist_set_comment(p,"ESO QC WCS_DCRVAL2",
01029                                      "[deg] change in crval2");
01030         cpl_propertylist_update_double(p,"ESO QC WCS_DTHETA",0.0);
01031         cpl_propertylist_set_comment(p,"ESO QC WCS_DTHETA",
01032                                      "[deg] change in rotation");
01033         cpl_propertylist_update_double(p,"ESO QC WCS_SCALE",0.0);
01034         cpl_propertylist_set_comment(p,"ESO QC WCS_SCALE",
01035                                      "[arcsec] mean plate scale");
01036         cpl_propertylist_update_double(p,"ESO QC WCS_SHEAR",0.0);
01037         cpl_propertylist_set_comment(p,"ESO QC WCS_SHEAR",
01038                                      "[deg] abs(xrot) - abs(yrot)");
01039         cpl_propertylist_update_double(p,"ESO QC WCS_RMS",0.0);
01040         cpl_propertylist_set_comment(p,"ESO QC WCS_RMS",
01041                                      "[arcsec] Average error in WCS fit");
01042         cpl_propertylist_update_float(p,"ESO QC MAGZPT",0.0);
01043         cpl_propertylist_set_comment(p,"ESO QC MAGZPT",
01044                                      "[mag] photometric zeropoint");
01045         cpl_propertylist_update_float(p,"ESO QC MAGZERR",0.0);
01046         cpl_propertylist_set_comment(p,"ESO QC MAGZERR",
01047                                      "[mag] photometric zeropoint error");
01048         cpl_propertylist_update_int(p,"ESO QC MAGNZPT",0);
01049         cpl_propertylist_set_comment(p,"ESO QC MAGNZPT",
01050                                      "number of stars in magzpt calc");
01051         cpl_propertylist_update_int(p,"ESO QC MAGNCUT",0);
01052         cpl_propertylist_set_comment(p,"ESO QC MAGNCUT",
01053                                      "number of stars cut from magzpt calc");
01054         cpl_propertylist_update_float(p,"ESO QC LIMITING_MAG",0.0);
01055         cpl_propertylist_set_comment(p,"ESO QC LIMITING_MAG",
01056                                      "[mag] 5 sigma limiting mag");
01057         break;
01058 
01059     /* Catalogues */
01060 
01061     case 2:
01062         cpl_propertylist_update_float(p,"ESO QC SATURATION",0.0);
01063         cpl_propertylist_set_comment(p,"ESO QC SATURATION",
01064                                      "[adu] Saturation level");
01065         cpl_propertylist_update_float(p,"ESO QC MEAN_SKY",0.0);
01066         cpl_propertylist_set_comment(p,"ESO QC MEAN_SKY",
01067                                      "[adu] Median sky brightness");
01068         cpl_propertylist_update_float(p,"ESO QC SKY_NOISE",0.0);
01069         cpl_propertylist_set_comment(p,"ESO QC SKY_NOISE",
01070                                      "[adu] Pixel noise at sky level");
01071         cpl_propertylist_update_float(p,"ESO QC IMAGE_SIZE",0.0);
01072         cpl_propertylist_set_comment(p,"ESO QC IMAGE_SIZE",
01073                                      "[pixels] Average FWHM of stellar objects")
01074 ;
01075         cpl_propertylist_update_float(p,"ESO QC ELLIPTICITY",0.0);
01076         cpl_propertylist_set_comment(p,"ESO QC ELLIPTICITY",
01077                                      "Average stellar ellipticity (1-b/a)");
01078         cpl_propertylist_update_float(p,"ESO QC APERTURE_CORR",0.0);
01079         cpl_propertylist_set_comment(p,"ESO QC APERTURE_CORR",
01080                                      "Stellar ap-corr 1x core flux");
01081         cpl_propertylist_update_int(p,"ESO QC NOISE_OBJ",0);
01082         cpl_propertylist_set_comment(p,"ESO QC NOISE_OBJ",
01083                                      "Number of noise objects");
01084         break;
01085     default:
01086         break;
01087     }
01088 
01089     /* Get out of here */
01090 
01091     return(p);
01092 }
01093 
01096 /*
01097 
01098 $Log: vircam_jitter_microstep_process.c,v $
01099 Revision 1.70  2012/01/16 12:32:18  jim
01100 A few more changes to fit in with cpl6
01101 
01102 Revision 1.69  2012/01/15 17:40:09  jim
01103 Minor modifications to take into accout the changes in cpl API for v6
01104 
01105 Revision 1.68  2011/05/09 09:58:10  jim
01106 Cosmetic changes to stop compiler warnings
01107 
01108 Revision 1.67  2010/12/09 13:19:44  jim
01109 Modified comments
01110 
01111 Revision 1.66  2010/09/13 11:43:13  jim
01112 Added flag DRS SKYCOR if background correction isn't being done
01113 
01114 Revision 1.65  2010/09/10 11:25:19  jim
01115 Modified so that a master sky can now be used.
01116 
01117 Revision 1.64  2010/09/09 12:15:35  jim
01118 Added new QC parameter MAGNCUT
01119 
01120 Revision 1.63  2010/06/03 11:30:40  jim
01121 Modified so that object deblending is done by default. Also fixed bug where
01122 offset sky images were saved when --savesimple was switched off
01123 
01124 Revision 1.62  2010/03/21 06:47:42  jim
01125 Added code to trap for problems in saving products
01126 
01127 Revision 1.61  2010/03/12 10:44:07  lbilbao
01128 Added missing header inclusion.
01129 
01130 Revision 1.60  2010/02/08 16:35:26  jim
01131 Moved the definition of propertylist ps.phupaf to the recipes so that
01132 this doesn't fail when we don't save the simple images
01133 
01134 Revision 1.59  2010/01/31 18:57:15  jim
01135 Now simple images are only saved when you really want them
01136 
01137 Revision 1.58  2009/12/11 06:52:56  jim
01138 Minor mods to documentation
01139 
01140 Revision 1.57  2009/09/22 12:29:37  jim
01141 Modified to do offset sky exposures
01142 
01143 Revision 1.56  2009/07/03 12:30:04  jim
01144 Default value of rcore is now 3
01145 
01146 Revision 1.55  2009/02/04 09:23:29  jim
01147 Moved destriping to after sky subtraction
01148 
01149 Revision 1.54  2009/01/19 14:36:02  jim
01150 Added vircam_nditcor
01151 
01152 Revision 1.53  2008/12/08 06:38:41  jim
01153 Added trap for crval==0 error. Also added a trap for illegal 2x1 microstep
01154 sequences
01155 
01156 Revision 1.52  2008/11/27 09:14:47  jim
01157 Fixed PRO CATG keyword values for interleaved confidence maps in docs
01158 
01159 Revision 1.51  2008/11/25 18:55:59  jim
01160 took out extra sky stuff
01161 
01162 Revision 1.50  2008/11/25 12:03:21  jim
01163 Fixed doc
01164 
01165 Revision 1.49  2008/11/25 11:53:50  jim
01166 Changed type for 'skycor' parameter to an enum. Recipe now allows for standard
01167 or object masked sky estimate
01168 
01169 Revision 1.48  2008/10/01 04:59:13  jim
01170 Added call to vircam_frameset_fexists to check input frameset
01171 
01172 Revision 1.47  2008/05/06 12:15:20  jim
01173 Changed to use new version of vircam_catpars
01174 
01175 Revision 1.46  2007/11/26 09:59:06  jim
01176 Recipe now takes ndit into account when doing linearity correction
01177 
01178 Revision 1.45  2007/10/25 18:39:22  jim
01179 Altered to remove some lint messages
01180 
01181 Revision 1.44  2007/10/19 06:55:06  jim
01182 Modifications made to use new method for directing the recipes to the
01183 standard catalogues using the sof
01184 
01185 Revision 1.43  2007/07/09 13:21:55  jim
01186 Modified to use new version of vircam_exten_range
01187 
01188 Revision 1.42  2007/06/13 08:11:27  jim
01189 Modified docs to reflect changes in DFS tags
01190 
01191 Revision 1.41  2007/05/15 08:55:19  jim
01192 Moved the saving of the products to later in the loop so that the jitter
01193 and microstep offsets will be written to the product headers
01194 
01195 Revision 1.40  2007/05/08 21:31:15  jim
01196 fixed typo
01197 
01198 Revision 1.39  2007/05/08 10:42:44  jim
01199 Added gain correction
01200 
01201 Revision 1.38  2007/04/04 16:05:59  jim
01202 Modified to make paf information a bit more correct
01203 
01204 Revision 1.37  2007/04/04 10:36:18  jim
01205 Modified to use new dfs tags
01206 
01207 Revision 1.36  2007/03/29 12:19:38  jim
01208 Little changes to improve documentation
01209 
01210 Revision 1.35  2007/03/14 14:49:13  jim
01211 Fixed problem with missing paf files in jmp recipes if detlive = F. Also
01212 fixed problem where extra dummy products were being created
01213 
01214 Revision 1.34  2007/03/06 12:00:48  jim
01215 Fixed stupid typo in header
01216 
01217 Revision 1.33  2007/03/01 12:41:49  jim
01218 Modified slightly after code checking
01219 
01220 Revision 1.32  2007/02/07 10:12:39  jim
01221 Removed calls to vircam_ndit_correct as this is now no longer necessary
01222 
01223 Revision 1.31  2006/12/19 13:31:27  jim
01224 Fixed path2mass alias name. Also detectors flagged as dead now only generate
01225 an INFO message
01226 
01227 Revision 1.30  2006/11/29 12:28:45  jim
01228 Modified so that the correct recipe names would appear in the headers of
01229 data products
01230 
01231 Revision 1.29  2006/11/27 12:17:25  jim
01232 Almost all support routines are now in vircam/vircam_jmp_utils.c
01233 
01234 Revision 1.28  2006/11/22 21:57:06  jim
01235 Modified how readnoise and gain are read
01236 
01237 Revision 1.27  2006/11/10 09:23:06  jim
01238 Added sky correction and destriping along with the relevant command line
01239 parameters. Also fixed save routines so that dummy products will get the
01240 IMADUMMY flag.
01241 
01242 Revision 1.26  2006/09/09 16:49:40  jim
01243 Header comment update
01244 
01245 Revision 1.25  2006/08/07 14:21:03  jim
01246 Made a few more changes to make sure that if things fail then it doesn't try
01247 and run further processing steps
01248 
01249 Revision 1.24  2006/08/07 12:59:52  jim
01250 Fixed DET LIVE problem (I think)
01251 
01252 Revision 1.23  2006/08/01 11:28:14  jim
01253 Modified to use new smoothing kernel width parameter in imcore
01254 
01255 Revision 1.22  2006/07/19 10:42:50  jim
01256 Fixed a bug where the product frame lists were being deleted too early
01257 
01258 Revision 1.21  2006/07/17 12:51:48  jim
01259 Plugged a great number of memory leaks (mainly to do with propertylists)
01260 
01261 Revision 1.20  2006/07/17 09:31:24  jim
01262 Fixed a small memory leak and a bug in vircam_jmp_dither_offsets
01263 
01264 Revision 1.19  2006/07/11 14:56:17  jim
01265 Changes in the interleaving and jitter routines so that missing data
01266 and frames that are flagged as bad are dealt with properly
01267 
01268 Revision 1.18  2006/07/07 09:34:21  jim
01269 Fixed a few bugs relating to interleaving
01270 
01271 Revision 1.17  2006/07/04 09:19:03  jim
01272 replaced all sprintf statements with snprintf
01273 
01274 Revision 1.16  2006/06/20 19:07:01  jim
01275 Corrects for ndit != 1
01276 
01277 Revision 1.15  2006/06/19 20:50:35  jim
01278 Put a better algorithm for working out an output file name into
01279 vircam_jmp_save_smple
01280 
01281 Revision 1.14  2006/06/15 09:58:58  jim
01282 Minor changes to docs
01283 
01284 Revision 1.13  2006/06/14 14:17:13  jim
01285 minor documentation fix
01286 
01287 Revision 1.12  2006/06/13 21:28:39  jim
01288 Uses new VIRCAM_CALIB_READGAIN_FILE as an input now.
01289 
01290 Revision 1.11  2006/06/13 14:10:59  jim
01291 Fixed routine that saves catalogues to remove WCS stuff from extension header.
01292 
01293 Revision 1.10  2006/06/09 22:25:06  jim
01294 tidied up a few bugs
01295 
01296 Revision 1.9  2006/06/09 11:26:25  jim
01297 Small changes to keep lint happy
01298 
01299 Revision 1.8  2006/06/08 14:52:52  jim
01300 Fixed a few little bugs
01301 
01302 Revision 1.7  2006/06/06 13:03:30  jim
01303 Added QC parameters to docs
01304 
01305 Revision 1.6  2006/06/01 14:34:06  jim
01306 Now accepts a bad pixel mask in place of a confidence map for emergency use
01307 
01308 Revision 1.5  2006/05/30 14:27:54  jim
01309 Added illcor parameter to call for photcal
01310 
01311 Revision 1.4  2006/05/30 12:15:42  jim
01312 Cosmetic changes
01313 
01314 Revision 1.3  2006/05/27 21:25:49  jim
01315 Added some more docs
01316 
01317 Revision 1.2  2006/05/26 15:06:06  jim
01318 Fixed lots of little bugs
01319 
01320 Revision 1.1  2006/05/24 13:39:29  jim
01321 First cut
01322 
01323 
01324 */

Generated on 15 Mar 2012 for VIRCAM Pipeline by  doxygen 1.6.1