IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 7, 2009, 4:50:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging branches/pap from r23739 onto trunk. No conflicts, ppSub builds fine.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ppSub

  • trunk/ppSub/src

    • Property svn:ignore
      •  

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

    r23688 r23740  
    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);
    161 
    162 
    163     // Output image
    164     pmFPAfile *output = defineOutputFile(config, input, true, "PPSUB.OUTPUT", PM_FPA_FILE_IMAGE);
    165     pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK);
    166     if (!output || !outMask) {
    167         psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
    168         return false;
    169     }
    170     output->save = true;
    171     outMask->save = true;
    172     pmFPAfile *outVar = NULL;
    173     if (inVar && refVar) {
    174         outVar = defineOutputFile(config, output, false, "PPSUB.OUTPUT.VARIANCE", PM_FPA_FILE_VARIANCE);
    175         if (!outVar) {
    176             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
    177             return false;
    178         }
    179         outVar->save = true;
    180     }
     160    defineInputFile(config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
    181161
    182162
     
    216196
    217197
     198    // Now that the camera has been determined, we can read the recipe
     199    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
     200    if (!recipe) {
     201        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE);
     202        return false;
     203    }
     204    if (psMetadataLookupBool(NULL, config->arguments, "-photometry")) {
     205        psMetadataAddBool(recipe, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE,
     206                          "Perform photometry?", true);
     207    }
     208    if (psMetadataLookupBool(NULL, config->arguments, "-inverse")) {
     209        psMetadataAddBool(recipe, PS_LIST_TAIL, "INVERSE", PS_META_REPLACE,
     210                          "Generate inverse subtractions?", true);
     211    }
     212
     213    data->inverse = psMetadataLookupBool(NULL, recipe, "INVERSE");
     214    data->photometry = psMetadataLookupBool(NULL, recipe, "PHOTOMETRY");
     215
     216
     217    // Output image
     218    pmFPAfile *output = defineOutputFile(config, inConvImage, true, "PPSUB.OUTPUT", PM_FPA_FILE_IMAGE);
     219    pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK);
     220    if (!output || !outMask) {
     221        psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     222        return false;
     223    }
     224    output->save = true;
     225    outMask->save = true;
     226    if (inVar && refVar) {
     227        pmFPAfile *outVar = defineOutputFile(config, output, false, "PPSUB.OUTPUT.VARIANCE",
     228                                             PM_FPA_FILE_VARIANCE);
     229        if (!outVar) {
     230            psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     231            return false;
     232        }
     233        outVar->save = true;
     234    }
     235
     236    pmFPAfile *inverse = NULL;          // Inverse output image
     237    if (data->inverse) {
     238        // Inverse output image
     239        inverse = defineOutputFile(config, output, true, "PPSUB.INVERSE", PM_FPA_FILE_IMAGE);
     240        pmFPAfile *invMask = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.MASK",
     241                                              PM_FPA_FILE_MASK);
     242        if (!inverse || !invMask) {
     243            psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     244            return false;
     245        }
     246        inverse->save = true;
     247        invMask->save = true;
     248        if (inVar && refVar) {
     249            pmFPAfile *invVar = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.VARIANCE",
     250                                                 PM_FPA_FILE_VARIANCE);
     251            if (!invVar) {
     252                psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     253                return false;
     254            }
     255            invVar->save = true;
     256        }
     257    }
     258
     259
    218260    // Output JPEGs
    219261    pmFPAfile *jpeg1 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG1");
     
    245287    }
    246288
    247     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    248     if (!recipe) {
    249         psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE);
    250         return false;
    251     }
    252 
    253289    // psPhot input
    254     if (psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {
     290    if (data->photometry) {
    255291        psphotModelClassInit();        // load implementation-specific models
    256 
    257         // Internal-ish file for getting the PSF from the minuend
    258         pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, output, "PSPHOT.PSF.LOAD");
    259         if (!psf) {
    260             psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");
    261             return false;
    262         }
    263         if (psf->type != PM_FPA_FILE_PSF) {
    264             psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF");
    265             return false;
    266         }
    267         pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD");
    268292
    269293        pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
     
    276300            return false;
    277301        }
     302        pmFPAfileActivate(config->files, false, "PSPHOT.INPUT");
     303
     304        // Internal-ish file for getting the PSF from the minuend
     305        pmFPAfile *psf = pmFPAfileDefineOutputFromFile(config, psphot, "PSPHOT.PSF.LOAD");
     306        if (!psf) {
     307            psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");
     308            return false;
     309        }
     310        if (psf->type != PM_FPA_FILE_PSF) {
     311            psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF");
     312            return false;
     313        }
     314        pmFPAfileActivate(config->files, false, "PSPHOT.PSF.LOAD");
    278315
    279316        if (!psphotDefineFiles(config, psphot)) {
     
    281318            return false;
    282319        }
     320
     321        // Deactivate psphot output sources --- we want to define output source files of our own
     322        pmFPAfile *psphotOutput = pmFPAfileSelectSingle(config->files, "PSPHOT.OUTPUT", 0);
     323        psphotOutput->save = false;
     324
     325        pmFPAfile *outSources = defineOutputFile(config, output, false, "PPSUB.OUTPUT.SOURCES",
     326                                                 PM_FPA_FILE_CMF);
     327        if (!outSources) {
     328            psError(PS_ERR_UNKNOWN, false, "Unable to set up output source file.");
     329            return false;
     330        }
     331        outSources->save = true;
     332
     333        if (data->inverse) {
     334            pmFPAfile *invSources = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.SOURCES",
     335                                                     PM_FPA_FILE_CMF);
     336            if (!invSources) {
     337                psError(PS_ERR_UNKNOWN, false, "Unable to set up inverse source file.");
     338                return false;
     339            }
     340            invSources->save = true;
     341        }
    283342    }
    284343
Note: See TracChangeset for help on using the changeset viewer.