IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 6, 2012, 6:32:19 PM (14 years ago)
Author:
watersc1
Message:

merge from trunk. Preliminary versions of stacktool/warptool updates and regenerate_background.pl script. The warp code is finished and tested, and I still need to get the stack version resolved.

Location:
branches/czw_branch/20120906/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/psphot

  • branches/czw_branch/20120906/psphot/src

  • branches/czw_branch/20120906/psphot/src/psphotStackParseCamera.c

    r33913 r34772  
    1414        return false;
    1515    }
     16
     17    // select the appropriate recipe information
     18    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     19    bool savePSF = psMetadataLookupBool(&status, recipe, "SAVE.PSF");
     20    bool saveBackgroundModel = psMetadataLookupBool(&status, recipe, "SAVE.BACKMDL");
     21    bool saveBackground = psMetadataLookupBool(&status, recipe, "SAVE.BACKGND");
     22    bool saveBackSub = psMetadataLookupBool(&status, recipe, "SAVE.BACKSUB");
     23    bool saveResid = psMetadataLookupBool(&status, recipe, "SAVE.RESID");
     24
     25    bool saveCnv = psMetadataLookupBool(&status, recipe, "SAVE.CNV");
     26    bool saveChisq = psMetadataLookupBool(&status, recipe, "SAVE.CHISQ");
     27    bool useRaw = psMetadataLookupBool(&status, recipe, "PSPHOT.STACK.USE.RAW");
     28
    1629
    1730    int nRaw = 0;
     
    120133            }
    121134        }
     135        pmFPAfile *inputTemplate;
     136        if (useRaw) {
     137            inputTemplate = rawInputFile;
     138        } else {
     139            inputTemplate = cnvInputFile;
     140        }
     141        if (!inputTemplate) {
     142            psError(PS_ERR_UNKNOWN, true, "cannot determinte inputTemplate: USE.RAW: %d\n", useRaw);
     143            return false;
     144        }
    122145
    123146        psString sources = psMetadataLookupStr(&status, input, "SOURCES"); // Name of mask
     
    135158        }
    136159        // generate an pmFPAimage for the output convolved image
    137         // XXX output of these files should be optional
    138160        {
    139161            // pmFPAfile *srcInputFile = rawInputFile ? rawInputFile : cnvInputFile;
     
    143165                return false;
    144166            }
    145             outputImage->save = true;
     167            outputImage->save = saveCnv;
    146168            outputImage->fileID = stack_id;             // this is used to generate output names
    147169
     
    155177                return NULL;
    156178            }
    157             outputMask->save = true;
     179            outputMask->save = saveCnv;
    158180            outputMask->fileID = stack_id;              // this is used to generate output names
    159181
     
    167189                return NULL;
    168190            }
    169             outputVariance->save = true;
     191            outputVariance->save = saveCnv;
    170192            outputVariance->fileID = stack_id;          // this is used to generate output names
    171193
     
    178200            outsources->save = true;
    179201            outsources->fileID = stack_id;              // this is used to generate output names
     202
     203            if (savePSF) {
     204                pmFPAfile *output = pmFPAfileDefineOutputFromFile (config, inputTemplate, "PSPHOT.STACK.PSF.SAVE");
     205                if (!output) {
     206                    psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.PSF.SAVE");
     207                    return false;
     208                }
     209                output->save = true;
     210                output->fileID = stack_id;
     211            }
     212            if (saveBackgroundModel) {
     213                int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");
     214                int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");
     215                pmFPAfile *output = pmFPAfileDefineFromFile (config, inputTemplate, DX, DY, "PSPHOT.STACK.BACKMDL");
     216                if (!output) {
     217                    psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.BACKMDL");
     218                    return false;
     219                }
     220
     221                output->save = true;
     222                output->fileID = stack_id;
     223            }
     224            if (saveBackground) {
     225                pmFPAfile *output = pmFPAfileDefineFromFile (config, inputTemplate, 1, 1, "PSPHOT.STACK.BACKGND");
     226                if (!output) {
     227                    psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.STACK.BACKGND");
     228                    return false;
     229                }
     230                output->save = true;
     231                output->fileID = stack_id;
     232            }
     233            if (saveBackSub) {
     234                pmFPAfile *output = pmFPAfileDefineFromFile (config, inputTemplate, 1, 1, "PSPHOT.STACK.BACKSUB");
     235                if (!output) {
     236                    psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.STACK.BACKSUB");
     237                    return false;
     238                }
     239                output->save = true;
     240                output->fileID = stack_id;
     241            }
     242            if (saveResid) {
     243                pmFPAfile *output = pmFPAfileDefineOutputFromFile (config, inputTemplate, "PSPHOT.STACK.RESID");
     244                if (!output) {
     245                    psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.STACK.RESID");
     246                    return false;
     247                }
     248                output->save = true;
     249                output->fileID = stack_id;
     250            }
    180251        }
    181252    }
     
    191262    }
    192263
    193     // select the appropriate recipe information
    194     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    195     bool saveCnv = psMetadataLookupBool(&status, recipe, "SAVE.CNV");
    196     bool saveChisq = psMetadataLookupBool(&status, recipe, "SAVE.CHISQ");
    197 
    198     // loop over the available readouts
    199     for (int i = 0; i < nInputs; i++) {
    200         pmFPAfile *file = NULL;
    201 
    202         file = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.IMAGE", i);
    203         file->save = saveCnv;
    204 
    205         file = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.MASK", i);
    206         file->save = saveCnv;
    207 
    208         file = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.VARIANCE", i);
    209         file->save = saveCnv;
    210     }
    211 
    212264    // generate an pmFPAimage for the chisqImage
    213     // XXX output of these files should be optional
    214265    {
    215266        pmFPAfile *chisqImage = pmFPAfileDefineOutput(config, NULL, "PSPHOT.CHISQ.IMAGE");
Note: See TracChangeset for help on using the changeset viewer.