IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 27, 2006, 4:31:17 PM (20 years ago)
Author:
eugene
Message:

substantial work on the pmFPAfile,view concepts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotImageLoop.c

    r6522 r6715  
    11# include "psphot.h"
    22
    3 bool psphotImageLoop (psphotData *data, ppConfig *config) {
     3// XXX where do we load optional mask and weight input images?
    44
    5     pmFPA *fpa = data->input->fpa;
     5bool psphotImageLoop (pmConfig *config) {
    66
    7     psphotDataIO (data, config, -1, -1);
     7    bool status;
     8    pmChip *chip;
     9    pmCell *cell;
     10    pmReadout *readout;
    811
    9     for (int i = 0; i < fpa->chips->n; i++) {
    10         pmChip *chip = fpa->chips->data[i]; // Chip of interest in input image
     12    pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT");
     13    if (!status) {
     14        psErrorStackPrint(stderr, "Can't find input data!\n");
     15        exit(EXIT_FAILURE);
     16    }
    1117
    12         psLogMsg ("psphot", 4, "Chip %d: %x %x\n", i, chip->exists, chip->process);
     18    pmFPAview *view = pmFPAviewAlloc (0);
     19
     20    // files associated with the science image
     21    pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
     22
     23    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
     24        psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    1325        if (! chip->process) { continue; }
     26        if (! chip->file_exists) { continue; }
     27        pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
    1428
    15         psphotDataIO (data, config, i, -1);
    16 
    17         for (int j = 0; j < chip->cells->n; j++) {
    18             pmCell *cell = chip->cells->data[j]; // Cell of interest in input image
    19 
    20             psLogMsg ("psphot", 4, "Cell %d: %x %x\n", j, cell->exists, cell->process);
     29        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
     30            continue;
     31            psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    2132            if (! cell->process) { continue; }
    22 
    23             psphotDataIO (data, config, i, j);
    24 
    25             // XXX optional mask and weight input image should be loaded here?
    26             // this sets the weight map and basic mask applying CELL.BAD and CELL.SATURATION
    27             pmCellSetWeights(cell);
    28 
    29             // I have a valid mask, now mask in the analysis region of interest
    30             pmCellSetMask (cell, config->recipe);
     33            if (! cell->file_exists) { continue; }
     34            pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
    3135
    3236            // process each of the readouts
    33             for (int k = 0; k < cell->readouts->n; k++) {
    34                 pmReadout *readout = cell->readouts->data[k]; // Readout of interest in input image
     37            while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
     38                pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE);
     39                if (! readout->data_exists) { continue; }
    3540
    3641                // run a single-model test if desired
    37                 psphotModelTest (readout, config->arguments, config->recipe);
     42                // XXX move this to psphotReadout??
     43                // psphotModelTest (readout, recipe);
    3844
    3945                // run the actual photometry analysis
    40                 psphotReadout (readout, data, config);
     46                psphotReadout (config, view);
    4147
    42                 // XXX what do we do if we have multiple readouts?
    43                 psphotOutput (readout, data, config);
     48                pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     49
     50                // write out the desired output dataset(s)
     51                // psphotOutput (view, recipe);
    4452            }
    45         }
     53            pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     54        }
     55        pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
    4656    }
    47     psphotOutputClose (data);
     57    pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER);
     58
     59    psFree (view);
    4860    return true;
    4961}
     62
     63// I/O files related to psphot:
     64// PSPHOT.INPUT   : input image file(s)
     65// PSPHOT.RESID   : residual image
     66// PSPHOT.OUTPUT  : output object tables (object)
     67
     68// PSPHOT.BACKSUB : background subtracted image
     69// PSPHOT.BACKGND : background model (full-scale image?)
     70// PSPHOT.BACKMDL : background model (binned image?)
     71// PSPHOT.PSF     : sample PSF images
     72
     73
     74/**
     75
     76filename | pmFPAfile  | pmFPA  | pmFPAview
     77chip00.f | PSPHOT.IN  | input  | view
     78chip01.f | PSPHOT.IN  | input  | view
     79chip02.f | PSPHOT.IN  | input  | view
     80chip03.f | PSPHOT.IN  | input  | view
     81
     82out00.f  | PSPHOT.OUT | input  | view
     83out01.f  | PSPHOT.OUT | input  | view
     84out02.f  | PSPHOT.OUT | input  | view
     85out03.f  | PSPHOT.OUT | input  | view
     86
     87obj00.f  | PSPHOT.OBJ | input  | view
     88obj01.f  | PSPHOT.OBJ | input  | view
     89obj02.f  | PSPHOT.OBJ | input  | view
     90obj03.f  | PSPHOT.OBJ | input  | view
     91
     92bin00.f  | PSPHOT.BIN | binned | view
     93bin01.f  | PSPHOT.BIN | binned | view
     94bin02.f  | PSPHOT.BIN | binned | view
     95bin03.f  | PSPHOT.BIN | binned | view
     96
     97mosaic.f | PSPHOT.MOS | mosaic | view
     98
     99**/
Note: See TracChangeset for help on using the changeset viewer.