IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 21, 2006, 12:51:48 PM (20 years ago)
Author:
eugene
Message:

various fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImagePhotom.c

    r7592 r7621  
    2424    pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT");
    2525    if (!status) {
    26 
    2726        // psphotReadout requires a pmFPAfile supplied with the name PSPHOT.INPUT
    28         // create a pmFPAfile which points at PPIMAGE.OUTPUT
     27        // create a pmFPAfile which points to PPIMAGE.OUTPUT.CHIP (guaranteed to be mosaiced by chip)
    2928        // mode is 'REFERENCE' to prevent double frees of the fpa
    30         pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PPIMAGE.OUTPUT");
     29        pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PPIMAGE.OUTPUT.CHIP");
    3130        input = pmFPAfileDefineInput (config, output->fpa, "PSPHOT.INPUT");
    3231        input->mode = PM_FPA_MODE_REFERENCE;
    3332
    3433        pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT");
    35 
    36         // supply the output name (from cmd-line) to all output (WRITE) files
    37         // XXX does this cause trouble with existing files?
    38         char *outname = psMetadataLookupPtr(&status, config->arguments, "OUTPUT");
    39         pmFPAfileAddFileNames (config->files, "OUTPUT", outname, PM_FPA_MODE_WRITE);
    4034    }
    4135
    42     // XXX add the option output files here
     36    // optionally save the residual image
     37    if (psMetadataLookupBool(NULL, recipe, "SAVE.RESID")) {
     38        pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.RESID");
     39    }
    4340
    44     // int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");
    45     // int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");
     41    int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");
     42    int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");
    4643
    47     // we only was to operate on PSPHOT pmFPAfiles here:
    48     pmFPAfileActivate (config->files, false, NULL);
    49     pmFPAfileActivate (config->files, true, "PSPHOT.INPUT");
    50     pmFPAfileActivate (config->files, true, "PSPHOT.RESID");
    51     pmFPAfileActivate (config->files, true, "PSPHOT.OUTPUT");
     44    // these calls construct a new fpa for the I/O handle
    5245
    53     pmFPAfileActivate (config->files, true, "PSPHOT.BACKSUB");
    54     pmFPAfileActivate (config->files, true, "PSPHOT.BACKGND");
    55     pmFPAfileActivate (config->files, true, "PSPHOT.BACKMDL");
     46    // optionally save the background model (small FITS image)
     47    if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKMDL")) {
     48        pmFPAfileDefineFromFPA (config, input->fpa, DX, DY, "PSPHOT.BACKMDL");
     49    }
     50    // optionally save the full background image
     51    if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKGND")) {
     52        pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKGND");
     53    }
     54    // optionally save the background-subtracted image
     55    if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKSUB")) {
     56        pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKSUB");
     57    }
     58    // optionally save the PSF Model
     59    if (psMetadataLookupBool(NULL, recipe, "SAVE.PSF")) {
     60        pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.PSF.SAVE");
     61    }
     62    // optionally load the PSF Model
     63    if (psMetadataLookupBool(NULL, recipe, "LOAD.PSF")) {
     64        pmFPAfileDefineInput (config, input->fpa, "PSPHOT.PSF.LOAD");
     65    }
    5666
     67    // XXX not tested (or defined?)
     68    // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE");
    5769
     70    // view->cell = -1;
    5871    // iterate over the cells in the current chip
    59     // view->cell = -1;
    60 
    6172    while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    6273        psLogMsg ("ppImagePhot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    6374        if (! cell->process || ! cell->file_exists) { continue; }
    64         pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
    6575
    6676        // process each of the readouts
    6777        while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
    68             pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
    6978            if (! readout->data_exists) { continue; }
    7079
    7180            // run the actual photometry analysis
    7281            psphotReadout (config, view);
     82        }
     83    }
     84    return true;
     85}
    7386
    74             pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
    75         }
    76         pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
    77     }
     87    // we only want to operate on PSPHOT pmFPAfiles here:
     88    // XXX is this necessary?  why invoke I/O during this function?
     89    // the psphot constructed files, if chosen, will be saved at the chip level
     90    // in the next call outside of this function.
     91    // XXX there could be an issue if those files are set for 'cell' or 'readout'
     92    // pmFPAfileActivate (config->files, false, NULL);
     93    // pmFPAfileActivate (config->files, true, "PSPHOT.INPUT");
     94    // pmFPAfileActivate (config->files, true, "PSPHOT.RESID");
     95    // pmFPAfileActivate (config->files, true, "PSPHOT.OUTPUT");
     96    // pmFPAfileActivate (config->files, true, "PSPHOT.BACKSUB");
     97    // pmFPAfileActivate (config->files, true, "PSPHOT.BACKGND");
     98    // pmFPAfileActivate (config->files, true, "PSPHOT.BACKMDL");
     99
     100
    78101
    79102    // de-activate the PSPHOT image files, activate the PPIMAGE ones
     103    # if 0
    80104    pmFPAfileActivate (config->files, false, NULL);
    81105    pmFPAfileActivate (config->files, true, "PPIMAGE.INPUT");
     
    85109    pmFPAfileActivate (config->files, true, "PPIMAGE.FLAT");
    86110    pmFPAfileActivate (config->files, true, "PPIMAGE.OUTPUT");
    87 
    88111    pmFPAfileActivate (config->files, true, "PPIMAGE.BIN1");
    89112    pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG1");
    90113    pmFPAfileActivate (config->files, true, "PPIMAGE.BIN2");
    91114    pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG2");
     115    # endif
    92116
    93     return true;
    94 }
Note: See TracChangeset for help on using the changeset viewer.