IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 1, 2009, 11:55:34 AM (17 years ago)
Author:
eugene
Message:

re-factored ppSubReadout into a sequence of logical steps; defined convolved images as their own pmFPAfiles; switched to new psphot functions (psphotReadoutFindPSF and psphotReadoutMinimal); simplified mask and psphot visualization handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubCamera.c

    r20614 r21257  
    1 #ifdef HAVE_CONFIG_H
    2 #include <config.h>
    3 #endif
    4 
    5 #include <stdio.h>
    6 #include <pslib.h>
    7 #include <psmodules.h>
    8 #include <psphot.h>
    9 
    101#include "ppSub.h"
    112
    123bool ppSubCamera(pmConfig *config)
    134{
    14     bool status = false;                // Status of definition
     5    bool status = false;                // result from pmFPAfileDefine operations
    156
    167    // Input image
     
    119110    }
    120111
     112    // Convolved input image
     113    pmFPAfile *inConv = pmFPAfileDefineFromFile(config, input, 1, 1, "PPSUB.INPUT.CONV");
     114    if (!inConv) {
     115        psError(PS_ERR_IO, false, _("Unable to generate output file for PPSUB.INPUT.CONV"));
     116        return false;
     117    }
     118    if (output->type != PM_FPA_FILE_IMAGE) {
     119        psError(PS_ERR_IO, true, "PPSUB.INPUT.CONV is not of type IMAGE");
     120        return false;
     121    }
     122    // XXX should be based on recipe : inConv->save = true;
     123
     124    // Convolved input mask
     125    pmFPAfile *inConvMask = pmFPAfileDefineOutput(config, inConv->fpa, "PPSUB.INPUT.CONV.MASK");
     126    if (!inConvMask) {
     127        psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.INPUT.CONV.MASK"));
     128        return false;
     129    }
     130    if (inConvMask->type != PM_FPA_FILE_MASK) {
     131        psError(PS_ERR_IO, true, "PPSUB.INPUT.CONV.MASK is not of type MASK");
     132        return false;
     133    }
     134    // XXX should be based on recipe : inConvMask->save = true;
     135
     136    // Convolved input weight
     137    if (inputWeight) {
     138        pmFPAfile *inConvWeight = pmFPAfileDefineOutput(config, inConv->fpa, "PPSUB.INPUT.CONV.WEIGHT");
     139        if (!inConvWeight) {
     140            psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.WEIGHT"));
     141            return false;
     142        }
     143        if (inConvWeight->type != PM_FPA_FILE_WEIGHT) {
     144            psError(PS_ERR_IO, true, "PPSUB.INPUT.CONV.WEIGHT is not of type WEIGHT");
     145            return false;
     146        }
     147        // XXX should be based on recipe : inConvWeight->save = true;
     148    }
     149
     150    // Convolved ref image
     151    pmFPAfile *refConv = pmFPAfileDefineFromFile(config, ref, 1, 1, "PPSUB.REF.CONV");
     152    if (!refConv) {
     153        psError(PS_ERR_IO, false, _("Unable to generate output file for PPSUB.REF.CONV"));
     154        return false;
     155    }
     156    if (output->type != PM_FPA_FILE_IMAGE) {
     157        psError(PS_ERR_IO, true, "PPSUB.REF.CONV is not of type IMAGE");
     158        return false;
     159    }
     160    // XXX should be based on recipe : refConv->save = true;
     161
     162    // Convolved ref mask
     163    pmFPAfile *refConvMask = pmFPAfileDefineOutput(config, refConv->fpa, "PPSUB.REF.CONV.MASK");
     164    if (!refConvMask) {
     165        psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.REF.CONV.MASK"));
     166        return false;
     167    }
     168    if (refConvMask->type != PM_FPA_FILE_MASK) {
     169        psError(PS_ERR_IO, true, "PPSUB.REF.CONV.MASK is not of type MASK");
     170        return false;
     171    }
     172    // XXX should be based on recipe : refConvMask->save = true;
     173
     174    // Convolved ref weight
     175    if (refWeight) {
     176        pmFPAfile *refConvWeight = pmFPAfileDefineOutput(config, refConv->fpa, "PPSUB.REF.CONV.WEIGHT");
     177        if (!refConvWeight) {
     178            psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.WEIGHT"));
     179            return false;
     180        }
     181        if (refConvWeight->type != PM_FPA_FILE_WEIGHT) {
     182            psError(PS_ERR_IO, true, "PPSUB.REF.CONV.WEIGHT is not of type WEIGHT");
     183            return false;
     184        }
     185        // XXX should be based on recipe : refConvWeight->save = true;
     186    }
     187
    121188    // Output JPEGs
    122189    pmFPAfile *jpeg1 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG1");
     
    192259        }
    193260        pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD");
     261
     262        pmFPAfile *psphotResid = pmFPAfileDefineOutputForFormat (config, NULL, "PSPHOT.RESID", output->cameraName, output->formatName);
     263        if (!psphotResid) {
     264            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.RESID");
     265            return false;
     266        }
     267        // make this optional: psphotResid->save = true;
    194268    }
    195269
    196270    // Always do this, since we're using psphot for the background model.
    197     {
     271    // XXX Not certain that I need to generate a separate pmFPAfile for PSPHOT.INPUT
     272    if (0) {
    198273        pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
    199274        if (!psphot) {
Note: See TracChangeset for help on using the changeset viewer.