IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26662


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

add option to save the expanded background model file

Location:
trunk/ppbgrestore/src
Files:
3 edited

Legend:

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

    r25973 r26662  
    88pmConfig *ppbgrestoreArguments(int argc, char *argv[])
    99{
     10    int argnum;
    1011    if (argc == 1) {
    1112        usage();
     
    3233        usage();
    3334    }
     35
     36    if ((argnum = psArgumentGet(argc, argv, "-savebg"))) {
     37        psArgumentRemove(argnum, &argc, argv);
     38        psMetadataAddBool(config->arguments, PS_LIST_TAIL, "SAVE_BACKGROUND", 0, "save background innmage", true);
     39    }
     40
    3441    if (argc != 2) usage ();
    3542
  • 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
  • trunk/ppbgrestore/src/ppbgrestoreParseCamera.c

    r25972 r26662  
    2323    pmFPAfile *outImage = pmFPAfileDefineOutput(config, input->fpa, "PPBGRESTORE.OUTPUT");
    2424    if (!outImage) {
    25         psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.OUTPUT"));
     25        psError(PS_ERR_IO, false, _("Unable to generate output file from PPBGRESTORE.OUTPUT"));
     26        psFree(options);
     27        return NULL;
     28    }
     29    pmFPAfile *outBG = pmFPAfileDefineOutput(config, input->fpa, "PPBGRESTORE.BACKGROUND");
     30    if (!outBG) {
     31        psError(PS_ERR_IO, false, _("Unable to generate bacgkround file from PPBGRESTORE.BACKGROUND"));
    2632        psFree(options);
    2733        return NULL;
Note: See TracChangeset for help on using the changeset viewer.