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/ppImage/src/ppImageDetrendFringe.c

    r18969 r24951  
    1111    PS_ASSERT_PTR_NON_NULL(options, false);
    1212
    13     // Reference fringe measurements
    14     psArray *references = psMemIncrRefCounter(psMetadataLookupPtr(NULL, fringe->analysis,
    15                                                                   "FRINGE.MEASUREMENTS"));
     13    // Reference fringe measurements (stored on the reference cell->analysis)
     14    psArray *references = psMemIncrRefCounter(psMetadataLookupPtr(NULL, fringe->analysis, "FRINGE.MEASUREMENTS"));
    1615    if (!references) {
    17         references = pmFringesParse(fringe); // Reference fringes
    18         if (!references) {
    19             psError(PS_ERR_IO, false, "Unable to find fringe references.\n");
    20             return false;
    21         }
    22         psMetadataAdd(fringe->analysis, PS_LIST_TAIL, "FRINGE.MEASUREMENTS", PS_DATA_UNKNOWN,
    23                       "Fringe measurements", references);
     16        psError(PS_ERR_IO, false, "Unable to find fringe references.\n");
     17        return false;
    2418    }
    2519
     
    7569    }
    7670
    77     psMetadataAdd(readout->parent->analysis, PS_LIST_TAIL, scienceFringes,
    78                   PS_DATA_UNKNOWN | PS_META_REPLACE, "Fringe measurements", measurements);
     71    psMetadataAdd(readout->parent->analysis, PS_LIST_TAIL, scienceFringes, PS_DATA_UNKNOWN | PS_META_REPLACE, "Fringe measurements", measurements);
    7972    psFree(measurements);
    8073    psFree(scienceFringes);
     
    9285    psArray *fringes = psArrayAlloc(cells->n); // Fringes, to return
    9386    for (int i = 0; i < cells->n; i++) {
     87        fringes->data[i] = NULL;
     88
    9489        pmCell *cell = cells->data[i];  // Cell of interest
    9590
    9691        // XXX for now, skip the video cells (cell->readouts->n > 1)
    9792        if (cell->readouts->n > 1) {
    98           psWarning ("Skipping Video Cell for ppImageDetrendFringe.c:getFringes");
    99           continue;
     93            psWarning ("Skipping Video Cell (%d) for ppImageDetrendFringe.c:getFringes", i);
     94            continue;
    10095        }
    10196
     
    197192    }
    198193    assert(fringes->readouts->n == solution->nFringeFrames);
     194
     195    psImageMaskType maskVal = options->flatMask;
    199196
    200197    bool mdok;                          // Status of MD lookup
     
    262259        }
    263260
     261        // subtract fringe and update mask if fringe value is NAN
     262        for (int iy = 0; iy < readout->image->numRows; iy++) {
     263            for (int ix = 0; ix < readout->image->numCols; ix++) {
     264                readout->image->data.F32[iy][ix] -= sumFringe->data.F32[iy][ix];
     265                if (!isfinite(sumFringe->data.F32[iy][ix]) && readout->mask) {
     266                    readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] |= maskVal;
     267                }
     268            }
     269        }
     270
    264271        // XXX: Make generic, so subregions may be subtracted as well
    265         if (!psBinaryOp(readout->image, readout->image, "-", sumFringe)) {
    266             psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to subtract fringe.\n");
    267             return false;
    268         }
     272        // if (!psBinaryOp(readout->image, readout->image, "-", sumFringe)) {
     273        //     psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to subtract fringe.\n");
     274        //     return false;
     275        // }
    269276
    270277        // measure residual fringe amplitude. results go to FRINGE.RESIDUALS
Note: See TracChangeset for help on using the changeset viewer.