IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 7:42:02 PM (16 years ago)
Author:
eugene
Message:

updates from eam_branches/20091201

File:
1 edited

Legend:

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

    r26571 r26899  
    2323
    2424// Define an input file
    25 static pmFPAfile *defineInputFile(pmConfig *config,// Configuration
     25static pmFPAfile *defineInputFile(bool *success,
     26                                  pmConfig *config,// Configuration
    2627                                  pmFPAfile *bind,    // File to which to bind, or NULL
    2728                                  char *filerule,     // Name of file rule
     
    3233    bool status;
    3334
     35    *success = false;
     36
    3437    pmFPAfile *file = NULL;
     38
    3539    // look for the file on the argument list
    3640    if (bind) {
     
    3943        file = pmFPAfileDefineFromArgs(&status, config, filerule, argname);
    4044    }
     45
    4146    if (!status) {
    4247        psError(PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);
     
    5358
    5459    if (!file) {
     60        // no file defined
     61        *success = true;
    5562        return NULL;
    5663    }
     
    6168    }
    6269
     70    *success = true;
    6371    return file;
    6472}
     
    137145bool ppSubCamera(ppSubData *data)
    138146{
     147    bool success = true;
     148
    139149    psAssert(data, "Require processing data");
    140150    pmConfig *config = data->config;
     
    142152
    143153    // Input image
    144     pmFPAfile *input = defineInputFile(config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
    145     if (!input) {
     154    pmFPAfile *input = defineInputFile(&success, config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
     155    if (!success) {
    146156        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT");
    147157        return false;
    148158    }
    149     defineInputFile(config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK);
    150     pmFPAfile *inVar = defineInputFile(config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE",
    151                                        PM_FPA_FILE_VARIANCE);
    152     defineInputFile(config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);
     159
     160    defineInputFile(&success, config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK);
     161    if (!success) {
     162        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.MASK");
     163        return false;
     164    }
     165
     166    pmFPAfile *inVar = defineInputFile(&success, config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", PM_FPA_FILE_VARIANCE);
     167    if (!success) {
     168        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.VARIANCE");
     169        return false;
     170    }
     171
     172    defineInputFile(&success, config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);
     173    if (!success) {
     174        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.SOURCES");
     175        return false;
     176    }
    153177
    154178    // Reference image
    155     pmFPAfile *ref = defineInputFile(config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
    156     if (!ref) {
     179    pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
     180    if (!success) {
    157181        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF");
    158182        return false;
    159183    }
    160     defineInputFile(config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
    161     pmFPAfile *refVar = defineInputFile(config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE",
    162                                         PM_FPA_FILE_VARIANCE);
    163     defineInputFile(config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
    164 
     184
     185    defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
     186    if (!success) {
     187        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.MASK");
     188        return false;
     189    }
     190
     191    pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
     192    if (!success) {
     193        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.VARIANCE");
     194        return false;
     195    }
     196
     197    defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
     198    if (!success) {
     199        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.SOURCES");
     200        return false;
     201    }
    165202
    166203    // Now that the camera has been determined, we can read the recipe
     
    298335    jpeg2->save = true;
    299336
     337    // Output residual JPEG
     338    pmFPAfile *jpeg3 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.RESID.JPEG");
     339    if (!jpeg3) {
     340        psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.RESID.JPEG"));
     341        return false;
     342    }
     343    if (jpeg3->type != PM_FPA_FILE_JPEG) {
     344        psError(PS_ERR_IO, true, "PPSUB.OUTPUT.RESID.JPEG is not of type JPEG");
     345        return false;
     346    }
     347    jpeg3->save = true;
     348
    300349    // Output subtraction kernel
    301350    pmFPAfile *kernel = defineCalcFile(config, NULL, "PPSUB.OUTPUT.KERNELS", PM_FPA_FILE_SUBKERNEL);
     
    306355
    307356    // psPhot input
    308     if (data->photometry) {
     357    if (data->photometry || 1) {
    309358        psphotModelClassInit();        // load implementation-specific models
    310359
     
    318367            return false;
    319368        }
     369        // specify the number of psphot input images
     370        psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
    320371        pmFPAfileActivate(config->files, false, "PSPHOT.INPUT");
    321372
    322         // Internal-ish file for getting the PSF from the minuend
    323         pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, psphot, "PSPHOT.PSF.LOAD");
     373        // Internal file for getting the PSF from the minuend
     374        pmFPAfile *psf = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.PSF.LOAD");
    324375        if (!psf) {
    325376            psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");
Note: See TracChangeset for help on using the changeset viewer.