IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 24, 2007, 11:17:19 AM (19 years ago)
Author:
Paul Price
Message:

Changing pmShutterCorrectionMeasure to act on a readout, rather than return an image, so that it can update the 'concepts' as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmShutterCorrection.c

    r12696 r12988  
    1212#include "pmHDUUtils.h"
    1313#include "psVectorBracket.h"
     14#include "pmConceptsAverage.h"
     15
    1416#include "pmShutterCorrection.h"
    1517
     
    347349#define MEASURE_SAMPLES 4
    348350
    349 psImage *pmShutterCorrectionMeasure(const psArray *readouts, int size, psStatsOptions meanStat,
    350                                     psStatsOptions stdevStat, int nIter, float rej, psMaskType maskVal)
     351bool pmShutterCorrectionMeasure(pmReadout *output, const psArray *readouts, int size, psStatsOptions meanStat,
     352                                psStatsOptions stdevStat, int nIter, float rej, psMaskType maskVal)
    351353{
    352354    PS_ASSERT_ARRAY_NON_NULL(readouts, NULL);
     
    591593
    592594    if (psTraceGetLevel("psModules.detrend") > 5) {
    593         psFits *fits = psFitsOpen("pattern.fits", "w");
    594         psFitsWriteImage(fits, NULL, pattern, 0, NULL);
    595         psFitsClose(fits);
     595        psFits *fits = psFitsOpen("pattern.fits", "w");
     596        psFitsWriteImage(fits, NULL, pattern, 0, NULL);
     597        psFitsClose(fits);
    596598    }
    597599    psFree(pattern);
    598600
    599     return shutter;
     601    output->image = shutter;
     602
     603    // Update the "concepts"
     604    psList *inputCells = psListAlloc(NULL); // List of cells
     605    for (long i = 0; i < readouts->n; i++) {
     606        pmReadout *readout = readouts->data[i]; // Readout of interest
     607        psListAdd(inputCells, PS_LIST_TAIL, readout->parent);
     608    }
     609    bool success = pmConceptsAverageCells(output->parent, inputCells, NULL, NULL, true);
     610    psFree(inputCells);
     611
     612    // Correct the exposure times --- they don't make sense any more.
     613    psMetadataItem *item = psMetadataLookup(output->parent->concepts, "CELL.EXPOSURE");
     614    item->data.F32 = NAN;
     615    item = psMetadataLookup(output->parent->concepts, "CELL.DARKTIME");
     616    item->data.F32 = NAN;
     617
     618    return success;
    600619
    601620
     
    611630    psFree(samplesMean);
    612631    psFree(samplesStdev);
    613     return NULL;
     632    return false;
    614633}
    615634
Note: See TracChangeset for help on using the changeset viewer.