IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 6, 2009, 6:52:51 PM (17 years ago)
Author:
Paul Price
Message:

Making ppSub inverse mode work. Seems to work now --- produces the correct output files for inverse mode on and off, photometry on and off.

Location:
branches/pap/ppSub/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/ppSub/src

    • Property svn:ignore
      •  

        old new  
        1010stamp-h1
        1111ppSubKernel
         12ppSubErrorCodes.h
         13ppSubErrorCodes.c
  • branches/pap/ppSub/src/ppSubCamera.c

    r23711 r23719  
    134134
    135135
    136 bool ppSubCamera(pmConfig *config)
     136bool ppSubCamera(pmConfig *config, ppSubData *data)
    137137{
    138138    psAssert(config, "Require configuration");
     
    147147    pmFPAfile *inVar = defineInputFile(config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE",
    148148                                       PM_FPA_FILE_VARIANCE);
    149     defineInputFile(config, input, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);
     149    defineInputFile(config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);
    150150
    151151    // Reference image
     
    158158    pmFPAfile *refVar = defineInputFile(config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE",
    159159                                        PM_FPA_FILE_VARIANCE);
    160     defineInputFile(config, ref, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
     160    defineInputFile(config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
     161
     162
     163    // Convolved input image
     164    pmFPAfile *inConvImage = defineOutputFile(config, input, true, "PPSUB.INPUT.CONV", PM_FPA_FILE_IMAGE);
     165    pmFPAfile *inConvMask = defineOutputFile(config, inConvImage, false, "PPSUB.INPUT.CONV.MASK",
     166                                             PM_FPA_FILE_MASK);
     167    if (!inConvImage || !inConvMask) {
     168        psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     169        return false;
     170    }
     171    if (inVar) {
     172        pmFPAfile *inConvVar = defineOutputFile(config, inConvImage, false, "PPSUB.INPUT.CONV.VARIANCE",
     173                                                PM_FPA_FILE_VARIANCE);
     174        if (!inConvVar) {
     175            psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     176            return false;
     177        }
     178    }
     179
     180    // Convolved ref image
     181    pmFPAfile *refConvImage = defineOutputFile(config, input, true, "PPSUB.REF.CONV", PM_FPA_FILE_IMAGE);
     182    pmFPAfile *refConvMask = defineOutputFile(config, refConvImage, false, "PPSUB.REF.CONV.MASK",
     183                                              PM_FPA_FILE_MASK);
     184    if (!refConvImage || !refConvMask) {
     185        psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     186        return false;
     187    }
     188    if (refVar) {
     189        pmFPAfile *refConvVar = defineOutputFile(config, refConvImage, false, "PPSUB.REF.CONV.VARIANCE",
     190                                                 PM_FPA_FILE_VARIANCE);
     191        if (!refConvVar) {
     192            psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     193            return false;
     194        }
     195    }
    161196
    162197
     
    172207
    173208    // Output image
    174     pmFPAfile *output = defineOutputFile(config, input, true, "PPSUB.OUTPUT", PM_FPA_FILE_IMAGE);
     209    pmFPAfile *output = defineOutputFile(config, inConvImage, true, "PPSUB.OUTPUT", PM_FPA_FILE_IMAGE);
    175210    pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK);
    176211    if (!output || !outMask) {
     
    190225    }
    191226
     227    pmFPAfile *inverse = NULL;          // Inverse output image
    192228    if (data->inverse) {
    193229        // Inverse output image
    194         pmFPAfile *inverse = defineOutputFile(config, input, true, "PPSUB.INV", PM_FPA_FILE_IMAGE);
     230        inverse = defineOutputFile(config, output, true, "PPSUB.INVERSE", PM_FPA_FILE_IMAGE);
    195231        pmFPAfile *invMask = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.MASK",
    196232                                              PM_FPA_FILE_MASK);
    197         if (!inv || !invMask) {
     233        if (!inverse || !invMask) {
    198234            psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
    199235            return false;
     
    212248    }
    213249
    214     // Convolved input image
    215     pmFPAfile *inConvImage = defineOutputFile(config, input, true, "PPSUB.INPUT.CONV", PM_FPA_FILE_IMAGE);
    216     pmFPAfile *inConvMask = defineOutputFile(config, inConvImage, false, "PPSUB.INPUT.CONV.MASK",
    217                                              PM_FPA_FILE_MASK);
    218     if (!inConvImage || !inConvMask) {
    219         psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
    220         return false;
    221     }
    222     if (inVar) {
    223         pmFPAfile *inConvVar = defineOutputFile(config, inConvImage, false, "PPSUB.INPUT.CONV.VARIANCE",
    224                                                 PM_FPA_FILE_VARIANCE);
    225         if (!inConvVar) {
    226             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
    227             return false;
    228         }
    229     }
    230 
    231     // Convolved ref image
    232     pmFPAfile *refConvImage = defineOutputFile(config, input, true, "PPSUB.REF.CONV", PM_FPA_FILE_IMAGE);
    233     pmFPAfile *refConvMask = defineOutputFile(config, refConvImage, false, "PPSUB.REF.CONV.MASK",
    234                                               PM_FPA_FILE_MASK);
    235     if (!refConvImage || !refConvMask) {
    236         psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
    237         return false;
    238     }
    239     if (refVar) {
    240         pmFPAfile *refConvVar = defineOutputFile(config, refConvImage, false, "PPSUB.REF.CONV.VARIANCE",
    241                                                  PM_FPA_FILE_VARIANCE);
    242         if (!refConvVar) {
    243             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
    244             return false;
    245         }
    246     }
    247 
    248250
    249251    // Output JPEGs
     
    276278    }
    277279
    278     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    279     if (!recipe) {
    280         psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE);
    281         return false;
    282     }
    283 
    284280    // psPhot input
    285281    if (data->photometry) {
    286282        psphotModelClassInit();        // load implementation-specific models
    287283
    288         // Internal-ish file for getting the PSF from the minuend
    289         pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, output, "PSPHOT.PSF.LOAD");
    290         if (!psf) {
    291             psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");
    292             return false;
    293         }
    294         if (psf->type != PM_FPA_FILE_PSF) {
    295             psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF");
    296             return false;
    297         }
    298         pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD");
    299 
    300284        pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
    301285        if (!psphot) {
     
    307291            return false;
    308292        }
     293        pmFPAfileActivate(config->files, false, "PSPHOT.INPUT");
     294
     295        // Internal-ish file for getting the PSF from the minuend
     296        pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, psphot, "PSPHOT.PSF.LOAD");
     297        if (!psf) {
     298            psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");
     299            return false;
     300        }
     301        if (psf->type != PM_FPA_FILE_PSF) {
     302            psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF");
     303            return false;
     304        }
     305        pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD");
    309306
    310307        if (!psphotDefineFiles(config, psphot)) {
     
    326323
    327324        if (data->inverse) {
    328             pmFPAfile *invSources = defineOutputFile(config, inverse, false, "PPSUB.OUTPUT.SOURCES",
     325            pmFPAfile *invSources = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.SOURCES",
    329326                                                     PM_FPA_FILE_CMF);
    330327            if (!invSources) {
     
    332329                return false;
    333330            }
    334         }
    335         invSources->save = true;
     331            invSources->save = true;
     332        }
    336333    }
    337334
Note: See TracChangeset for help on using the changeset viewer.