IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 7:36:29 PM (16 years ago)
Author:
eugene
Message:

updates from eam_branches/20091201 (substantially changes to the psphotReadout APIs to support future stack photometry; improvements to the CR masking code)

File:
1 edited

Legend:

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

    r23287 r26894  
    44// generate the median in NxN boxes, clipping heavily
    55// linear interpolation to generate full-scale model
    6 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filename)
     6bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe)
    77{
    88    bool status = true;
     
    1313
    1414    // find the currently selected readout
    15     pmFPAfile *file = psMetadataLookupPtr (&status, config->files, filename);
     15    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest
     16
    1617    pmFPA *inFPA = file->fpa;
    1718    pmReadout *readout = pmFPAviewThisReadout (view, inFPA);
     
    1920    psImage *mask  = readout->mask;
    2021
    21     // find the currently selected readout
    22     pmReadout *model = pmFPAfileThisReadout (config->files, view, "PSPHOT.BACKMDL");
     22    // find the currently selected readout (XXX note that the model is saved on PSPHOT.BACKMDL regardless of 'filename'
     23    pmFPAfile *modelFile = pmFPAfileSelectSingle(config->files, "PSPHOT.BACKMDL", index); // File of interest
     24    assert (modelFile);
     25    pmReadout *model = pmFPAviewThisReadout (view, modelFile->fpa);
    2326    assert (model);
    24 
    25     // select the appropriate recipe information
    26     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    27     assert (recipe);
    2827
    2928    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
     
    3534
    3635    // select background pixels, from output background file, or create
     36    // XXX for now, we will only allow a single background image to be generated
    3737    file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKGND");
    3838    if (file) {
     
    6666
    6767    // back-sub image pixels, from output background file (don't create if not requested)
     68    // XXX for now, we will only allow a single background-subtracted image to be generated
    6869    file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKSUB");
    6970    if (file) {
     
    109110    // the pmReadout selected in this function are all view on entries in config->files
    110111
     112    // display the backsub and backgnd images
     113    // move this inthe the subtract background loop
     114    psphotVisualShowBackground (config, view, readout);
     115
    111116    npass ++;
    112117    return true;
    113118}
     119
     120bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view)
     121{
     122    bool status = false;
     123
     124    // select the appropriate recipe information
     125    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     126    psAssert (recipe, "missing recipe?");
     127
     128    int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
     129    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
     130
     131    // loop over the available readouts
     132    for (int i = 0; i < num; i++) {
     133        if (!psphotSubtractBackgroundReadout (config, view, "PSPHOT.INPUT", i, recipe)) {
     134            psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i);
     135            return false;
     136        }
     137    }
     138    return true;
     139}
Note: See TracChangeset for help on using the changeset viewer.