IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 30, 2009, 5:20:29 PM (17 years ago)
Author:
watersc1
Message:

Finished up my edits to the detrend cleanup, and some changes to my
copy of burntool and the pslib astrometry. Detrend cleanup has not
been tested yet. That's up next.

Location:
branches/czw_branch/cleanup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/cleanup

  • branches/czw_branch/cleanup/ppMerge/src/ppMergeLoop.c

    r24118 r24951  
    6565    int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); // Smoothing regions in x
    6666    int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y
     67    bool fringeSmooth = psMetadataLookupBool(NULL, arguments, "FRINGE.SMOOTH"); // Smooth the output image?
     68    float fringeSmoothSigma = psMetadataLookupF32(NULL, arguments, "FRINGE.SMOOTH.SIGMA"); // Smooth the output image?
    6769
    6870    // set the mask and mark bit values based on the named masks
     
    9496    psVector *scales = NULL, *zeros = NULL; ///< Scale and zeroes for combination
    9597    psArray *shutters = NULL;           ///< Shutter correction data
     98    psImage *zeroSet = NULL;
    9699    switch (type) {
    97100      case PPMERGE_TYPE_FRINGE:
    98         zeros = psMetadataLookupPtr(NULL, arguments, "ZEROS");
    99         if (!zeros) {
     101        zeroSet = psMetadataLookupPtr(NULL, arguments, "ZEROS");
     102        if (!zeroSet) {
    100103            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find ZEROS");
    101104            goto ERROR;
    102105        }
     106        // the zeros vector is passed to pmReadoutCombine for each set of inputs per cell
     107        zeros = psVectorAlloc(zeroSet->numRows, PS_TYPE_F32);
    103108        // Flow through
    104109      case PPMERGE_TYPE_FLAT:
     
    140145    pmFPA *outFPA = output->fpa;        ///< Output FPA
    141146    pmHDU *lastHDU = NULL;              // Last HDU that was updated
     147
    142148    int cellNum = 0;                    ///< Index of cell
    143149    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     
    146152    pmChip *outChip;                    ///< Chip of interest
    147153    while ((outChip = pmFPAviewNextChip(view, outFPA, 1))) {
     154        if (!outChip->process || !outChip->file_exists) {
     155            continue;
     156        }
    148157        if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    149158            goto ERROR;
     
    155164
    156165        while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) {
     166            if (!outCell->process || !outCell->file_exists) {
     167                continue;
     168            }
    157169            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    158170                goto ERROR;
     
    194206            }
    195207
     208            if (zeroSet) {
     209              for (int i = 0; i < zeroSet->numRows; i++) {
     210                zeros->data.F32[i] = zeroSet->data.F32[i][cellNum];
     211              }
     212            }
     213
     214            int rows = psMetadataLookupS32(NULL, config->arguments, "ROWS"); // Number of rows to read per chunk
     215            if (!rows && nThreads) {
     216              psError(PS_ERR_UNKNOWN, false, "Invalid combination of threads > 0 and ROWS == 0 (ie, multiple threads working on the full array...)");
     217              goto ERROR;
     218            }
     219
    196220            ppMergeFileGroup *fileGroup = NULL;
    197221            psArray *fileGroups = psArrayAlloc(nThreads + 1);
     
    203227                    pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", j);
    204228                    pmCell *inCell = pmFPAviewThisCell(view, input->fpa); ///< Input cell
    205                     readouts->data[j] = pmReadoutAlloc(inCell);
     229                    pmReadout *readout = pmReadoutAlloc(inCell);
     230                    readout->process = true; // until proven otherwise, attempt to process this readout
     231                    readouts->data[j] = readout;
    206232                }
    207233
     
    335361
    336362            psFree(fileGroups);
     363            psFree(zeros);
    337364
    338365            // XXX eventually need to keep both the shutter and the pattern, as we do with dark
     
    397424            // Put the new readout into the cell after the existing readouts.
    398425            if (type == PPMERGE_TYPE_FRINGE && outRO) {
    399                 pmFringeRegions *regions = pmFringeRegionsAlloc(fringeNum, fringeSize, fringeSize,
    400                                                                 fringeSmoothX, fringeSmoothY);
     426                if (fringeSmooth) {
     427                    if (outRO->mask) {
     428                        psImage *smoothed = psImageSmoothMask (NULL, outRO->image, outRO->mask, maskVal, fringeSmoothSigma, 3, 0.2);
     429                        psFree (outRO->image);
     430                        outRO->image = smoothed;
     431                    } else {
     432                        psImageSmooth (outRO->image, fringeSmoothSigma, 3);
     433                    }
     434                }
     435
     436                pmFringeRegions *regions = pmFringeRegionsAlloc(fringeNum, fringeSize, fringeSize, fringeSmoothX, fringeSmoothY);
    401437                pmFringeStats *fringe = pmFringeStatsMeasure(regions, outRO, maskVal);
    402438                psFree(regions);
     
    410446                fringes->data[0] = fringe;
    411447
    412                 pmFringesFormat(outCell, NULL, fringes);
     448                // XXX replaced this : pmFringesFormat(outCell, NULL, fringes);
     449                if (!psMetadataAdd(outCell->analysis, PS_LIST_TAIL, "FRINGE.MEASUREMENTS", PS_DATA_ARRAY, "Fringes", fringes)) {
     450                    psError(PS_ERR_UNKNOWN, false, "Unable to add fringe to analysis metadata\n");
     451                    goto ERROR;
     452                }
    413453                psFree(fringes);        // Drop reference
    414454            }
Note: See TracChangeset for help on using the changeset viewer.