IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 5, 2006, 2:02:35 PM (20 years ago)
Author:
eugene
Message:

working on file I/O modifications

File:
1 edited

Legend:

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

    r6379 r6522  
    11# include "psphot.h"
    22
    3 bool psphotImageLoop (ppFile *file, ppConfig *config) {
     3bool psphotImageLoop (psphotData *data, ppConfig *config) {
    44
    5     bool status;
    6     ppImageLoadDepth imageLoadDepth;
     5    pmFPA *fpa = data->input->fpa;
    76
    8     // determine the load depth
    9     const char *depth = psMetadataLookupStr(&status, config->recipe, "LOAD.DEPTH");
    10     if (! status || ! depth || strlen(depth) == 0) {
    11         psLogMsg("psphot", PS_LOG_ERROR, "LOAD.DEPTH not specified in recipe.");
    12         exit(EXIT_FAILURE);
    13     }
    14     imageLoadDepth = PP_LOAD_NONE;
    15     if (!strcasecmp(depth, "FPA")) imageLoadDepth = PP_LOAD_FPA;
    16     if (!strcasecmp(depth, "CHIP")) imageLoadDepth = PP_LOAD_CHIP;
    17     if (!strcasecmp(depth, "CELL")) imageLoadDepth = PP_LOAD_CELL;
    18     if (imageLoadDepth == PP_LOAD_NONE) {
    19         psLogMsg(__func__, PS_LOG_ERROR, "LOAD.DEPTH in recipe is not FPA, CHIP or CELL.");
    20         exit(EXIT_FAILURE);
    21     }
     7    psphotDataIO (data, config, -1, -1);
    228
    23     if (imageLoadDepth == PP_LOAD_FPA) {
    24         psTrace(__func__, 1, "Loading pixels for FPA...\n");
    25         ppImageLoadPixels(file, config->database, -1, -1);
    26     }
    27 
    28     for (int i = 0; i < file->fpa->chips->n; i++) {
    29         pmChip *chip = file->fpa->chips->data[i]; // Chip of interest in input image
     9    for (int i = 0; i < fpa->chips->n; i++) {
     10        pmChip *chip = fpa->chips->data[i]; // Chip of interest in input image
    3011
    3112        psLogMsg ("psphot", 4, "Chip %d: %x %x\n", i, chip->exists, chip->process);
    3213        if (! chip->process) { continue; }
    3314
    34         if (imageLoadDepth == PP_LOAD_CHIP) {
    35             psTrace(__func__, 1, "Loading pixels for chip %d...\n", i);
    36             ppImageLoadPixels(file, config->database, i, -1);
    37         }
     15        psphotDataIO (data, config, i, -1);
    3816
    3917        for (int j = 0; j < chip->cells->n; j++) {
     
    4321            if (! cell->process) { continue; }
    4422
    45             if (imageLoadDepth == PP_LOAD_CELL) {
    46                 psTrace(__func__, 1, "Loading pixels for chip %d, cell %d...\n", i, j);
    47                 ppImageLoadPixels(file, config->database, i, j);
    48             }
    49            
     23            psphotDataIO (data, config, i, j);
     24
    5025            // XXX optional mask and weight input image should be loaded here?
    5126            // this sets the weight map and basic mask applying CELL.BAD and CELL.SATURATION
     
    6136                // run a single-model test if desired
    6237                psphotModelTest (readout, config->arguments, config->recipe);
    63                 psphotReadout (readout, config->recipe);
    64                 psphotOutput (readout, config->arguments);
     38
     39                // run the actual photometry analysis
     40                psphotReadout (readout, data, config);
     41
     42                // XXX what do we do if we have multiple readouts?
     43                psphotOutput (readout, data, config);
    6544            }
    6645        }
    6746    }
     47    psphotOutputClose (data);
    6848    return true;
    6949}
Note: See TracChangeset for help on using the changeset viewer.