IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 22, 2010, 2:02:53 AM (16 years ago)
Author:
bills
Message:

add option to save the expanded background model file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppbgrestore/src/ppbgrestoreLoop.c

    r25974 r26662  
    3030        exit(PS_EXIT_PROG_ERROR);
    3131    }
     32    pmFPAfile *background= psMetadataLookupPtr(&status, config->files, "PPBGRESTORE.BACKGROUND");
     33    if (!status) {
     34        psErrorStackPrint(stderr, "Can't find output data!\n");
     35        ppbgrestoreCleanup(config, options);
     36        exit(PS_EXIT_PROG_ERROR);
     37    }
     38    bool save_background = psMetadataLookupBool(&status, config->arguments, "SAVE_BACKGROUND");
    3239
    3340    pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest
     
    9097        }
    9198        output->save = true;
     99        background->save = save_background;
    92100
    93101        psImageBinning *binning = psphotBackgroundBinning(image, config);
     
    96104            return false;
    97105        }
    98         pmReadout *background = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKGND", image->numCols, image->numRows, PS_TYPE_F32);
     106        pmReadout *backgroundRO = pmFPAviewThisReadout(&roView, background->fpa);
     107//        pmReadout *backgroundRO = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKGND", image->numCols, image->numRows, PS_TYPE_F32);
     108        backgroundRO->image = psImageAlloc(image->numCols, image->numRows, PS_TYPE_F32);
    99109
    100110        // linear interpolation to full-scale
    101         if (!psImageUnbin (background->image, modelRO->image, binning)) {
     111        if (!psImageUnbin (backgroundRO->image, modelRO->image, binning)) {
    102112            psError (PSPHOT_ERR_PROG, true, "inconsistent sizes for unbinning");
    103113            psFree(binning);
     
    105115        }
    106116        psFree(binning);
    107         psF32 **backData = background->image->data.F32;
     117        psF32 **backData = backgroundRO->image->data.F32;
    108118
    109         // Do the background subtraction
     119        // Undo the background subtraction
    110120        int numCols = image->numCols, numRows = image->numRows; // Size of image
    111121        long nancount = 0;
     
    137147            psWarning("%ld infinite pixels found in background %ld pixels were finite\n", nancount, finitecount);
    138148        }
    139         pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND");
     149//        pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND");
    140150
    141151        // Close chip
Note: See TracChangeset for help on using the changeset viewer.