IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9832


Ignore:
Timestamp:
Nov 2, 2006, 12:30:06 PM (20 years ago)
Author:
Paul Price
Message:

Adding fringe combination.

Location:
trunk/ppMerge/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeCombine.c

    r9824 r9832  
    214214                            }
    215215                            numRead++;
     216                        } else {
     217                            psTrace("ppMerge", 3, "Unable to read from file %d for chip %d, "
     218                                    "cell %d, scan %d\n", i, view->chip, view->cell, numScan);
    216219                        }
    217220                    }
    218221
     222                    psTrace("ppMerge", 5, "Chip %d, cell %d, scan %d\n", view->chip, view->cell, numScan);
    219223                    if (numRead > 0) {
    220224                        pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine);
    221                         psTrace("ppMerge", 5, "Chip %d, cell %d, scan %d\n", view->chip, view->cell, numScan);
    222225                    }
    223226                    numScan++;
     
    259262            }
    260263
    261             psFree(readout);            // Drop reference
    262264            psFree(stack);
    263265
     
    270272            }
    271273
     274            // Measure the fringes for this cell
     275            //
     276            // XXX Need to deal with multiple components: we will do this by building up the components
     277            // Read the existing fringe measurements
     278            // Use existing regions to measure fringe statistics
     279            // Add the new fringe measurements to the existing fringe measurements.
     280            // Write the appended fringe measurements.
     281            // Read in the "output" file to get the existing components.
     282            // Put the new readout into the cell after the existing readouts.
     283            if (options->fringe && readout->image) {
     284                pmFringeRegions *regions = pmFringeRegionsAlloc(options->fringeNum, options->fringeSize,
     285                                                                options->fringeSize, options->fringeSmoothX,
     286                                                                options->fringeSmoothY); // Fringe regions
     287                pmFringeStats *fringe = pmFringeStatsMeasure(regions, readout, options->combine->maskVal);
     288                psFree(regions);
     289
     290                psArray *fringes = psArrayAlloc(1); // Array of fringes
     291                fringes->data[0] = fringe;
     292
     293                const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of chip
     294                const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell
     295                psString extname = NULL;
     296                psStringAppend(&extname, "FRINGE_%s_%s", chipName, cellName);
     297
     298                if (!pmFringesWriteFits(data->outFile, NULL, fringes, extname)) {
     299                    psWarning("Unable to write fringe data to extension %s\n", extname);
     300                }
     301
     302                psFree(fringes);
     303                psFree(extname);
     304            }
     305
     306            psFree(readout);            // Drop reference
    272307
    273308            // Statistics on the merged cell
  • trunk/ppMerge/src/ppMergeOptions.c

    r9539 r9832  
    3535    options->scale = false;
    3636    options->darktime = false;
     37    options->fringe = false;
    3738    options->shutter = false;
    3839    options->sample = 1;
    3940    options->mean = PS_STAT_SAMPLE_MEDIAN;
    4041    options->stdev = PS_STAT_SAMPLE_STDEV;
     42    options->fringeNum = 100;
     43    options->fringeSize = 10;
     44    options->fringeSmoothX = 5;
     45    options->fringeSmoothY = 5;
    4146    options->shutterSize = 10;
    4247    options->shutterIter = 2;
     
    122127
    123128    // First, deal with the recipe.  These are parameters that will typically be constant for a camera.
    124     OPTION_PARSE(options->rows,              recipe, "ROWS",      U16 );
    125     OPTION_PARSE(options->minElectrons,      recipe, "ELECTRONS", F32 );
    126     OPTION_PARSE(options->sample,            recipe, "SAMPLE",    S32 );
    127     OPTION_PARSE(options->combine->rej,      recipe, "REJ",       F32 );
    128     OPTION_PARSE(options->combine->iter,     recipe, "ITER",      S32 );
    129     OPTION_PARSE(options->combine->fracHigh, recipe, "FRACHIGH",  F32 );
    130     OPTION_PARSE(options->combine->fracLow,  recipe, "FRACLOW",   F32 );
    131     OPTION_PARSE(options->combine->nKeep,    recipe, "NKEEP",     S32 );
    132     OPTION_PARSE(options->combine->maskVal,  recipe, "MASKVAL",   S32 );
    133     OPTION_PARSE(options->shutterSize,       recipe, "SHUTTER.SIZE", S32 );
    134     OPTION_PARSE(options->shutterIter,       recipe, "SHUTTER.ITER", S32 );
    135     OPTION_PARSE(options->shutterRej,        recipe, "SHUTTER.REJECT", F32 );
     129    OPTION_PARSE(options->rows,              recipe, "ROWS",           U16);
     130    OPTION_PARSE(options->minElectrons,      recipe, "ELECTRONS",      F32);
     131    OPTION_PARSE(options->sample,            recipe, "SAMPLE",         S32);
     132    OPTION_PARSE(options->combine->rej,      recipe, "REJ",            F32);
     133    OPTION_PARSE(options->combine->iter,     recipe, "ITER",           S32);
     134    OPTION_PARSE(options->combine->fracHigh, recipe, "FRACHIGH",       F32);
     135    OPTION_PARSE(options->combine->fracLow,  recipe, "FRACLOW",        F32);
     136    OPTION_PARSE(options->combine->nKeep,    recipe, "NKEEP",          S32);
     137    OPTION_PARSE(options->combine->maskVal,  recipe, "MASKVAL",        S32);
     138    OPTION_PARSE(options->fringeNum,         recipe, "FRINGE.NUM",     S32);
     139    OPTION_PARSE(options->fringeSize,        recipe, "FRINGE.SIZE",    S32);
     140    OPTION_PARSE(options->fringeSmoothX,     recipe, "FRINGE.XSMOOTH", S32);
     141    OPTION_PARSE(options->fringeSmoothY,     recipe, "FRINGE.YSMOOTH", S32);
     142    OPTION_PARSE(options->shutterSize,       recipe, "SHUTTER.SIZE",   S32);
     143    OPTION_PARSE(options->shutterIter,       recipe, "SHUTTER.ITER",   S32);
     144    OPTION_PARSE(options->shutterRej,        recipe, "SHUTTER.REJECT", F32);
    136145
    137146    options->combine->combine = parseStat(recipe, "COMBINE");
     
    148157            options->scale = false;
    149158            options->darktime = false;
     159            options->fringe = false;
    150160            options->shutter = false;
    151161        } else if (strcasecmp(type, "DARK") == 0) {
     
    153163            options->scale = false;
    154164            options->darktime = true;
     165            options->fringe = false;
    155166            options->shutter = false;
    156167        } else if (strcasecmp(type, "FLAT") == 0) {
     
    158169            options->scale = true;
    159170            options->darktime = false;
     171            options->fringe = false;
    160172            options->shutter = false;
    161173        } else if (strcasecmp(type, "FRINGE") == 0) {
     
    163175            options->scale = true;
    164176            options->darktime = false;
     177            options->fringe = true;
    165178            options->shutter = false;
    166179        } else if (strcasecmp(type, "SHUTTER") == 0) {
     
    168181            options->scale = false;
    169182            options->darktime = false;
     183            options->fringe = false;
    170184            options->shutter = true;
    171185        } else {
     
    174188            options->scale = false;
    175189            options->darktime = false;
     190            options->fringe = false;
    176191            options->shutter = false;
    177192        }
     
    181196        options->scale = false;
    182197        options->darktime = false;
     198        options->fringe = false;
     199        options->shutter = false;
    183200    }
    184201
  • trunk/ppMerge/src/ppMergeOptions.h

    r9463 r9832  
    2222    bool scale;                         // Scale by the background before combining?
    2323    bool darktime;                      // Normalise by the dark time (time since flush)?
     24    bool fringe;                        // Make fringe measurements?
    2425    bool shutter;                       // Generate shutter correction?
    2526    unsigned int sample;                // Sampling factor for measuring the background
    2627    psStatsOptions mean;                // Statistic to use to measure the mean
    2728    psStatsOptions stdev;               // Statistic to use to measure the stdev
     29    int fringeNum;                      // Number of fringe regions per cell
     30    int fringeSize;                     // Size of fringe regions
     31    int fringeSmoothX;                  // Number of smoothing regions per cell, in x
     32    int fringeSmoothY;                  // Number of smoothing regions per cell, in y
    2833    int shutterSize;                    // Size for shutter measurement regions
    2934    int shutterIter;                    // Number of iterations for shutter measurement
Note: See TracChangeset for help on using the changeset viewer.