IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27909


Ignore:
Timestamp:
May 10, 2010, 5:24:37 PM (16 years ago)
Author:
eugene
Message:

functions called by the psphotReadoutXXX functions now take a filerule so psphotStack can select the correct targets

Location:
branches/eam_branches/psphot.20100506/src
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psphot.20100506/src/psphot.h

    r27884 r27909  
    3737bool            psphotReadoutMinimal(pmConfig *config, const pmFPAview *view);
    3838
    39 bool            psphotReadoutCleanup (pmConfig *config, const pmFPAview *view);
    40 bool            psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     39bool            psphotReadoutCleanup (pmConfig *config, const pmFPAview *view, const char *filerule);
     40bool            psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    4141
    4242bool            psphotDefineFiles (pmConfig *config, pmFPAfile *input);
     
    5151
    5252// psphotReadout functions
    53 bool            psphotAddPhotcode (pmConfig *config, const pmFPAview *view);
     53bool            psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule);
    5454bool            psphotAddPhotcodeReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    5555
    56 bool            psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view);
    57 bool            psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    58 
    59 bool            psphotModelBackground (pmConfig *config, const pmFPAview *view);
    60 bool            psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    61 
    62 bool            psphotSubtractBackground (pmConfig *config, const pmFPAview *view);
    63 bool            psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    64 
    65 bool            psphotFindDetections (pmConfig *config, const pmFPAview *view, bool firstPass);
    66 bool            psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool firstPass);
    67 
    68 bool            psphotSourceStats (pmConfig *config, const pmFPAview *view, bool setWindow);
    69 bool            psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool setWindow);
    70 
    71 bool            psphotDeblendSatstars (pmConfig *config, const pmFPAview *view);
    72 bool            psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    73 
    74 bool            psphotBasicDeblend (pmConfig *config, const pmFPAview *view);
    75 bool            psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    76 
    77 bool            psphotRoughClass (pmConfig *config, const pmFPAview *view);
    78 bool            psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     56bool            psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view, const char *filerule);
     57bool            psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     58
     59bool            psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule);
     60bool            psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     61
     62bool            psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filerule);
     63bool            psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     64
     65bool            psphotFindDetections (pmConfig *config, const pmFPAview *view, const char *filerule, bool firstPass);
     66bool            psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool firstPass);
     67
     68bool            psphotSourceStats (pmConfig *config, const pmFPAview *view, const char *filerule, bool setWindow);
     69bool            psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool setWindow);
     70
     71bool            psphotDeblendSatstars (pmConfig *config, const pmFPAview *view, const char *filerule);
     72bool            psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     73
     74bool            psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filerule);
     75bool            psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     76
     77bool            psphotRoughClass (pmConfig *config, const pmFPAview *view, const char *filerule);
     78bool            psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    7979bool            psphotRoughClassRegion (int nRegion, psRegion *region, psArray *sources, psMetadata *analysis, psMetadata *recipe, const bool havePSF);
    8080
    81 bool            psphotImageQuality (pmConfig *config, const pmFPAview *view);
    82 bool            psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    83 
    84 bool            psphotChoosePSF (pmConfig *config, const pmFPAview *view);
    85 bool            psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    86 
    87 bool            psphotGuessModels (pmConfig *config, const pmFPAview *view);
    88 bool            psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    89 
    90 bool            psphotMergeSources (pmConfig *config, const pmFPAview *view);
    91 bool            psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    92 
    93 bool            psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, bool final);
     81bool            psphotImageQuality (pmConfig *config, const pmFPAview *view, const char *filerule);
     82bool            psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     83
     84bool            psphotChoosePSF (pmConfig *config, const pmFPAview *view, const char *filerule);
     85bool            psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     86
     87bool            psphotGuessModels (pmConfig *config, const pmFPAview *view, const char *filerule);
     88bool            psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     89
     90bool            psphotMergeSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     91bool            psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     92
     93bool            psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final);
    9494bool            psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final);
    9595
    96 bool            psphotSourceSize (pmConfig *config, const pmFPAview *view, bool getPSFsize);
    97 bool            psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool getPSFsize);
    98 
    99 bool            psphotBlendFit (pmConfig *config, const pmFPAview *view);
    100 bool            psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     96bool            psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize);
     97bool            psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool getPSFsize);
     98
     99bool            psphotBlendFit (pmConfig *config, const pmFPAview *view, const char *filerule);
     100bool            psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    101101bool            psphotBlendFit_Threaded (psThreadJob *job);
    102102
    103 bool            psphotReplaceAllSources (pmConfig *config, const pmFPAview *view);
    104 bool            psphotReplaceAllSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    105 
    106 bool            psphotAddNoise (pmConfig *config, const pmFPAview *view);
    107 bool            psphotSubNoise (pmConfig *config, const pmFPAview *view);
    108 bool            psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, bool add);
    109 bool            psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool add);
    110 
    111 bool            psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view);
    112 bool            psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    113 
    114 bool            psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view);
    115 bool            psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    116 
    117 bool            psphotApResid (pmConfig *config, const pmFPAview *view);
    118 bool            psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
    119 
    120 bool            psphotMagnitudes (pmConfig *config, const pmFPAview *view);
     103bool            psphotReplaceAllSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     104bool            psphotReplaceAllSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     105
     106bool            psphotAddNoise (pmConfig *config, const pmFPAview *view, const char *filerule);
     107bool            psphotSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule);
     108bool            psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule, bool add);
     109bool            psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool add);
     110
     111bool            psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view, const char *filerule);
     112bool            psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     113
     114bool            psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view, const char *filerule);
     115bool            psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     116
     117bool            psphotApResid (pmConfig *config, const pmFPAview *view, const char *filerule);
     118bool            psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     119
     120bool            psphotMagnitudes (pmConfig *config, const pmFPAview *view, const char *filerule);
    121121bool            psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf);
    122122bool            psphotMagnitudes_Threaded (psThreadJob *job);
    123123
    124 bool            psphotEfficiency (pmConfig *config, const pmFPAview *view);
    125 bool            psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe);
     124bool            psphotEfficiency (pmConfig *config, const pmFPAview *view, const char *filerule);
     125bool            psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    126126
    127127bool            psphotPSFWeights(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources);
    128128bool            psphotPSFWeights_Threaded (psThreadJob *job);
    129129
    130 bool            psphotSkyReplace (pmConfig *config, const pmFPAview *view);
    131 bool            psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index);
    132 
    133 bool            psphotSourceFreePixels (pmConfig *config, const pmFPAview *view);
    134 bool            psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index);
     130bool            psphotSkyReplace (pmConfig *config, const pmFPAview *view, const char *filerule);
     131bool            psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
     132
     133bool            psphotSourceFreePixels (pmConfig *config, const pmFPAview *view, const char *filerule);
     134bool            psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    135135
    136136// in psphotSourceStats.c:
     
    147147
    148148// in psphotMergeSources.c:
    149 bool            psphotLoadExtSources (pmConfig *config, const pmFPAview *view);
     149bool            psphotLoadExtSources (pmConfig *config, const pmFPAview *view, const char *filerule);
    150150psArray        *psphotLoadPSFSources (pmConfig *config, const pmFPAview *view);
    151 bool            psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view);
    152 bool            psphotCheckExtSources (pmConfig *config, const pmFPAview *view);
     151bool            psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     152bool            psphotCheckExtSources (pmConfig *config, const pmFPAview *view, const char *filerule);
    153153
    154154// generate the detection structure for the supplied array of sources
    155 bool            psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, psArray *sources);
     155bool            psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *sources);
    156156
    157157// generate the detection structure for the supplied array of sources
     
    349349bool psphotStackImageLoop (pmConfig *config);
    350350bool psphotStackReadout (pmConfig *config, const pmFPAview *view);
    351 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view);
     351bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *filerule);
    352352bool psphotStackChisqImageAddReadout(const pmConfig *config, // Configuration
    353353                                     const pmFPAview *view,
     354                                     const char *filename,
    354355                                     pmReadout **chiReadout,
    355                                      char *filename,
    356356                                     int index);
    357357
    358 bool psphotStackRemoveChisqFromInputs (pmConfig *config);
     358bool psphotStackRemoveChisqFromInputs (pmConfig *config, const char *filerule);
    359359bool pmFPAfileRemoveSingle(psMetadata *files, const char *name, int num);
    360360
    361 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view);
    362 bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, char *filename, int index);
     361psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule);
     362bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    363363bool psphotMatchSourcesToObjects (psArray *objects, psArray *sources, float RADIUS);
    364364
  • branches/eam_branches/psphot.20100506/src/psphotAddNoise.c

    r26894 r27909  
    11# include "psphotInternal.h"
    22
    3 bool psphotAddNoise (pmConfig *config, const pmFPAview *view) {
    4     return psphotAddOrSubNoise (config, view, true);
     3bool psphotAddNoise (pmConfig *config, const pmFPAview *view, const char *filerule) {
     4    return psphotAddOrSubNoise (config, view, filerule, true);
    55}
    66
    7 bool psphotSubNoise (pmConfig *config, const pmFPAview *view) {
    8     return psphotAddOrSubNoise (config, view, false);
     7bool psphotSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule) {
     8    return psphotAddOrSubNoise (config, view, filerule, false);
    99}
    1010
    1111// for now, let's store the detections on the readout->analysis for each readout
    12 bool psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, bool add)
     12bool psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule, bool add)
    1313{
    1414    bool status = true;
     
    2323    // loop over the available readouts
    2424    for (int i = 0; i < num; i++) {
    25         if (!psphotAddOrSubNoiseReadout (config, view, "PSPHOT.INPUT", i, recipe, add)) {
    26             psError (PSPHOT_ERR_CONFIG, false, "failed on to modify noise for PSPHOT.INPUT entry %d", i);
     25        if (!psphotAddOrSubNoiseReadout (config, view, filerule, i, recipe, add)) {
     26            psError (PSPHOT_ERR_CONFIG, false, "failed on to modify noise for %s entry %d", filerule, i);
    2727            return false;
    2828        }
     
    3131}
    3232
    33 bool psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool add) {
     33bool psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool add) {
    3434
    3535    bool status = false;
     
    3939
    4040    // find the currently selected readout
    41     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     41    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4242    psAssert (file, "missing file?");
    4343
  • branches/eam_branches/psphot.20100506/src/psphotApResid.c

    r27657 r27909  
    55
    66// for now, let's store the detections on the readout->analysis for each readout
    7 bool psphotApResid (pmConfig *config, const pmFPAview *view)
     7bool psphotApResid (pmConfig *config, const pmFPAview *view, const char *filerule)
    88{
    99    bool status = true;
     
    2323    for (int i = 0; i < num; i++) {
    2424        if (i == chisqNum) continue; // skip chisq image
    25         if (!psphotApResidReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    26             psError (PSPHOT_ERR_CONFIG, false, "failed to measure aperture residual for PSPHOT.INPUT entry %d", i);
     25        if (!psphotApResidReadout (config, view, filerule, i, recipe)) {
     26            psError (PSPHOT_ERR_CONFIG, false, "failed to measure aperture residual for %s entry %d", filerule, i);
    2727            return false;
    2828        }
     
    3131}
    3232
    33 bool psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe)
     33bool psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe)
    3434{
    3535    int Nfail = 0;
     
    4343
    4444    // find the currently selected readout
    45     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     45    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4646    psAssert (file, "missing file?");
    4747
  • branches/eam_branches/psphot.20100506/src/psphotBasicDeblend.c

    r26894 r27909  
    22
    33// for now, let's store the detections on the readout->analysis for each readout
    4 bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view)
     4bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filerule)
    55{
    66    bool status = true;
     
    1111    // loop over the available readouts
    1212    for (int i = 0; i < num; i++) {
    13         if (!psphotBasicDeblendReadout (config, view, "PSPHOT.INPUT", i)) {
    14             psError (PSPHOT_ERR_CONFIG, false, "failed on basic deblend analysis for PSPHOT.INPUT entry %d", i);
     13        if (!psphotBasicDeblendReadout (config, view, filerule, i)) {
     14            psError (PSPHOT_ERR_CONFIG, false, "failed on basic deblend analysis for %s entry %d", filerule, i);
    1515            return false;
    1616        }
     
    1919}
    2020
    21 bool psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filename, int fileIndex) {
     21bool psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int fileIndex) {
    2222
    2323    int N;
     
    3131
    3232    // find the currently selected readout
    33     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, fileIndex); // File of interest
     33    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, fileIndex); // File of interest
    3434    psAssert (file, "missing file?");
    3535
  • branches/eam_branches/psphot.20100506/src/psphotBlendFit.c

    r26894 r27909  
    22
    33// for now, let's store the detections on the readout->analysis for each readout
    4 bool psphotBlendFit (pmConfig *config, const pmFPAview *view)
     4bool psphotBlendFit (pmConfig *config, const pmFPAview *view, const char *filerule)
    55{
    66    bool status = true;
     
    1515    // loop over the available readouts
    1616    for (int i = 0; i < num; i++) {
    17         if (!psphotBlendFitReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    18             psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (non-linear) for PSPHOT.INPUT entry %d", i);
     17        if (!psphotBlendFitReadout (config, view, filerule, i, recipe)) {
     18            psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (non-linear) for %s entry %d", filerule, i);
    1919            return false;
    2020        }
     
    2424
    2525// XXX I don't like this name
    26 bool psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) {
     26bool psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) {
    2727
    2828    int Nfit = 0;
     
    3535
    3636    // find the currently selected readout
    37     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     37    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    3838    psAssert (file, "missing file?");
    3939
  • branches/eam_branches/psphot.20100506/src/psphotChoosePSF.c

    r27657 r27909  
    22
    33// generate a PSF model for inputs without PSF models already loaded
    4 bool psphotChoosePSF (pmConfig *config, const pmFPAview *view)
     4bool psphotChoosePSF (pmConfig *config, const pmFPAview *view, const char *filerule)
    55{
    66    bool status = true;
     
    2020    for (int i = 0; i < num; i++) {
    2121        if (i == chisqNum) continue; // skip chisq image
    22         if (!psphotChoosePSFReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    23             psError (PSPHOT_ERR_CONFIG, false, "failed to choose a psf model for PSPHOT.INPUT entry %d", i);
     22        if (!psphotChoosePSFReadout (config, view, filerule, i, recipe)) {
     23            psError (PSPHOT_ERR_CONFIG, false, "failed to choose a psf model for %s entry %d", filerule, i);
    2424            return false;
    2525        }
     
    2929
    3030// try PSF models and select best option
    31 bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) {
     31bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) {
    3232
    3333    bool status;
     
    3636
    3737    // find the currently selected readout
    38     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     38    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    3939    psAssert (file, "missing file?");
    4040
  • branches/eam_branches/psphot.20100506/src/psphotDeblendSatstars.c

    r26894 r27909  
    22
    33// for now, let's store the detections on the readout->analysis for each readout
    4 bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view)
     4bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view, const char *filerule)
    55{
    66    bool status = true;
     
    1111    // loop over the available readouts
    1212    for (int i = 0; i < num; i++) {
    13         if (!psphotDeblendSatstarsReadout (config, view, "PSPHOT.INPUT", i)) {
    14             psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
     13        if (!psphotDeblendSatstarsReadout (config, view, filerule, i)) {
     14            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for %s entry %d", filerule, i);
    1515            return false;
    1616        }
     
    1919}
    2020
    21 bool psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int fileIndex) {
     21bool psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int fileIndex) {
    2222
    2323    int N;
     
    3131
    3232    // find the currently selected readout
    33     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, fileIndex); // File of interest
     33    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, fileIndex); // File of interest
    3434    psAssert (file, "missing file?");
    3535
  • branches/eam_branches/psphot.20100506/src/psphotEfficiency.c

    r27657 r27909  
    149149}
    150150
    151 bool psphotEfficiency (pmConfig *config, const pmFPAview *view)
     151bool psphotEfficiency (pmConfig *config, const pmFPAview *view, const char *filerule)
    152152{
    153153    bool status = true;
     
    167167    for (int i = 0; i < num; i++) {
    168168        if (i == chisqNum) continue; // skip chisq image
    169         if (!psphotEfficiencyReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    170             psError (PSPHOT_ERR_CONFIG, false, "failed to measure detection efficiency for PSPHOT.INPUT entry %d", i);
     169        if (!psphotEfficiencyReadout (config, view, filerule, i, recipe)) {
     170            psError (PSPHOT_ERR_CONFIG, false, "failed to measure detection efficiency for %s entry %d", filerule, i);
    171171            return false;
    172172        }
     
    176176
    177177// Determine detection efficiency
    178 bool psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe)
     178bool psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe)
    179179{
    180180    bool status = true;
     
    183183
    184184    // find the currently selected readout
    185     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     185    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    186186    psAssert (file, "missing file?");
    187187
  • branches/eam_branches/psphot.20100506/src/psphotExtendedSourceAnalysis.c

    r27819 r27909  
    22
    33// for now, let's store the detections on the readout->analysis for each readout
    4 bool psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view)
     4bool psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view, const char *filerule)
    55{
    66    bool status = true;
     
    2121    // loop over the available readouts
    2222    for (int i = 0; i < num; i++) {
    23         if (!psphotExtendedSourceAnalysisReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    24             psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for PSPHOT.INPUT entry %d", i);
     23        if (!psphotExtendedSourceAnalysisReadout (config, view, filerule, i, recipe)) {
     24            psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for %s entry %d", filerule, i);
    2525            return false;
    2626        }
     
    3030
    3131// aperture-like measurements for extended sources
    32 bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) {
     32bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) {
    3333
    3434    bool status;
     
    4242
    4343    // find the currently selected readout
    44     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     44    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4545    psAssert (file, "missing file?");
    4646
  • branches/eam_branches/psphot.20100506/src/psphotExtendedSourceFits.c

    r26894 r27909  
    22
    33// for now, let's store the detections on the readout->analysis for each readout
    4 bool psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view)
     4bool psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view, const char *filerule)
    55{
    66    bool status = true;
     
    2121    // loop over the available readouts
    2222    for (int i = 0; i < num; i++) {
    23         if (!psphotExtendedSourceFitsReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    24             psError (PSPHOT_ERR_CONFIG, false, "failed on to fit extended sources for PSPHOT.INPUT entry %d", i);
     23        if (!psphotExtendedSourceFitsReadout (config, view, filerule, i, recipe)) {
     24            psError (PSPHOT_ERR_CONFIG, false, "failed on to fit extended sources for %s entry %d", filerule, i);
    2525            return false;
    2626        }
     
    3030
    3131// non-linear model fitting for extended sources
    32 bool psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) {
     32bool psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) {
    3333
    3434    bool status;
     
    4141
    4242    // find the currently selected readout
    43     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     43    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4444    psAssert (file, "missing file?");
    4545
  • branches/eam_branches/psphot.20100506/src/psphotFindDetections.c

    r26894 r27909  
    44// peaks and new footprints.  any old peaks are saved on oldPeaks.  the resulting footprint set
    55// contains all footprints (old and new)
    6 bool psphotFindDetections (pmConfig *config, const pmFPAview *view, bool firstPass)
     6bool psphotFindDetections (pmConfig *config, const pmFPAview *view, const char *filerule, bool firstPass)
    77{
    88    bool status = true;
     
    1717    // loop over the available readouts
    1818    for (int i = 0; i < num; i++) {
    19         if (!psphotFindDetectionsReadout (config, view, "PSPHOT.INPUT", i, recipe, firstPass)) {
    20             psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);
     19        if (!psphotFindDetectionsReadout (config, view, filerule, i, recipe, firstPass)) {
     20            psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for %s entry %d", filerule, i);
    2121            return false;
    2222        }
     
    2626
    2727// smooth the image, search for peaks, optionally define footprints based on the peaks
    28 bool psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool firstPass) {
     28bool psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool firstPass) {
    2929
    3030    bool status;
     
    3434
    3535    // find the currently selected readout
    36     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     36    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    3737    psAssert (file, "missing file?");
    3838
  • branches/eam_branches/psphot.20100506/src/psphotFitSourcesLinear.c

    r27532 r27909  
    1313
    1414// for now, let's store the detections on the readout->analysis for each readout
    15 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, bool final)
     15bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final)
    1616{
    1717    bool status = true;
     
    2828
    2929        // find the currently selected readout
    30         pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", i); // File of interest
     30        pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest
    3131        psAssert (file, "missing file?");
    3232
     
    4444
    4545        if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final)) {
    46             psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for PSPHOT.INPUT entry %d", i);
     46            psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i);
    4747            return false;
    4848        }
  • branches/eam_branches/psphot.20100506/src/psphotForcedReadout.c

    r27314 r27909  
    2020
    2121    // set the photcode for this image
    22     if (!psphotAddPhotcode (config, view)) {
     22    if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {
    2323        psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    2424        return false;
     
    3030
    3131    // Generate the mask and weight images, including the user-defined analysis region of interest
    32     psphotSetMaskAndVariance (config, view);
     32    psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");
    3333    if (!strcasecmp (breakPt, "NOTHING")) {
    34         return psphotReadoutCleanup(config, view);
     34        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    3535    }
    3636
    3737    // generate a background model (median, smoothed image)
    38     if (!psphotModelBackground (config, view)) {
    39         return psphotReadoutCleanup (config, view);
     38    if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {
     39        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4040    }
    41     if (!psphotSubtractBackground (config, view)) {
    42         return psphotReadoutCleanup (config, view);
     41    if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {
     42        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4343    }
    4444    if (!strcasecmp (breakPt, "BACKMDL")) {
    45         return psphotReadoutCleanup (config, view);
     45        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4646    }
    4747
     
    4949        // this only happens if we had a programming error in psphotLoadPSF
    5050        psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model");
    51         return psphotReadoutCleanup (config, view);
     51        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5252    }
    5353
    5454    // include externally-supplied sources
    55     psphotLoadExtSources (config, view);
     55    psphotLoadExtSources (config, view, "PSPHOT.INPUT");
    5656
    5757    // construct an initial model for each object, set the radius to fitRadius, set circular fit mask
    58     psphotGuessModels (config, view);
     58    psphotGuessModels (config, view, "PSPHOT.INPUT");
    5959
    6060    // merge the newly selected sources into the existing list
    6161    // NOTE: merge OLD and NEW
    62     psphotMergeSources (config, view);
     62    psphotMergeSources (config, view, "PSPHOT.INPUT");
    6363
    6464    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
    65     psphotFitSourcesLinear (config, view, false);
     65    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);
    6666
    6767    // identify CRs and extended sources
     
    7171
    7272    // calculate source magnitudes
    73     psphotMagnitudes(config, view);
     73    psphotMagnitudes(config, view, "PSPHOT.INPUT");
    7474
    7575    // XXX do I want to do this?
     
    8080
    8181    // replace background in residual image
    82     psphotSkyReplace (config, view);
     82    psphotSkyReplace (config, view, "PSPHOT.INPUT");
    8383
    8484    // drop the references to the image pixels held by each source
    85     psphotSourceFreePixels (config, view);
     85    psphotSourceFreePixels (config, view, "PSPHOT.INPUT");
    8686
    8787    // create the exported-metadata and free local data
    88     return psphotReadoutCleanup(config, view);
     88    return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8989}
  • branches/eam_branches/psphot.20100506/src/psphotGuessModels.c

    r27657 r27909  
    88
    99// for now, let's store the detections on the readout->analysis for each readout
    10 bool psphotGuessModels (pmConfig *config, const pmFPAview *view)
     10bool psphotGuessModels (pmConfig *config, const pmFPAview *view, const char *filerule)
    1111{
    1212    bool status = true;
     
    2222    for (int i = 0; i < num; i++) {
    2323        if (i == chisqNum) continue; // skip chisq image
    24         if (!psphotGuessModelsReadout (config, view, "PSPHOT.INPUT", i)) {
    25             psError (PSPHOT_ERR_CONFIG, false, "failed on to guess models for PSPHOT.INPUT entry %d", i);
     24        if (!psphotGuessModelsReadout (config, view, filerule, i)) {
     25            psError (PSPHOT_ERR_CONFIG, false, "failed on to guess models for %s entry %d", filerule, i);
    2626            return false;
    2727        }
     
    3131
    3232// construct an initial PSF model for each object (new sources only)
    33 bool psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
     33bool psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
    3434
    3535    bool status;
     
    3838
    3939    // find the currently selected readout
    40     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     40    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4141    psAssert (file, "missing file?");
    4242
  • branches/eam_branches/psphot.20100506/src/psphotImageQuality.c

    r27657 r27909  
    55
    66// for now, let's store the detections on the readout->analysis for each readout
    7 bool psphotImageQuality (pmConfig *config, const pmFPAview *view)
     7bool psphotImageQuality (pmConfig *config, const pmFPAview *view, const char *filerule)
    88{
    99    bool status = true;
     
    2323    for (int i = 0; i < num; i++) {
    2424        if (i == chisqNum) continue; // skip chisq image
    25         if (!psphotImageQualityReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    26             psError (PSPHOT_ERR_CONFIG, false, "failed on to measure image quality for PSPHOT.INPUT entry %d", i);
     25        if (!psphotImageQualityReadout (config, view, filerule, i, recipe)) {
     26            psError (PSPHOT_ERR_CONFIG, false, "failed on to measure image quality for %s entry %d", filerule, i);
    2727            return false;
    2828        }
     
    3232
    3333// selecting the 'good' stars (likely to be psf stars), measure the M_cn, M_sn terms for n = 2,3,4
    34 bool psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe)
     34bool psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe)
    3535{
    3636    bool status = true;
    3737
    3838    // find the currently selected readout
    39     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     39    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4040    psAssert (file, "missing file?");
    4141
  • branches/eam_branches/psphot.20100506/src/psphotMagnitudes.c

    r27657 r27909  
    11# include "psphotInternal.h"
    22
    3 bool psphotMagnitudes (pmConfig *config, const pmFPAview *view)
     3bool psphotMagnitudes (pmConfig *config, const pmFPAview *view, const char *filerule)
    44{
    55    bool status = true;
     
    2121
    2222        // find the currently selected readout
    23         pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", i); // File of interest
     23        pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest
    2424        psAssert (file, "missing file?");
    2525
     
    3737
    3838        if (!psphotMagnitudesReadout (config, recipe, view, readout, sources, psf)) {
    39             psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for PSPHOT.INPUT entry %d", i);
     39            psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for %s entry %d", filerule, i);
    4040            return false;
    4141        }
  • branches/eam_branches/psphot.20100506/src/psphotMakePSFReadout.c

    r26894 r27909  
    1919
    2020    // set the photcode for this image
    21     if (!psphotAddPhotcode (config, view)) {
     21    if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {
    2222        psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    2323        return false;
     
    2929
    3030    // Generate the mask and weight images, including the user-defined analysis region of interest
    31     psphotSetMaskAndVariance (config, view);
     31    psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");
    3232    if (!strcasecmp (breakPt, "NOTHING")) {
    33         return psphotReadoutCleanup(config, view);
     33        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    3434    }
    3535
    3636    // generate a background model (median, smoothed image)
    37     if (!psphotModelBackground (config, view)) {
    38         return psphotReadoutCleanup (config, view);
     37    if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {
     38        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    3939    }
    40     if (!psphotSubtractBackground (config, view)) {
    41         return psphotReadoutCleanup (config, view);
     40    if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {
     41        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4242    }
    4343    if (!strcasecmp (breakPt, "BACKMDL")) {
    44         return psphotReadoutCleanup (config, view);
     44        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4545    }
    4646
    47     psphotLoadExtSources (config, view);
     47    psphotLoadExtSources (config, view, "PSPHOT.INPUT");
    4848
    4949    // If sources have been supplied, then these should be used to measure the PSF include
     
    5353    // a text file have no valid SN values, but psphotChoosePSF needs to select the top
    5454    // PSF_MAX_NSTARS to generate the PSF.
    55     if (!psphotCheckExtSources (config, view)) {
     55    if (!psphotCheckExtSources (config, view, "PSPHOT.INPUT")) {
    5656        psLogMsg ("psphot", 3, "failure to select possible PSF sources (external or internal)");
    57         return psphotReadoutCleanup (config, view);
     57        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5858    }
    5959
    6060    // Use bright stellar objects to measure PSF. If we do not have enough stars to generate
    6161    // the PSF, build one from the SEEING guess and model class
    62     if (!psphotChoosePSF (config, view)) {
     62    if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) {
    6363        psLogMsg ("psphot", 3, "failure to construct a psf model");
    64         return psphotReadoutCleanup (config, view);
     64        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    6565    }
    6666
    6767    // measure aperture photometry corrections
    6868# if 0
    69     if (!psphotApResid (config, view)) {
     69    if (!psphotApResid (config, view, "PSPHOT.INPUT")) {
    7070        psLogMsg ("psphot", 3, "failed on psphotApResid");
    71         return psphotReadoutCleanup (config, view);
     71        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7272    }
    7373# endif
    7474
    75     return psphotReadoutCleanup (config, view);
     75    return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7676}
  • branches/eam_branches/psphot.20100506/src/psphotMaskReadout.c

    r26894 r27909  
    11# include "psphotInternal.h"
    22
    3 bool psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view) {
     3bool psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view, const char *filerule) {
    44
    55    bool status = false;
     
    1616
    1717        // Generate the mask and weight images, including the user-defined analysis region of interest
    18         if (!psphotSetMaskAndVarianceReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
     18        if (!psphotSetMaskAndVarianceReadout (config, view, filerule, i, recipe)) {
    1919            psError (PSPHOT_ERR_CONFIG, false, "failed to generate mask for PSPHOT.INPUT entry %d", i);
    2020            return false;
     
    2525
    2626// generate mask and variance if not defined, additional mask for restricted subregion
    27 bool psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) {
     27bool psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) {
    2828
    2929    bool status;
    3030
    31     pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", index); // File of interest
     31    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    3232    psAssert (file, "missing file?");
    3333
  • branches/eam_branches/psphot.20100506/src/psphotMergeSources.c

    r27657 r27909  
    66
    77// for now, let's store the detections on the readout->analysis for each readout
    8 bool psphotMergeSources (pmConfig *config, const pmFPAview *view)
     8bool psphotMergeSources (pmConfig *config, const pmFPAview *view, const char *filerule)
    99{
    1010    bool status = true;
     
    1515    // loop over the available readouts
    1616    for (int i = 0; i < num; i++) {
    17         if (!psphotMergeSourcesReadout (config, view, "PSPHOT.INPUT", i)) {
    18             psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i);
     17        if (!psphotMergeSourcesReadout (config, view, filerule, i)) {
     18            psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for %s entry %d", filerule, i);
    1919            return false;
    2020        }
     
    2424
    2525// add newly selected sources to the existing list of sources
    26 bool psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
     26bool psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
    2727
    2828    bool status;
    2929
    3030    // find the currently selected readout
    31     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     31    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    3232    psAssert (file, "missing file?");
    3333
     
    7171// only expect a single entry for PSPHOT.INPUT.CMF and PSPHOT.SOURCES.TEXT, so we can only
    7272// associate input sources with a single entry for PSPHOT.INPUT
    73 bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view) {
     73bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view, const char *filerule) {
    7474
    7575    bool status;
     
    7979
    8080    // find the currently selected readout
    81     pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", index); // File of interest
     81    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    8282    psAssert (file, "missing file?");
    8383
     
    130130    // load data from input TXT file:
    131131    {
    132         pmChip *chipTXT = pmFPAfileThisChip (config->files, view, "PSPHOT.INPUT");
     132        pmChip *chipTXT = pmFPAfileThisChip (config->files, view, filerule);
    133133        if (!chipTXT) goto finish;
    134134
     
    167167
    168168// extract the input sources corresponding to this readout
    169 // XXX this function needs to be updated to work with the new context of pshot inputs
     169// XXX this function needs to be updated to work with the new context of psphot inputs
    170170psArray *psphotLoadPSFSources (pmConfig *config, const pmFPAview *view) {
    171171
     
    197197// psphotDetectionsFromSources to psphotSourceStats and are now stored on
    198198// detections->newSources.
    199 bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view) {
    200 
    201     // find the currently selected readout
    202     pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", 0); // File of interest
     199bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view, const char *filerule) {
     200
     201    // find the currently selected readout
     202    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest
    203203    psAssert (file, "missing file?");
    204204
     
    227227// generate the detection structure for the supplied array of sources
    228228// XXX this currently assumes there is a single input file
    229 bool psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, psArray *sources) {
    230 
    231     // find the currently selected readout
    232     pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", 0); // File of interest
     229bool psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *sources) {
     230
     231    // find the currently selected readout
     232    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest
    233233    psAssert (file, "missing file?");
    234234
     
    335335}
    336336
    337 bool psphotCheckExtSources (pmConfig *config, const pmFPAview *view) {
     337bool psphotCheckExtSources (pmConfig *config, const pmFPAview *view, const char *filerule) {
    338338
    339339    bool status;
     
    343343
    344344    // find the currently selected readout
    345     pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", 0); // File of interest
     345    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest
    346346    psAssert (file, "missing file?");
    347347
     
    373373
    374374        // find the detections (by peak and/or footprint) in the image.
    375         if (!psphotFindDetections (config, view, true)) {
     375        if (!psphotFindDetections (config, view, filerule, true)) {
    376376            psError(PSPHOT_ERR_CONFIG, false, "unable to find detections in this image");
    377             return psphotReadoutCleanup (config, view);
     377            return psphotReadoutCleanup (config, view, filerule);
    378378        }
    379379
    380380        // construct sources and measure basic stats
    381         psphotSourceStats (config, view, true);
     381        psphotSourceStats (config, view, filerule, true);
    382382
    383383        // find blended neighbors of very saturated stars
    384         psphotDeblendSatstars (config, view);
     384        psphotDeblendSatstars (config, view, filerule);
    385385
    386386        // mark blended peaks PS_SOURCE_BLEND
    387         if (!psphotBasicDeblend (config, view)) {
     387        if (!psphotBasicDeblend (config, view, filerule)) {
    388388            psLogMsg ("psphot", 3, "failed on deblend analysis");
    389             return psphotReadoutCleanup (config, view);
     389            return psphotReadoutCleanup (config, view, filerule);
    390390        }
    391391
    392392        // classify sources based on moments, brightness
    393         if (!psphotRoughClass (config, view)) {
     393        if (!psphotRoughClass (config, view, filerule)) {
    394394            psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
    395             return psphotReadoutCleanup (config, view);
    396         }
    397     }
    398 
    399     return true;
    400 }
     395            return psphotReadoutCleanup (config, view, filerule);
     396        }
     397    }
     398
     399    return true;
     400}
  • branches/eam_branches/psphot.20100506/src/psphotModelBackground.c

    r27657 r27909  
    384384
    385385// XXX supply filename or keep PSPHOT.INPUT fixed?
    386 bool psphotModelBackground (pmConfig *config, const pmFPAview *view)
     386bool psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule)
    387387{
    388388    bool status = false;
     
    393393    // loop over the available readouts
    394394    for (int i = 0; i < num; i++) {
    395         if (!psphotModelBackgroundReadoutFileIndex(config, view, "PSPHOT.INPUT", i)) {
     395        if (!psphotModelBackgroundReadoutFileIndex(config, view, filerule, i)) {
    396396            psError (PSPHOT_ERR_CONFIG, false, "failed to model background for PSPHOT.INPUT entry %d", i);
    397397            return false;
  • branches/eam_branches/psphot.20100506/src/psphotModelTest.c

    r26894 r27909  
    33
    44// XXX add more test information?
    5 bool psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe) {
     5bool psphotModelTest (pmConfig *config, const pmFPAview *view, const char *filerule, psMetadata *recipe) {
    66
    77    bool status;
     
    3333
    3434    // use poissonian errors or local-sky errors
    35     bool POISSON_ERRORS = psMetadataLookupBool (&status, recipe, "POISSON_ERRORS");
     35    bool POISSON_ERRORS = psMetadataLookupBool (&status, recipe, filerule);
    3636    if (!status) POISSON_ERRORS = true;
    3737    pmSourceFitModelInit (15, 0.1, 1.0, POISSON_ERRORS);
  • branches/eam_branches/psphot.20100506/src/psphotOutput.c

    r26894 r27909  
    126126}
    127127
    128 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view) {
     128bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule) {
    129129
    130130    bool status = false;
     
    135135    // loop over the available readouts
    136136    for (int i = 0; i < num; i++) {
    137         if (!psphotAddPhotcodeReadout (config, view, "PSPHOT.INPUT", i)) {
     137        if (!psphotAddPhotcodeReadout (config, view, filerule, i)) {
    138138            psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to PSPHOT.INPUT entry %d", i);
    139139            return false;
  • branches/eam_branches/psphot.20100506/src/psphotReadout.c

    r27657 r27909  
    2828
    2929    // set the photcode for this image
    30     if (!psphotAddPhotcode (config, view)) {
     30    if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {
    3131        psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    3232        return false;
     
    3434
    3535    // Generate the mask and weight images, including the user-defined analysis region of interest
    36     if (!psphotSetMaskAndVariance (config, view)) {
    37         return psphotReadoutCleanup(config, view);
     36    if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) {
     37        return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");
    3838    }
    3939    if (!strcasecmp (breakPt, "NOTHING")) {
    40         return psphotReadoutCleanup(config, view);
     40        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4141    }
    4242
    4343    // generate a background model (median, smoothed image)
    44     if (!psphotModelBackground (config, view)) {
    45         return psphotReadoutCleanup (config, view);
    46     }
    47     if (!psphotSubtractBackground (config, view)) {
    48         return psphotReadoutCleanup (config, view);
     44    if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {
     45        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
     46    }
     47    if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {
     48        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4949    }
    5050    if (!strcasecmp (breakPt, "BACKMDL")) {
    51         return psphotReadoutCleanup (config, view);
     51        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5252    }
    5353
    5454    // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are determined and saved on
    5555    // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT
    56     if (!psphotLoadPSF (config, view)) {
     56    if (!psphotLoadPSF (config, view)) { // ??? need to supply 2 ?
    5757        psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model");
    58         return psphotReadoutCleanup (config, view);
     58        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5959    }
    6060
    6161    // find the detections (by peak and/or footprint) in the image.
    62     if (!psphotFindDetections (config, view, true)) { // pass 1
     62    if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1
    6363        // this only happens if we had an error in psphotFindDetections
    6464        psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis");
    65         return psphotReadoutCleanup (config, view);
     65        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    6666    }
    6767
    6868    // construct sources and measure basic stats (saved on detections->newSources)
    69     if (!psphotSourceStats (config, view, true)) { // pass 1
     69    if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1
    7070        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
    71         return psphotReadoutCleanup (config, view);
     71        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7272    }
    7373    if (!strcasecmp (breakPt, "PEAKS")) {
    74         return psphotReadoutCleanup(config, view);
     74        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7575    }
    7676
    7777    // find blended neighbors of very saturated stars (detections->newSources)
    78     if (!psphotDeblendSatstars (config, view)) {
     78    if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) {
    7979        psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis");
    80         return psphotReadoutCleanup (config, view);
     80        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8181    }
    8282
    8383    // mark blended peaks PS_SOURCE_BLEND (detections->newSources)
    84     if (!psphotBasicDeblend (config, view)) {
     84    if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {
    8585        psError (PSPHOT_ERR_UNKNOWN, false, "failed on deblend analysis");
    86         return psphotReadoutCleanup (config, view);
     86        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8787    }
    8888
    8989    // classify sources based on moments, brightness.  if a PSF model has been loaded, the PSF
    9090    // clump defined for it is used not measured (detections->newSources)
    91     if (!psphotRoughClass (config, view)) { // pass 1
     91    if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 1
    9292        psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough classifications");
    93         return psphotReadoutCleanup (config, view);
     93        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    9494    }
    9595    // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources)
    96     if (!psphotImageQuality (config, view)) { // pass 1
     96    if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1
    9797        psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality");
    98         return psphotReadoutCleanup(config, view);
     98        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    9999    }
    100100    if (!strcasecmp (breakPt, "MOMENTS")) {
    101         return psphotReadoutCleanup(config, view);
     101        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    102102    }
    103103
    104104    // use bright stellar objects to measure PSF if we were supplied a PSF for any input file,
    105105    // this step is skipped
    106     if (!psphotChoosePSF (config, view)) { // pass 1
     106    if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) { // pass 1
    107107        psLogMsg ("psphot", 3, "failure to construct a psf model");
    108         return psphotReadoutCleanup (config, view);
     108        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    109109    }
    110110    if (!strcasecmp (breakPt, "PSFMODEL")) {
    111         return psphotReadoutCleanup (config, view);
     111        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    112112    }
    113113
    114114    // include externally-supplied sources
    115115    // XXX fix this in the new multi-input context
    116     // psphotLoadExtSources (config, view); // pass 1
     116    // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1
    117117
    118118    // construct an initial model for each object, set the radius to fitRadius, set circular
    119119    // fit mask (detections->newSources)
    120     psphotGuessModels (config, view); // pass 1
     120    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1
    121121
    122122    // merge the newly selected sources into the existing list
    123123    // NOTE: merge OLD and NEW
    124     psphotMergeSources (config, view);
     124    psphotMergeSources (config, view, "PSPHOT.INPUT");
    125125
    126126    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
    127     psphotFitSourcesLinear (config, view, false); // pass 1 (detections->allSources)
     127    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources)
    128128
    129129    // identify CRs and extended sources (only unmeasured sources are measured)
    130     psphotSourceSize (config, view, true); // pass 1 (detections->allSources)
     130    psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources)
    131131    if (!strcasecmp (breakPt, "ENSEMBLE")) {
    132132        goto finish;
     
    135135    // non-linear PSF and EXT fit to brighter sources
    136136    // replace model flux, adjust mask as needed, fit, subtract the models (full stamp)
    137     psphotBlendFit (config, view); // pass 1 (detections->allSources)
     137    psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    138138
    139139    // replace all sources
    140     psphotReplaceAllSources (config, view); // pass 1 (detections->allSources)
     140    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    141141
    142142    // linear fit to include all sources (subtract again)
    143143    // NOTE : apply to ALL sources (extended + psf)
    144     psphotFitSourcesLinear (config, view, true); // pass 2 (detections->allSources)
     144    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources)
    145145
    146146    // if we only do one pass, skip to extended source analysis
     
    150150
    151151    // add noise for subtracted objects
    152     psphotAddNoise (config, view); // pass 1 (detections->allSources)
     152    psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    153153
    154154    // find fainter sources
    155155    // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections
    156     psphotFindDetections (config, view, false); // pass 2 (detections->peaks, detections->footprints)
     156    psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints)
    157157
    158158    // remove noise for subtracted objects (ie, return to normal noise level)
    159159    // NOTE: this needs to operate only on the OLD sources
    160     psphotSubNoise (config, view); // pass 1 (detections->allSources)
     160    psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    161161
    162162    // define new sources based on only the new peaks
    163163    // NOTE: new sources are saved on detections->newSources
    164     psphotSourceStats (config, view, false); // pass 2 (detections->newSources)
     164    psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources)
    165165
    166166    // set source type
    167167    // NOTE: apply only to detections->newSources
    168     if (!psphotRoughClass (config, view)) { // pass 2 (detections->newSources)
     168    if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 2 (detections->newSources)
    169169        psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
    170         return psphotReadoutCleanup (config, view);
     170        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    171171    }
    172172
    173173    // create full input models, set the radius to fitRadius, set circular fit mask
    174174    // NOTE: apply only to detections->newSources
    175     psphotGuessModels (config, view); // pass 2 (detections->newSources)
     175    psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources)
    176176
    177177    // replace all sources so fit below applies to all at once
    178178    // NOTE: apply only to OLD sources (which have been subtracted)
    179     psphotReplaceAllSources (config, view); // pass 2
     179    psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2
    180180
    181181    // merge the newly selected sources into the existing list
    182182    // NOTE: merge OLD and NEW
    183183    // XXX check on free of sources...
    184     psphotMergeSources (config, view); // (detections->newSources + detections->allSources -> detections->allSources)
     184    psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources)
    185185
    186186    // NOTE: apply to ALL sources
    187     psphotFitSourcesLinear (config, view, true); // pass 3 (detections->allSources)
     187    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources)
    188188
    189189pass1finish:
     
    191191    // measure source size for the remaining sources
    192192    // NOTE: applies only to NEW (unmeasured) sources
    193     psphotSourceSize (config, view, false); // pass 2 (detections->allSources)
    194 
    195     psphotExtendedSourceAnalysis (config, view); // pass 1 (detections->allSources)
    196     psphotExtendedSourceFits (config, view); // pass 1 (detections->allSources)
     193    psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources)
     194
     195    psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
     196    psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
    197197
    198198finish:
     
    202202
    203203    // measure aperture photometry corrections
    204     if (!psphotApResid (config, view)) { // pass 1 (detections->allSources)
     204    if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)
    205205        psLogMsg ("psphot", 3, "failed on psphotApResid");
    206         return psphotReadoutCleanup (config, view);
     206        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    207207    }
    208208
    209209    // calculate source magnitudes
    210     psphotMagnitudes(config, view); // pass 1 (detections->allSources)
    211 
    212     if (!psphotEfficiency(config, view)) { // pass 1
     210    psphotMagnitudes(config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)
     211
     212    if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1
    213213        psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
    214214        psErrorClear();
     
    219219
    220220    // replace background in residual image
    221     psphotSkyReplace (config, view); // pass 1
     221    psphotSkyReplace (config, view, "PSPHOT.INPUT"); // pass 1
    222222
    223223    // drop the references to the image pixels held by each source
    224     psphotSourceFreePixels (config, view); // pass 1
     224    psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); // pass 1
    225225
    226226    // create the exported-metadata and free local data
    227     return psphotReadoutCleanup(config, view);
     227    return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");
    228228}
  • branches/eam_branches/psphot.20100506/src/psphotReadoutCleanup.c

    r27657 r27909  
    22
    33// for now, let's store the detections on the readout->analysis for each readout
    4 bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view)
     4bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view, const char *filerule)
    55{
    66    bool status = true;
     
    2424    // loop over the available readouts
    2525    for (int i = 0; i < num; i++) {
    26         if (!psphotReadoutCleanupReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    27             psError (PSPHOT_ERR_CONFIG, false, "failed on psphotReadoutCleanup for PSPHOT.INPUT entry %d", i);
     26        if (!psphotReadoutCleanupReadout (config, view, filerule, i, recipe)) {
     27            psError (PSPHOT_ERR_CONFIG, false, "failed on psphotReadoutCleanup for %s entry %d", filerule, i);
    2828            return false;
    2929        }
     
    3939// not a DATA error, then there was a serious problem.  Only in this case, or if the fail
    4040// on the stats measurement, do we return false
    41 bool psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) {
     41bool psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) {
    4242
    4343    bool status = true;
    4444
    4545    // find the currently selected readout
    46     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     46    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4747    psAssert (file, "missing file?");
    4848
  • branches/eam_branches/psphot.20100506/src/psphotReadoutFindPSF.c

    r26894 r27909  
    88
    99    // set the photcode for the PSPHOT.INPUT
    10     if (!psphotAddPhotcode(config, view)) {
     10    if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {
    1111        psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    1212        return false;
     
    1414
    1515    // Generate the mask and variance images, including the user-defined analysis region of interest
    16     psphotSetMaskAndVariance (config, view);
     16    psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");
    1717
    1818    // Note that in this implementation, we do NOT model the background and we do not
     
    2121    // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF)
    2222    // XXX we assume a single set of input sources is supplied
    23     if (!psphotDetectionsFromSources (config, view, inSources)) {
     23    if (!psphotDetectionsFromSources (config, view, "PSPHOT.INPUT", inSources)) {
    2424        psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars");
    25         return psphotReadoutCleanup(config, view);
     25        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    2626    }
    2727
    2828    // construct detections->newSources and measure basic stats (moments, local sky)
    29     if (!psphotSourceStats(config, view, true)) {
     29    if (!psphotSourceStats(config, view, "PSPHOT.INPUT", true)) {
    3030        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
    3131        return false;
     
    3333
    3434    // peak flux is wrong : use the peak measured in the moments analysis:
    35     if (!psphotRepairLoadedSources(config, view)) {
     35    if (!psphotRepairLoadedSources(config, view, "PSPHOT.INPUT")) {
    3636        psError(PSPHOT_ERR_UNKNOWN, false, "failure to repair sources");
    3737        return false;
     
    3939
    4040    // classify sources based on moments, brightness (psf is not known)
    41     if (!psphotRoughClass (config, view)) {
     41    if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) {
    4242        psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class");
    43         return psphotReadoutCleanup (config, view);
     43        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4444    }
    4545
    46     if (!psphotImageQuality (config, view)) {
     46    if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) {
    4747        psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality");
    48         return psphotReadoutCleanup(config, view);
     48        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4949    }
    5050
    51     if (!psphotChoosePSF(config, view)) {
     51    if (!psphotChoosePSF(config, view, "PSPHOT.INPUT")) {
    5252        psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model");
    53         return psphotReadoutCleanup(config, view);
     53        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5454    }
    5555
     
    5959    // fits from that analysis, or run the linear PSF fit for all objects currently in hand
    6060    // construct an initial model for each object, set the radius to fitRadius, set circular fit mask
    61     psphotGuessModels (config, view);
     61    psphotGuessModels (config, view, "PSPHOT.INPUT");
    6262# endif
    6363
    6464    // merge the newly selected sources into the existing list
    6565    // NOTE: merge OLD and NEW
    66     psphotMergeSources (config, view);
     66    psphotMergeSources (config, view, "PSPHOT.INPUT");
    6767
    6868# if 0
    6969    // measure aperture photometry corrections
    70     if (!psphotApResid (config, view)) {
     70    if (!psphotApResid (config, view, "PSPHOT.INPUT")) {
    7171        psLogMsg ("psphot", 3, "failed on psphotApResid");
    72         return psphotReadoutCleanup (config, view);
     72        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7373    }
    7474# endif
    7575
    7676    // drop the references to the image pixels held by each source
    77     psphotSourceFreePixels(config, view);
     77    psphotSourceFreePixels(config, view, "PSPHOT.INPUT");
    7878
    7979    // create the exported-metadata and free local data
    80     return psphotReadoutCleanup(config, view);
     80    return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    8181}
  • branches/eam_branches/psphot.20100506/src/psphotReadoutKnownSources.c

    r26894 r27909  
    88
    99    // set the photcode for this image
    10     if (!psphotAddPhotcode(config, view)) {
     10    if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {
    1111        psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    1212        return false;
     
    1414
    1515    // Generate the mask and weight images, including the user-defined analysis region of interest
    16     psphotSetMaskAndVariance (config, view);
     16    psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");
    1717
    1818    // Note that in this implementation, we do NOT model the background and we do not
     
    2020
    2121    // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF)
    22     if (!psphotDetectionsFromSources (config, view, inSources)) {
     22    if (!psphotDetectionsFromSources (config, view, "PSPHOT.INPUT", inSources)) {
    2323        psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars");
    24         return psphotReadoutCleanup(config, view);
     24        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    2525    }
    2626
    2727    // construct sources and measure basic stats
    28     if (!psphotSourceStats (config, view, true)) {
     28    if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) {
    2929        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
    3030        return false;
     
    3232
    3333    // peak flux is wrong : use the peak measured in the moments analysis:
    34     if (!psphotRepairLoadedSources(config, view)) {
     34    if (!psphotRepairLoadedSources(config, view, "PSPHOT.INPUT")) {
    3535        psError(PSPHOT_ERR_UNKNOWN, false, "failure to repair sources");
    3636        return false;
     
    3838
    3939    // classify sources based on moments, brightness (psf is not known)
    40     if (!psphotRoughClass (config, view)) {
     40    if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) {
    4141        psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class");
    42         return psphotReadoutCleanup(config, view);
     42        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4343    }
    4444
    45     if (!psphotChoosePSF (config, view)) {
     45    if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) {
    4646        psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model");
    47         return psphotReadoutCleanup(config, view);
     47        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4848    }
    4949
    5050    // construct an initial model for each object
    51     psphotGuessModels (config, view);
     51    psphotGuessModels (config, view, "PSPHOT.INPUT");
    5252
    5353    // merge the newly selected sources into the existing list
    5454    // NOTE: merge OLD and NEW
    55     psphotMergeSources (config, view);
     55    psphotMergeSources (config, view, "PSPHOT.INPUT");
    5656
    5757    // linear PSF fit to source peaks
    58     psphotFitSourcesLinear (config, view, false);
     58    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);
    5959
    6060    // measure aperture photometry corrections
    61     if (!psphotApResid (config, view)) {
     61    if (!psphotApResid (config, view, "PSPHOT.INPUT")) {
    6262        psLogMsg ("psphot", 3, "failed on psphotApResid");
    63         return psphotReadoutCleanup(config, view);
     63        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    6464    }
    6565
    6666    // calculate source magnitudes
    67     psphotMagnitudes(config, view);
     67    psphotMagnitudes(config, view, "PSPHOT.INPUT");
    6868
    6969    // drop the references to the image pixels held by each source
    70     psphotSourceFreePixels (config, view);
     70    psphotSourceFreePixels (config, view, "PSPHOT.INPUT");
    7171
    7272    // create the exported-metadata and free local data
    73     return psphotReadoutCleanup(config, view);
     73    return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    7474}
  • branches/eam_branches/psphot.20100506/src/psphotReadoutMinimal.c

    r26894 r27909  
    1818
    1919    // set the photcode for this image
    20     if (!psphotAddPhotcode(config, view)) {
     20    if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {
    2121        psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    2222        return false;
     
    2424
    2525    // Generate the mask and weight images, including the user-defined analysis region of interest
    26     psphotSetMaskAndVariance (config, view);
     26    psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");
    2727
    2828    // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are saved on readout->analysis
    2929    if (!psphotLoadPSF (config, view)) {
    3030      psError (PSPHOT_ERR_CONFIG, false, "missing psf model");
    31       return psphotReadoutCleanup (config, view);
     31      return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    3232    }
    3333
    3434    // find the detections (by peak and/or footprint) in the image. (final pass)
    35     if (!psphotFindDetections(config, view, false)) {
     35    if (!psphotFindDetections(config, view, "PSPHOT.INPUT", false)) {
    3636        psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis");
    37         return psphotReadoutCleanup (config, view);
     37        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    3838    }
    3939
    4040    // construct sources and measure basic stats (saved on detections->newSources)
    41     if (!psphotSourceStats (config, view, false)) { // pass 1
     41    if (!psphotSourceStats (config, view, "PSPHOT.INPUT", false)) { // pass 1
    4242        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
    43         return psphotReadoutCleanup (config, view);
     43        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    4444    }
    4545
    4646    // find blended neighbors of very saturated stars
    47     psphotDeblendSatstars (config, view);
     47    psphotDeblendSatstars (config, view, "PSPHOT.INPUT");
    4848
    4949    // mark blended peaks PS_SOURCE_BLEND
    50     if (!psphotBasicDeblend (config, view)) {
     50    if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {
    5151        psLogMsg ("psphot", 3, "failed on deblend analysis");
    52         return psphotReadoutCleanup (config, view);
     52        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5353    }
    5454
    5555    // classify sources based on moments, brightness (use supplied psf shape parameters)
    56     if (!psphotRoughClass (config, view)) {
     56    if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) {
    5757        psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
    58         return psphotReadoutCleanup (config, view);
     58        return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    5959    }
    6060
    6161    // construct an initial model for each object
    62     psphotGuessModels (config, view);
     62    psphotGuessModels (config, view, "PSPHOT.INPUT");
    6363
    6464    // merge the newly selected sources into the existing list
    65     psphotMergeSources (config, view);
     65    psphotMergeSources (config, view, "PSPHOT.INPUT");
    6666
    6767    // linear PSF fit to source peaks
    68     psphotFitSourcesLinear (config, view, false);
     68    psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);
    6969
    7070// XXX eventually, add the extended source fits here
    7171# if (0)
    7272    // measure source size for the remaining sources
    73     psphotSourceSize (config, view);
     73    psphotSourceSize (config, view, "PSPHOT.INPUT");
    7474
    75     psphotExtendedSourceAnalysis (config, view);
     75    psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT");
    7676
    77     psphotExtendedSourceFits (config, view);
     77    psphotExtendedSourceFits (config, view, "PSPHOT.INPUT");
    7878# endif
    7979
    8080    // calculate source magnitudes
    81     psphotMagnitudes(config, view);
     81    psphotMagnitudes(config, view, "PSPHOT.INPUT");
    8282
    8383    // XXX ensure this is measured if the analysis succeeds (even if quality is low)
    84     if (!psphotEfficiency(config, view)) {
     84    if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) {
    8585        psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
    8686        psErrorClear();
     
    8888
    8989    // drop the references to the image pixels held by each source
    90     psphotSourceFreePixels (config, view);
     90    psphotSourceFreePixels (config, view, "PSPHOT.INPUT");
    9191
    9292    // create the exported-metadata and free local data
    93     return psphotReadoutCleanup(config, view);
     93    return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");
    9494}
  • branches/eam_branches/psphot.20100506/src/psphotReplaceUnfit.c

    r26894 r27909  
    2323
    2424// for now, let's store the detections on the readout->analysis for each readout
    25 bool psphotReplaceAllSources (pmConfig *config, const pmFPAview *view)
     25bool psphotReplaceAllSources (pmConfig *config, const pmFPAview *view, const char *filerule)
    2626{
    2727    bool status = true;
     
    3636    // loop over the available readouts
    3737    for (int i = 0; i < num; i++) {
    38         if (!psphotReplaceAllSourcesReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
     38        if (!psphotReplaceAllSourcesReadout (config, view, filerule, i, recipe)) {
    3939            psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for PSPHOT.INPUT entry %d", i);
    4040            return false;
  • branches/eam_branches/psphot.20100506/src/psphotRoughClass.c

    r27657 r27909  
    88
    99// for now, let's store the detections on the readout->analysis for each readout
    10 bool psphotRoughClass (pmConfig *config, const pmFPAview *view)
     10bool psphotRoughClass (pmConfig *config, const pmFPAview *view, const char *filerule)
    1111{
    1212    bool status = true;
     
    2626    for (int i = 0; i < num; i++) {
    2727        if (i == chisqNum) continue; // skip chisq image
    28         if (!psphotRoughClassReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
    29             psError (PSPHOT_ERR_CONFIG, false, "failed on rough classification for PSPHOT.INPUT entry %d", i);
     28        if (!psphotRoughClassReadout (config, view, filerule, i, recipe)) {
     29            psError (PSPHOT_ERR_CONFIG, false, "failed on rough classification for %s entry %d", filerule, i);
    3030            return false;
    3131        }
     
    3434}
    3535
    36 bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) {
     36bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) {
    3737
    3838    bool status;
     
    4141
    4242    // find the currently selected readout
    43     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     43    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4444    psAssert (file, "missing file?");
    4545
  • branches/eam_branches/psphot.20100506/src/psphotSkyReplace.c

    r27657 r27909  
    11# include "psphotInternal.h"
    22
    3 bool psphotSkyReplace (pmConfig *config, const pmFPAview *view)
     3bool psphotSkyReplace (pmConfig *config, const pmFPAview *view, const char *filerule)
    44{
    55    bool status = true;
     
    1515    for (int i = 0; i < num; i++) {
    1616        if (i == chisqNum) continue; // skip chisq image
    17         if (!psphotSkyReplaceReadout (config, view, "PSPHOT.INPUT", i)) {
    18             psError (PSPHOT_ERR_CONFIG, false, "failed to replace sky for PSPHOT.INPUT entry %d", i);
     17        if (!psphotSkyReplaceReadout (config, view, filerule, i)) {
     18            psError (PSPHOT_ERR_CONFIG, false, "failed to replace sky for %s entry %d", filerule, i);
    1919            return false;
    2020        }
     
    2525// XXX make this an option?
    2626// in order to  successfully replace the sky, we must define a corresponding file...
    27 bool psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
     27bool psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
    2828
    2929    psTimerStart ("psphot.skyreplace");
    3030
    3131    // find the currently selected readout
    32     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     32    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    3333    psAssert (file, "missing file?");
    3434
  • branches/eam_branches/psphot.20100506/src/psphotSourceFreePixels.c

    r26894 r27909  
    11# include "psphotInternal.h"
    22
    3 bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view)
     3bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view, const char *filerule)
    44{
    55    bool status = true;
     
    1010    // loop over the available readouts
    1111    for (int i = 0; i < num; i++) {
    12         if (!psphotSourceFreePixelsReadout (config, view, "PSPHOT.INPUT", i)) {
    13             psError (PSPHOT_ERR_CONFIG, false, "failed to free source pixels for PSPHOT.INPUT entry %d", i);
     12        if (!psphotSourceFreePixelsReadout (config, view, filerule, i)) {
     13            psError (PSPHOT_ERR_CONFIG, false, "failed to free source pixels for %s entry %d", filerule, i);
    1414            return false;
    1515        }
     
    1818}
    1919
    20 bool psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index) {
     20bool psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
    2121
    2222    bool status;
    2323
    2424    // find the currently selected readout
    25     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     25    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    2626    psAssert (file, "missing file?");
    2727
  • branches/eam_branches/psphot.20100506/src/psphotSourceMatch.c

    r27657 r27909  
    11# include "psphotInternal.h"
    22
    3 bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, psArray *objects);
    4  
    5 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view)
     3bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects);
     4 
     5psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule)
    66{
    77    bool status = true;
     
    1414    // loop over the available readouts
    1515    for (int i = 0; i < num; i++) {
    16         if (!psphotMatchSourcesReadout (objects, config, view, "PSPHOT.INPUT", i)) {
     16        if (!psphotMatchSourcesReadout (objects, config, view, filerule, i)) {
    1717            psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i);
    1818            psFree (objects);
     
    2121    }
    2222
    23     psphotMatchSourcesGenerate (config, view, objects);
     23    psphotMatchSourcesGenerate (config, view, filerule, objects);
    2424
    2525    return objects;
    2626}
    2727
    28 bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, char *filename, int index) {
     28bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, const char *filerule, int index) {
    2929 
    3030    bool status = false;
     
    3838
    3939    // find the currently selected readout
    40     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     40    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    4141    psAssert (file, "missing file?");
    4242
     
    145145}
    146146
    147 bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, psArray *objects) {
     147bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects) {
    148148
    149149    bool status = false;
     
    167167
    168168        // find the currently selected readout
    169         pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", i); // File of interest
     169        pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest
    170170        psAssert (file, "missing file?");
    171171
  • branches/eam_branches/psphot.20100506/src/psphotSourceSize.c

    r27695 r27909  
    3333
    3434// for now, let's store the detections on the readout->analysis for each readout
    35 bool psphotSourceSize (pmConfig *config, const pmFPAview *view, bool getPSFsize)
     35bool psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize)
    3636{
    3737    bool status = true;
     
    5151    for (int i = 0; i < num; i++) {
    5252        if (i == chisqNum) continue; // skip chisq image
    53         if (!psphotSourceSizeReadout (config, view, "PSPHOT.INPUT", i, recipe, getPSFsize)) {
     53        if (!psphotSourceSizeReadout (config, view, filerule, i, recipe, getPSFsize)) {
    5454            psError (PSPHOT_ERR_CONFIG, false, "failed on source size analysis for PSPHOT.INPUT entry %d", i);
    5555            return false;
     
    6060
    6161// this function use an internal flag to mark sources which have already been measured
    62 bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool getPSFsize)
     62bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool getPSFsize)
    6363{
    6464    bool status;
     
    6868
    6969    // find the currently selected readout
    70     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     70    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    7171    psAssert (file, "missing file?");
    7272
  • branches/eam_branches/psphot.20100506/src/psphotSourceStats.c

    r27657 r27909  
    55// The new sources are added to any existing sources on detections->newSources.  The sources
    66// on detections->allSources are ignored.
    7 bool psphotSourceStats (pmConfig *config, const pmFPAview *view, bool setWindow)
     7bool psphotSourceStats (pmConfig *config, const pmFPAview *view, const char *filerule, bool setWindow)
    88{
    99    bool status = true;
     
    1818    // loop over the available readouts
    1919    for (int i = 0; i < num; i++) {
    20         if (!psphotSourceStatsReadout (config, view, "PSPHOT.INPUT", i, recipe, setWindow)) {
    21             psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);
     20        if (!psphotSourceStatsReadout (config, view, filerule, i, recipe, setWindow)) {
     21            psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for %s entry %d", filerule, i);
    2222            return false;
    2323        }
     
    2626}
    2727
    28 bool psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe, bool setWindow) {
     28bool psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool setWindow) {
    2929
    3030    bool status = false;
     
    3434
    3535    // find the currently selected readout
    36     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     36    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    3737    psAssert (file, "missing file?");
    3838
  • branches/eam_branches/psphot.20100506/src/psphotStackChisqImage.c

    r27657 r27909  
    66
    77// XXX supply filename or keep PSPHOT.INPUT fixed?
    8 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view)
     8bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *filerule)
    99{
    1010    bool status = false;
     
    2222    // loop over the available readouts
    2323    for (int i = 0; i < num; i++) {
    24         if (!psphotStackChisqImageAddReadout(config, view, &chiReadout, "PSPHOT.INPUT", i)) {
    25             psError (PSPHOT_ERR_CONFIG, false, "failed to model background for PSPHOT.INPUT entry %d", i);
     24        if (!psphotStackChisqImageAddReadout(config, view, filerule, &chiReadout, i)) {
     25            psError (PSPHOT_ERR_CONFIG, false, "failed to model background for %s entry %d", filerule, i);
    2626            return false;
    2727        }
     
    3535    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "", num);
    3636
    37     // need to save the resulting image somewhere (PSPHOT.INPUT?)
    38     if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, "PSPHOT.INPUT", PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) {
     37    // save the resulting image
     38    if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, filerule, PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) {
    3939        psError(PM_ERR_CONFIG, false, "could not add chisqFPA to config files");
    4040        return false;
     
    4848bool psphotStackChisqImageAddReadout(const pmConfig *config, // Configuration
    4949                                     const pmFPAview *view,
     50                                     const char *filerule,
    5051                                     pmReadout **chiReadout,
    51                                      char *filename,
    5252                                     int index)
    5353{
     
    5555
    5656    // find the currently selected readout
    57     pmFPAfile *input = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     57    pmFPAfile *input = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    5858    psAssert (input, "missing file?");
    5959
     
    111111}
    112112
    113 bool psphotStackRemoveChisqFromInputs (pmConfig *config) {
     113bool psphotStackRemoveChisqFromInputs (pmConfig *config, const char *filerule) {
    114114
    115115    bool status = false;
     
    121121    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
    122122
    123     pmFPAfileRemoveSingle (config->files, "PSPHOT.INPUT", chisqNum);
     123    pmFPAfileRemoveSingle (config->files, filerule, chisqNum);
    124124
    125125    inputNum --;
  • branches/eam_branches/psphot.20100506/src/psphotStackImageLoop.c

    r27888 r27909  
    5353
    5454                // XXX for now, we assume there is only a single chip in the PHU:
    55                 if (0 && !psphotStackReadout (config, view)) {
     55                if (!psphotStackReadout (config, view)) {
    5656                    psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
    5757                    psFree (view);
  • branches/eam_branches/psphot.20100506/src/psphotStackReadout.c

    r27657 r27909  
    11# include "psphotInternal.h"
     2
     3# define STACK_RAW "PSPHOT.STACK.INPUT.RAW"
     4# define STACK_OUT "PSPHOT.STACK.OUTPUT.IMAGE"
    25
    36bool psphotStackReadout (pmConfig *config, const pmFPAview *view) {
     
    1720    PS_ASSERT_PTR_NON_NULL (breakPt, false);
    1821
     22    // we have 3 relevant files: RAW, CNV, OUT
     23
    1924    // set the photcode for each image
    20     if (!psphotAddPhotcode (config, view)) {
     25    if (!psphotAddPhotcode (config, view, STACK_OUT)) {
    2126        psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");
    2227        return false;
     
    2429
    2530    // Generate the mask and weight images
    26     if (!psphotSetMaskAndVariance (config, view)) {
    27         return psphotReadoutCleanup (config, view);
     31    // XXX this should be done before we perform the convolutions
     32    if (!psphotSetMaskAndVariance (config, view, STACK_RAW)) {
     33        return psphotReadoutCleanup (config, view, STACK_OUT);
    2834    }
    2935    if (!strcasecmp (breakPt, "NOTHING")) {
    30         return psphotReadoutCleanup (config, view);
     36        return psphotReadoutCleanup (config, view, STACK_OUT);
    3137    }
    3238
    3339    // generate a background model (median, smoothed image)
    3440    // XXX I think this is not defined correctly for an array of images.
    35     if (!psphotModelBackground (config, view)) {
    36         return psphotReadoutCleanup (config, view);
     41    if (!psphotModelBackground (config, view, STACK_RAW)) {
     42        return psphotReadoutCleanup (config, view, STACK_OUT);
    3743    }
    38     if (!psphotSubtractBackground (config, view)) {
    39         return psphotReadoutCleanup (config, view);
     44    if (!psphotSubtractBackground (config, view, STACK_RAW)) {
     45        return psphotReadoutCleanup (config, view, STACK_OUT);
    4046    }
    4147    if (!strcasecmp (breakPt, "BACKMDL")) {
    42         return psphotReadoutCleanup (config, view);
     48        return psphotReadoutCleanup (config, view, STACK_OUT);
    4349    }
    4450
     
    4753    if (!psphotLoadPSF (config, view)) {
    4854        psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model");
    49         return psphotReadoutCleanup (config, view);
     55        return psphotReadoutCleanup (config, view, STACK_OUT);
    5056    }
    5157
    52     if (!psphotStackChisqImage(config, view)) {
     58    if (!psphotStackChisqImage(config, view, STACK_RAW)) {
    5359        psError (PSPHOT_ERR_UNKNOWN, false, "failure to generate chisq image");
    54         return psphotReadoutCleanup (config, view);
     60        return psphotReadoutCleanup (config, view, STACK_OUT);
    5561    }
    5662    if (!strcasecmp (breakPt, "CHISQ")) {
    57         return psphotReadoutCleanup (config, view);
     63        return psphotReadoutCleanup (config, view, STACK_OUT);
    5864    }
    5965
    6066    // find the detections (by peak and/or footprint) in the image.
    6167    // This finds the detections on Chisq image as well as the individuals
    62     if (!psphotFindDetections (config, view, true)) { // pass 1
     68    if (!psphotFindDetections (config, view, STACK_RAW, true)) { // pass 1
    6369        // this only happens if we had an error in psphotFindDetections
    6470        psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis");
    65         return psphotReadoutCleanup (config, view);
     71        return psphotReadoutCleanup (config, view, STACK_OUT);
    6672    }
    6773
    6874    // construct sources and measure basic stats (saved on detections->newSources)
    6975    // only run this on detections from the input images, not chisq image
    70     if (!psphotSourceStats (config, view, true)) { // pass 1
     76    if (!psphotSourceStats (config, view, STACK_OUT, true)) { // pass 1
    7177        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
    72         return psphotReadoutCleanup (config, view);
     78        return psphotReadoutCleanup (config, view, STACK_OUT);
    7379    }
    7480
    7581    // *** generate the objects (which unify the sources from the different images)
    76     psArray *objects = psphotMatchSources (config, view);
     82    psArray *objects = psphotMatchSources (config, view, STACK_OUT);
    7783
    7884    // construct sources for the newly-generated sources (from other images)
    79     if (!psphotSourceStats (config, view, false)) { // pass 1
     85    if (!psphotSourceStats (config, view, STACK_OUT, false)) { // pass 1
    8086        psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources");
    81         return psphotReadoutCleanup (config, view);
     87        return psphotReadoutCleanup (config, view, STACK_OUT);
    8288    }
    8389
     
    8591    // if (!psphotDeblendSatstars (config, view)) {
    8692    //     psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis");
    87     //     return psphotReadoutCleanup (config, view);
     93    //     return psphotReadoutCleanup (config, view, STACK_OUT);
    8894    // }
    8995
     
    9197    // if (!psphotBasicDeblend (config, view)) {
    9298    //     psError (PSPHOT_ERR_UNKNOWN, false, "failed on deblend analysis");
    93     //     return psphotReadoutCleanup (config, view);
     99    //     return psphotReadoutCleanup (config, view, STACK_OUT);
    94100    // }
    95101
    96102    // classify sources based on moments, brightness
    97103    // only run this on detections from the input images, not chisq image
    98     if (!psphotRoughClass (config, view)) {
     104    if (!psphotRoughClass (config, view, STACK_OUT)) {
    99105        psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough classifications");
    100         return psphotReadoutCleanup (config, view);
     106        return psphotReadoutCleanup (config, view, STACK_OUT);
    101107    }
    102108    // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources)
    103109    // only run this on detections from the input images, not chisq image
    104     if (!psphotImageQuality (config, view)) { // pass 1
     110    if (!psphotImageQuality (config, view, STACK_OUT)) { // pass 1
    105111        psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality");
    106         return psphotReadoutCleanup(config, view);
     112        return psphotReadoutCleanup (config, view, STACK_OUT);
    107113    }
    108114    if (!strcasecmp (breakPt, "MOMENTS")) {
    109         return psphotReadoutCleanup (config, view);
     115        return psphotReadoutCleanup (config, view, STACK_OUT);
    110116    }
    111117
    112118    // use bright stellar objects to measure PSF if we were supplied a PSF for any input file,
    113119    // this step is skipped
    114     if (!psphotChoosePSF (config, view)) { // pass 1
     120    if (!psphotChoosePSF (config, view, STACK_OUT)) { // pass 1
    115121        psLogMsg ("psphot", 3, "failure to construct a psf model");
    116         return psphotReadoutCleanup (config, view);
     122        return psphotReadoutCleanup (config, view, STACK_OUT);
    117123    }
    118124    if (!strcasecmp (breakPt, "PSFMODEL")) {
    119         return psphotReadoutCleanup (config, view);
     125        return psphotReadoutCleanup (config, view, STACK_OUT);
    120126    }
    121127
    122128    // include externally-supplied sources
    123129    // XXX fix this in the new multi-input context
    124     // psphotLoadExtSources (config, view); // pass 1
     130    // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1
    125131
    126132    // construct an initial model for each object, set the radius to fitRadius, set circular fit mask
    127     psphotGuessModels (config, view);
     133    psphotGuessModels (config, view, STACK_OUT);
    128134
    129135    // merge the newly selected sources into the existing list
    130136    // NOTE: merge OLD and NEW
    131     psphotMergeSources (config, view);
     137    psphotMergeSources (config, view, STACK_OUT);
    132138
    133139    // linear PSF fit to source peaks, subtract the models from the image (in PSF mask)
     
    136142
    137143    // identify CRs and extended sources
    138     psphotSourceSize (config, view, TRUE);
     144    psphotSourceSize (config, view, STACK_OUT, TRUE);
    139145
    140146    // measure aperture photometry corrections
    141     if (!psphotApResid (config, view)) {
     147    if (!psphotApResid (config, view, STACK_OUT)) {
    142148        psLogMsg ("psphot", 3, "failed on psphotApResid");
    143         return psphotReadoutCleanup (config, view);
     149        return psphotReadoutCleanup (config, view, STACK_OUT);
    144150    }
    145151
     152    psphotExtendedSourceAnalysis (config, view, STACK_OUT); // pass 1 (detections->allSources)
     153    psphotExtendedSourceFits (config, view, STACK_OUT); // pass 1 (detections->allSources)
     154
    146155    // calculate source magnitudes
    147     psphotMagnitudes(config, view);
     156    psphotMagnitudes(config, view, STACK_OUT);
    148157
    149     if (!psphotEfficiency(config, view)) {
     158    if (!psphotEfficiency(config, view, STACK_OUT)) {
    150159        psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
    151160        psErrorClear();
     
    156165
    157166    // replace background in residual image
    158     psphotSkyReplace (config, view);
     167    psphotSkyReplace (config, view, STACK_RAW);
    159168
    160169    // drop the references to the image pixels held by each source
    161     psphotSourceFreePixels (config, view);
     170    psphotSourceFreePixels (config, view, STACK_OUT);
    162171
    163172    // remove chisq image from config->file:PSPHOT.INPUT (why?)
    164     psphotStackRemoveChisqFromInputs(config);
     173    psphotStackRemoveChisqFromInputs(config, STACK_RAW);
    165174
    166175    // create the exported-metadata and free local data
    167     return psphotReadoutCleanup (config, view);
     176    return psphotReadoutCleanup (config, view, STACK_OUT);
    168177}
    169178
  • branches/eam_branches/psphot.20100506/src/psphotSubtractBackground.c

    r27657 r27909  
    44// generate the median in NxN boxes, clipping heavily
    55// linear interpolation to generate full-scale model
    6 bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe)
     6bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe)
    77{
    88    bool status = true;
     
    1313
    1414    // find the currently selected readout
    15     pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     15    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest
    1616
    1717    pmFPA *inFPA = file->fpa;
     
    124124}
    125125
    126 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view)
     126bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filerule)
    127127{
    128128    bool status = false;
     
    137137    // loop over the available readouts
    138138    for (int i = 0; i < num; i++) {
    139         if (!psphotSubtractBackgroundReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
     139        if (!psphotSubtractBackgroundReadout (config, view, filerule, i, recipe)) {
    140140            psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i);
    141141            return false;
Note: See TracChangeset for help on using the changeset viewer.