IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24485


Ignore:
Timestamp:
Jun 18, 2009, 10:42:06 AM (17 years ago)
Author:
eugene
Message:

adding noise map to variance generation; adding options to supply the noiseMap

Location:
trunk/ppImage/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImage.h

    r24229 r24485  
    3131    bool doNonLin;                      // Non-linearity correction
    3232    bool doOverscan;                    // Overscan subtraction
     33    bool doNoiseMap;                    // Bias subtraction
    3334    bool doBias;                        // Bias subtraction
    3435    bool doDark;                        // Dark subtraction
  • trunk/ppImage/src/ppImageArguments.c

    r23268 r24485  
    1717    fprintf(stderr, "\n");
    1818    fprintf(stderr, "Input options (single file / file list):\n");
     19    fprintf(stderr, "\t-noisemap/-noisemaplist: Noise Map image.\n");
    1920    fprintf(stderr, "\t-bias/-biaslist: Bias image.\n");
    2021    fprintf(stderr, "\t-dark/-darklist: Dark image.\n");
     
    112113    // if these command-line options are supplied, load the file name lists into config->arguments
    113114    // override any configuration-specified source for these files
     115    pmConfigFileSetsMD (config->arguments, &argc, argv, "NOISEMAP", "-noisemap", "-noisemaplist");
    114116    pmConfigFileSetsMD (config->arguments, &argc, argv, "BIAS", "-bias", "-biaslist");
    115117    pmConfigFileSetsMD (config->arguments, &argc, argv, "DARK", "-dark", "-darklist");
  • trunk/ppImage/src/ppImageDetrendFree.c

    r20774 r24485  
    88static char *detrendTypes[] = {
    99    "PPIMAGE.MASK",
     10    "PPIMAGE.NOISEMAP",
    1011    "PPIMAGE.BIAS",
    1112    "PPIMAGE.DARK",
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r24079 r24485  
    6464    if (options->doVarianceBuild) {
    6565        // create the target mask and variance images
    66         pmReadoutGenerateVariance(input, true);
     66        psImage *noiseImage = NULL;
     67        if (options->doNoiseMap) {
     68            // XXX convert the noiseMap image to a binned image
     69            pmReadout *noiseMap = NULL;
     70            noiseMap = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.NOISEMAP");
     71            noiseImage = psImageCopy (NULL, input->image, PS_TYPE_F32);
     72            psImageInit (noiseImage, 0.0);
     73
     74            // XXX this works, but is not really quite right: the model shoud include the
     75            // offset information, we are not really getting exactly the right mapping from the
     76            // original file.
     77            psImageBinning *binning = psImageBinningAlloc();
     78            binning->nXruff = noiseMap->image->numCols;
     79            binning->nYruff = noiseMap->image->numRows;
     80            binning->nXfine = input->image->numCols;
     81            binning->nYfine = input->image->numRows;
     82            psImageBinningSetScale(binning, PS_IMAGE_BINNING_LEFT);
     83
     84            psImageUnbin (noiseImage, noiseMap->image, binning);
     85            psFree (binning);
     86        }
     87        pmReadoutGenerateVariance(input, noiseImage, true);
     88        psFree (noiseImage);
    6789    }
    6890
  • trunk/ppImage/src/ppImageDetrendRecord.c

    r20773 r24485  
    6767    psMetadataAddMetadata(cell->analysis, PS_LIST_TAIL, "DETREND", 0, "Detrend information", detrend);
    6868
    69     detrendRecord(options->doMask, detrend, config, view, "PPIMAGE.MASK", "DETREND.MASK", "Mask filename");
    70     detrendRecord(options->doBias, detrend, config, view, "PPIMAGE.BIAS", "DETREND.BIAS", "Bias filename");
    71     detrendRecord(options->doDark, detrend, config, view, "PPIMAGE.DARK", "DETREND.DARK", "Dark filename");
    72     detrendRecord(options->doShutter, detrend, config, view, "PPIMAGE.SHUTTER", "DETREND.SHUTTER",
    73                   "Shutter correction filename");
    74     detrendRecord(options->doFlat, detrend, config, view, "PPIMAGE.FLAT", "DETREND.FLAT", "Flat filename");
    75     detrendRecord(options->doFringe, detrend, config, view, "PPIMAGE.FRINGE", "DETREND.FRINGE",
    76                   "Fringe filename");
     69    detrendRecord(options->doMask,     detrend, config, view, "PPIMAGE.MASK",     "DETREND.MASK",     "Mask filename");
     70    detrendRecord(options->doNoiseMap, detrend, config, view, "PPIMAGE.NOISEMAP", "DETREND.NOISEMAP", "Noise Map filename");
     71    detrendRecord(options->doBias,     detrend, config, view, "PPIMAGE.BIAS",     "DETREND.BIAS",     "Bias filename");
     72    detrendRecord(options->doDark,     detrend, config, view, "PPIMAGE.DARK",     "DETREND.DARK",     "Dark filename");
     73    detrendRecord(options->doShutter,  detrend, config, view, "PPIMAGE.SHUTTER",  "DETREND.SHUTTER",  "Shutter correction filename");
     74    detrendRecord(options->doFlat,     detrend, config, view, "PPIMAGE.FLAT",     "DETREND.FLAT",     "Flat filename");
     75    detrendRecord(options->doFringe,   detrend, config, view, "PPIMAGE.FRINGE",   "DETREND.FRINGE",   "Fringe filename");
    7776
    7877    psFree (detrend);
  • trunk/ppImage/src/ppImageOptions.c

    r24229 r24485  
    2525    options->doNonLin        = false;   // Non-linearity correction
    2626    options->doOverscan      = false;   // Overscan subtraction
     27    options->doNoiseMap      = false;   // Apply Read Noise Map
    2728    options->doBias          = false;   // Bias subtraction
    2829    options->doDark          = false;   // Dark subtraction
     
    217218    options->doCrosstalkCorrect = psMetadataLookupBool(NULL, recipe, "CROSSTALK.CORRECT");
    218219
     220    options->doNoiseMap = psMetadataLookupBool(NULL, recipe, "NOISEMAP");
    219221    options->doBias = psMetadataLookupBool(NULL, recipe, "BIAS");
    220222    options->doDark = psMetadataLookupBool(NULL, recipe, "DARK");
     
    278280
    279281    // even if not requested explicitly, if any of these are set, build an internal mask and variance:
    280     if (options->doBias || options->doOverscan || options->doDark || options->doShutter || options->doFlat ||
     282    if (options->doNoiseMap || options->doBias || options->doOverscan || options->doDark || options->doShutter || options->doFlat ||
    281283        options->doPhotom) {
    282284        options->doMaskBuild = true;
  • trunk/ppImage/src/ppImageParseCamera.c

    r23411 r24485  
    2525    // otherwise they revert to the config information
    2626    // not all input or output images are used in a given recipe
     27    if (options->doNoiseMap) {
     28        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.NOISEMAP", "NOISEMAP",
     29                               PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_BIAS /* NOISEMAP */)) {
     30            psError(PS_ERR_IO, false, "Can't find a noise map image source");
     31            psFree(options);
     32            return NULL;
     33        }
     34    }
    2735    if (options->doBias) {
    2836        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.BIAS", "BIAS",
     
    4856            return NULL;
    4957        }
    50 
    51 #if 0
    52         // I think this is now done automatically in the pmFPAfileDefine and pmFPAfileIOChecks -- PAP.
    53 
    54         // XXX have ppImageDefineFile return the pmFPAfile?
    55         pmFPAfile *mask = psMetadataLookupPtr(&status, config->files, "PPIMAGE.MASK");
    56         psAssert(mask, "Just defined the mask!");
    57 
    58         // Need to read the names of bit masks from the mask header and set them in the
    59         // recipe.  If we are loading this from the detrend db, this action will happen
    60         // when the file is resolved.
    61         if (!mask->detrend) {
    62             // XXX need to load the mask bit names from one of the headers
    63             // this grabs the first available hdu : no guarantee that it will be valid, though
    64             pmHDU *hdu = pmHDUGetFirst(mask->fpa);
    65             if (!hdu) {
    66                 psError(PS_ERR_IO, true, "no valid HDU for PPIMAGE.INPUT.MASK");
    67                 return NULL;
    68             }
    69             // XXX is this consistent with the pmConfigMaskReadHeader call above?
    70             if (!pmConfigMaskReadHeader(config, hdu->header)) {
    71                 psError(PS_ERR_IO, false, "error in mask bits");
    72                 return NULL;
    73             }
    74         }
    75 #endif
    7658    }
    7759    if (options->doShutter) {
Note: See TracChangeset for help on using the changeset viewer.