IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26643


Ignore:
Timestamp:
Jan 20, 2010, 12:59:49 PM (16 years ago)
Author:
eugene
Message:

updating code so more functions can handle the multi-input concept

Location:
branches/eam_branches/psphot.stack.20100120
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psphot.stack.20100120/doc/stack.txt

    r26542 r26643  
     1
     220100120 : more stack processing mods:
     3
     4  there are a number of data collections generated during psphotReadout:
     5
     6  * detections (currently a structure containing multiple arrays)
     7  * sources (a psArray)
     8  * psf (the psf model structure)
     9 
     10  * new sources vs old sources:
     11    there is a sequence on the second pass in which we need to distinguish the sources
     12    from the first pass from those on the second pass:
     13
     14    - add noise (old sources only)
     15    - find detections
     16    - subtract noise (old sources only)
     17    - generate sources (new detections only)
     18    - source classifications (new sources only)
     19    - guess models (new sources only)
     20    - replace sources (old sources only)
     21    - merge sources (new + old -> sources)
     22
     23    currently we are distiguishing the old vs new based on different arrays.
     24    can we use the processing flags to distinguish the these cases and carry around
     25    only a single source list?
    126
    22720100107 : updates for stack processing
  • branches/eam_branches/psphot.stack.20100120/src/psphotBasicDeblend.c

    r20453 r26643  
    11# include "psphotInternal.h"
    22
    3 bool psphotBasicDeblend (psArray *sources, psMetadata *recipe) {
     3bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
    44
    55    int N;
     
    88    pmSource *source, *testSource;
    99
     10    psTimerStart ("psphot.deblend.basic");
     11
    1012    int Nblend = 0;
    1113
    12     psTimerStart ("psphot.deblend.basic");
     14    // find the currently selected readout
     15    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     16    psAssert (readout, "missing file?");
     17
     18    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     19    psAssert (readout, "missing readout?");
     20
     21    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     22    psAssert (sources, "missing sources?");
     23
     24    // select the appropriate recipe information
     25    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     26    psAssert (recipe, "missing recipe?");
    1327
    1428    float FRACTION = psMetadataLookupF32 (&status, recipe, "DEBLEND_PEAK_FRACTION");
     
    128142    return true;
    129143}
     144
     145// for now, let's store the detections on the readout->analysis for each readout
     146bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view)
     147{
     148    bool status = true;
     149
     150    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     151    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     152
     153    // loop over the available readouts
     154    for (int i = 0; i < num; i++) {
     155        if (!psphotBasicDeblendReadout (config, view, "PSPHOT.INPUT", i)) {
     156            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
     157            return false;
     158        }
     159    }
     160    return true;
     161}
  • branches/eam_branches/psphot.stack.20100120/src/psphotChoosePSF.c

    r26262 r26643  
    22
    33// try PSF models and select best option
    4 pmPSF *psphotChoosePSF (pmReadout *readout, psArray *sources, psMetadata *recipe) {
     4bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
    55
    66    bool status;
    77
    88    psTimerStart ("psphot.choose.psf");
     9
     10    // find the currently selected readout
     11    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     12    psAssert (readout, "missing file?");
     13
     14    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     15    psAssert (readout, "missing readout?");
     16
     17    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     18    psAssert (sources, "missing sources?");
     19
     20    // select the appropriate recipe information
     21    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     22    psAssert (recipe, "missing recipe?");
    923
    1024    // bit-masks to test for good/bad pixels
    1125    psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT");
    12     assert (maskVal);
     26    psAssert (maskVal, "missing mask value?");
    1327
    1428    // bit-mask to mark pixels not used in analysis
    1529    psImageMaskType markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT");
    16     assert (markVal);
     30    psAssert (markVal, "missing mark value?");
    1731
    1832    // maskVal is used to test for rejected pixels, and must include markVal
     
    302316
    303317    psFree (options);
    304     return (psf);
     318
     319    // save PSF on readout->analysis
     320    if (!psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_PTR, "psphot psf model", psf)) {
     321        psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");
     322        return false;
     323    }
     324
     325    return true;
    305326}
    306327
     
    445466    return true;
    446467}
     468
     469// for now, let's store the detections on the readout->analysis for each readout
     470bool psphotChoosePSF (pmConfig *config, const pmFPAview *view)
     471{
     472    bool status = true;
     473
     474    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     475    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     476
     477    // loop over the available readouts
     478    for (int i = 0; i < num; i++) {
     479        if (!psphotChoosePSFReadout (config, view, "PSPHOT.INPUT", i, havePSF)) {
     480            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
     481            return false;
     482        }
     483    }
     484    return true;
     485}
  • branches/eam_branches/psphot.stack.20100120/src/psphotDeblendSatstars.c

    r25885 r26643  
    11# include "psphotInternal.h"
    22
    3 bool psphotDeblendSatstars (pmReadout *readout, psArray *sources, psMetadata *recipe) {
     3bool psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
    44
    55    int N;
     
    1010    int Nblend = 0;
    1111    float SAT_MIN_RADIUS = 5.0;
     12
     13    // find the currently selected readout
     14    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     15    psAssert (readout, "missing file?");
     16
     17    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     18    psAssert (readout, "missing readout?");
     19
     20    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     21    psAssert (sources, "missing sources?");
     22
     23    // select the appropriate recipe information
     24    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     25    psAssert (recipe, "missing recipe?");
    1226
    1327    bool status;
     
    169183    return true;
    170184}
     185
     186// for now, let's store the detections on the readout->analysis for each readout
     187bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view)
     188{
     189    bool status = true;
     190
     191    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     192    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     193
     194    // loop over the available readouts
     195    for (int i = 0; i < num; i++) {
     196        if (!psphotDeblendSatstarsReadout (config, view, "PSPHOT.INPUT", i)) {
     197            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
     198            return false;
     199        }
     200    }
     201    return true;
     202}
  • branches/eam_branches/psphot.stack.20100120/src/psphotFindDetections.c

    r26634 r26643  
    22
    33// smooth the image, search for peaks, optionally define footprints based on the peaks
    4 pmDetections *psphotFindDetections (pmDetections *detections, pmReadout *readout, psMetadata *recipe) {
     4bool psphotFindDetections (pmConfig *config, const pmFPAview *view, const char *filename, int index) {
    55
    66    bool status;
     
    99    int NMAX = 0;
    1010
     11    // find the currently selected readout
     12    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     13    psAssert (readout, "missing file?");
     14
     15    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     16    psAssert (readout, "missing readout?");
     17
     18    // select the appropriate recipe information
     19    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     20    psAssert (recipe, "missing recipe?");
     21
    1122    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
    1223    psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
    13     assert (maskVal);
     24    psAssert (maskVal, "missing mask value?");
    1425
    1526    // Use the new pmFootprints approach?
     
    7182    psphotVisualShowFootprints (detections);
    7283
    73     return detections;
     84    // save detections on the readout->analysis
     85    if (!psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_PTR, "psphot detectinos", detections)) {
     86        psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout");
     87        return NULL;
     88    }
     89
     90    return true;
    7491}
    7592
     
    7794// otherwise it only contains the new peaks.
    7895
    79 # if 0
    80 // XXX where do we place the N sets of detections?
     96// for now, let's store the detections on the readout->analysis for each readout
    8197bool psphotFindDetections (pmConfig *config, const pmFPAview *view)
    8298{
     
    84100
    85101    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
    86     psAbort (!status, "programming error: must define PSPHOT.INPUT.NUM");
     102    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
    87103
    88104    // loop over the available readouts
    89105    for (int i = 0; i < num; i++) {
    90106        if (!psphotFindDetectionsReadout (config, view, "PSPHOT.INPUT", i)) {
    91             psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i);
     107            psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);
    92108            return false;
    93109        }
     
    95111    return true;
    96112}
    97 # endif
  • branches/eam_branches/psphot.stack.20100120/src/psphotReadout.c

    r26596 r26643  
    4848
    4949    // display the image, weight, mask (ch 1,2,3)
     50    // XXX move this into the loop above
    5051    psphotVisualShowImage (readout);
    5152
     
    6263
    6364    // display the backsub and backgnd images
     65    // move this inthe the subtract background loop
    6466    psphotVisualShowBackground (config, view, readout);
    6567
     
    7476
    7577    // find the detections (by peak and/or footprint) in the image.
    76     pmDetections *detections = psphotFindDetections (NULL, readout, recipe);
    77     if (!detections) {
     78    if (!psphotFindDetections (config, view)) {
    7879        // this only happens if we had an error in psphotFindDetections
    7980        psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis");
     
    8687
    8788    // construct sources and measure basic stats
    88     psArray *sources = psphotSourceStats (config, readout, detections, true);
    89     if (!sources) return false;
     89    if (!psphotSourceStats (config, view, true)) {
     90        // XXX do I need to raise an error here?
     91        return false;
     92    }
    9093    if (!strcasecmp (breakPt, "PEAKS")) {
    9194        return psphotReadoutCleanup(config, readout, recipe, detections, psf, sources);
     
    9497    // find blended neighbors of very saturated stars
    9598    // XXX merge this with Basic Deblend?
    96     psphotDeblendSatstars (readout, sources, recipe);
     99    if (!psphotDeblendSatstars (config, view)) {
     100        psLogMsg ("psphot", 3, "failed on satstar deblend analysis");
     101        return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
     102    }
    97103
    98104    // mark blended peaks PS_SOURCE_BLEND
    99     if (!psphotBasicDeblend (sources, recipe)) {
     105    if (!psphotBasicDeblend (config, view)) {
    100106        psLogMsg ("psphot", 3, "failed on deblend analysis");
    101107        return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
     
    103109
    104110    // classify sources based on moments, brightness
    105     if (!psphotRoughClass (readout, sources, recipe, havePSF)) {
     111    if (!psphotRoughClass (config, view, havePSF)) {
    106112        psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
    107113        return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
     
    121127        // XXX if we do not have enough stars to generate the PSF, build one
    122128        // from the SEEING guess and model class
    123         psf = psphotChoosePSF (readout, sources, recipe);
    124         if (psf == NULL) {
     129        if (!psphotChoosePSF (config, view)) {
    125130            psLogMsg ("psphot", 3, "failure to construct a psf model");
    126131            return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
     
    131136        return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
    132137    }
     138    // move into psphotChoosePSF
    133139    psphotVisualShowPSFModel (readout, psf);
    134140
     
    147153
    148154    // identify CRs and extended sources
    149     psphotSourceSize (config, readout, sources, recipe, psf, 0);
     155    psphotSourceSize (config, view);
    150156    if (!strcasecmp (breakPt, "ENSEMBLE")) {
    151157        goto finish;
     
    182188
    183189    // set source type
    184     if (!psphotRoughClass (readout, newSources, recipe, havePSF)) {
     190    if (!psphotRoughClass (config, view, havePSF)) {
    185191        psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");
    186192        return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);
     
    203209
    204210    // measure source size for the remaining sources
    205     psphotSourceSize (config, readout, sources, recipe, psf, 0);
     211    psphotSourceSize (config, view);
    206212
    207213    psphotExtendedSourceAnalysis (readout, sources, recipe);
  • branches/eam_branches/psphot.stack.20100120/src/psphotReadoutCleanup.c

    r24203 r26643  
    6161    // save the results of the analysis
    6262    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER",  PS_DATA_METADATA, "header stats", header);
    63     if (sources) {
    64         psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources);
    65     }
     63
    6664    if (psf) {
    6765        // save the psf for possible output.  if there was already an entry, it was loaded from external sources
  • branches/eam_branches/psphot.stack.20100120/src/psphotRoughClass.c

    r25989 r26643  
    1010
    1111// 2006.02.02 : no leaks
    12 bool psphotRoughClass (pmReadout *readout, psArray *sources, psMetadata *recipe, const bool havePSF) {
     12bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, const bool havePSF) {
    1313
    1414    bool status;
    1515
    1616    psTimerStart ("psphot.rough");
     17
     18    // find the currently selected readout
     19    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     20    psAssert (readout, "missing file?");
     21
     22    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     23    psAssert (readout, "missing readout?");
     24
     25    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     26    psAssert (sources, "missing sources?");
     27
     28    // select the appropriate recipe information
     29    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     30    psAssert (recipe, "missing recipe?");
    1731
    1832    // we make this measurement on a NxM grid of regions across the readout
     
    111125    return true;
    112126}
     127
     128// for now, let's store the detections on the readout->analysis for each readout
     129bool psphotRoughClass (pmConfig *config, const pmFPAview *view, const bool havePSF)
     130{
     131    bool status = true;
     132
     133    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     134    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     135
     136    // loop over the available readouts
     137    for (int i = 0; i < num; i++) {
     138        if (!psphotRoughClassReadout (config, view, "PSPHOT.INPUT", i, havePSF)) {
     139            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
     140            return false;
     141        }
     142    }
     143    return true;
     144}
  • branches/eam_branches/psphot.stack.20100120/src/psphotSourceSize.c

    r26508 r26643  
    2828// deviation from the psf model at the r = FWHM/2 position
    2929
     30// for now, let's store the detections on the readout->analysis for each readout
     31bool psphotSourceSize (pmConfig *config, const pmFPAview *view)
     32{
     33    bool status = true;
     34
     35    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     36    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     37
     38    // loop over the available readouts
     39    for (int i = 0; i < num; i++) {
     40        if (!psphotSourceSizeReadout (config, view, "PSPHOT.INPUT", i)) {
     41            psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);
     42            return false;
     43        }
     44    }
     45    return true;
     46}
     47
    3048// XXX use an internal flag to mark sources which have already been measured
    31 bool psphotSourceSize(pmConfig *config, pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, long first)
     49// how to track the sources already measured?
     50bool psphotSourceSize(pmConfig *config, const pmFPAview *view, const char *filename, int index)
    3251{
    3352    bool status;
     
    3554
    3655    psTimerStart ("psphot.size");
     56
     57    // find the currently selected readout
     58    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     59    psAssert (readout, "missing file?");
     60
     61    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     62    psAssert (readout, "missing readout?");
     63
     64    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     65    psAssert (sources, "missing sources?");
     66
     67    pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
     68    psAssert (psf, "missing psf?");
     69
     70    // select the appropriate recipe information
     71    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     72    psAssert (recipe, "missing recipe?");
    3773
    3874    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
  • branches/eam_branches/psphot.stack.20100120/src/psphotSourceStats.c

    r26596 r26643  
    33bool psphotSetMomentsWindow (psMetadata *recipe, psMetadata *analysis, psArray *sources);
    44
    5 psArray *psphotSourceStats (pmConfig *config, pmReadout *readout, pmDetections *detections, bool setWindow) {
     5bool psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, bool setWindow) {
    66
    77    bool status = false;
     
    1010    psTimerStart ("psphot.stats");
    1111
     12    // find the currently selected readout
     13    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     14    psAssert (readout, "missing file?");
     15
     16    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     17    psAssert (readout, "missing readout?");
     18
     19    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     20    psAssert (detections, "missing detections?");
     21
    1222    // select the appropriate recipe information
    1323    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    14     assert (recipe);
     24    psAssert (recipe, "missing recipe?");
    1525
    1626    // determine the number of allowed threads
     
    2131
    2232    // determine properties (sky, moments) of initial sources
    23     float OUTER    = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS");
    24     if (!status) return NULL;
    25 
     33    float OUTER = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS");
     34    psAssert (status, "missing SKY_OUTER_RADIUS in recipe?");
     35
     36    // XXX this seems like an arbitrary number...
    2637    OUTER = PS_MAX(OUTER, 20.0); // XXX Guarantee that we can encompass the max moments radius
    2738
    2839    char *breakPt  = psMetadataLookupStr (&status, recipe, "BREAK_POINT");
    29     if (!status) return NULL;
     40    if (!status) return false;
    3041
    3142    psArray *peaks = detections->peaks;
    3243    if (!peaks) {
    3344        psError(PS_ERR_UNEXPECTED_NULL, false, "No peaks found!");
    34         return NULL;
     45        return false;
    3546    }
    3647
     
    6475        psLogMsg ("psphot", PS_LOG_INFO, "break point PEAKS, skipping MOMENTS\n");
    6576        psphotVisualShowMoments (sources);
    66         return sources;
     77        // save sources on the readout->analysis
     78        if (!psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources)) {
     79            psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");
     80            psFree(sources);
     81            return false;
     82        }
     83        psFree(sources);
     84        return true;
    6785    }
    6886
     
    7088        if (!psphotSetMomentsWindow(recipe, readout->analysis, sources)) {
    7189            psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!");
    72             return NULL;
     90            psFree(sources);
     91            return false;
    7392        }
    7493    }
     
    103122                psError(PS_ERR_UNKNOWN, false, "Unable to launch thread job PSPHOT_SOURCE_STATS");
    104123                psFree (job);
    105                 return NULL;
     124                psFree(sources);
     125                return false;
    106126            }
    107127            psFree(job);
     
    111131        if (!psThreadPoolWait (false)) {
    112132            psError(PS_ERR_UNKNOWN, false, "Failure in thread job PSPHOT_SOURCE_STATS");
    113             return NULL;
     133            psFree(sources);
     134            return false;
    114135        }
    115136
     
    138159    psphotVisualShowMoments (sources);
    139160
    140     return (sources);
     161    // save sources on the readout->analysis
     162    if (!psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources)) {
     163        psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");
     164        psFree(sources);
     165        return false;
     166    }
     167    psFree(sources);
     168    return true;
    141169}
    142170
     171// XXX fix the return status of this function...
    143172bool psphotSourceStatsUpdate (psArray *sources, pmConfig *config, pmReadout *readout) {
    144173
     
    451480    return true;
    452481}
     482
     483
     484// if we use the footprints, the output peaks list contains both old and new peaks,
     485// otherwise it only contains the new peaks.
     486
     487// for now, let's store the detections on the readout->analysis for each readout
     488bool psphotSourceStats (pmConfig *config, const pmFPAview *view, bool setWindow)
     489{
     490    bool status = true;
     491
     492    int num = psMetadataAddS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     493    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     494
     495    // loop over the available readouts
     496    for (int i = 0; i < num; i++) {
     497        if (!psphotFindDetectionsReadout (config, view, "PSPHOT.INPUT", i, setWindow)) {
     498            psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);
     499            return false;
     500        }
     501    }
     502    return true;
     503}
Note: See TracChangeset for help on using the changeset viewer.