Changeset 23740 for trunk/ppSub/src/ppSubReadoutUpdate.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/pap merged: 23690,23704,23711,23719,23723,23730-23735
- Property svn:mergeinfo changed
-
trunk/ppSub
- Property svn:mergeinfo changed
/branches/pap/ppSub merged: 23704,23711,23719,23723,23730,23732-23734
- Property svn:mergeinfo changed
-
trunk/ppSub/src
- Property svn:ignore
-
old new 10 10 stamp-h1 11 11 ppSubKernel 12 ppSubErrorCodes.h 13 ppSubErrorCodes.c
-
- Property svn:ignore
-
trunk/ppSub/src/ppSubReadoutUpdate.c
r23688 r23740 20 20 21 21 #include "ppSub.h" 22 23 bool ppSubReadoutUpdate(pmConfig *config, ppSubData *data, const pmFPAview *view)24 {25 psAssert(config, "Require configuration");26 psAssert(view, "Require view");27 28 bool mdok = false; // Status of MD lookup29 30 // Look up recipe values31 psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSUB_RECIPE); // Recipe for ppSim32 psAssert(recipe, "We checked this earlier, so it should be here.");33 34 pmFPAfile *outFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.OUTPUT"); // Output file35 pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); // Output image36 pmFPA *outFPA = outFile->fpa; // Output FPA37 pmHDU *outHDU = outFPA->hdu; // Output HDU38 39 // Add additional data to the header40 pmFPAfile *refFile = psMetadataLookupPtr(NULL, config->files, "PPSUB.REF"); // Reference file41 pmFPAfile *inFile = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file42 psMetadataAddStr(outHDU->header, PS_LIST_TAIL, "PPSUB.REFERENCE", 0,43 "Subtraction reference", refFile->filename);44 psMetadataAddStr(outHDU->header, PS_LIST_TAIL, "PPSUB.INPUT", 0,45 "Subtraction input", inFile->filename);46 ppSubVersionHeader(outHDU->header);47 48 // Statistics on the matching49 if (data->stats) {50 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MODE);51 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_STAMPS);52 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_MEAN);53 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_RMS);54 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_NORM);55 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_BGDIFF);56 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MX);57 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MY);58 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXX);59 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXY);60 psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MYY);61 62 psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_MATCH", 0, "Time to match PSFs",63 psTimerClear("PPSUB_MATCH"));64 }65 66 // Generate binned JPEGs67 {68 psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask for bad pixels69 70 int bin1 = psMetadataLookupS32(NULL, recipe, "BIN1"); // First binning level71 int bin2 = psMetadataLookupS32(NULL, recipe, "BIN2"); // Second binning level72 73 // Target cells74 pmCell *cell1 = pmFPAfileThisCell(config->files, view, "PPSUB.OUTPUT.JPEG1"); // Rebinned cell once75 pmCell *cell2 = pmFPAfileThisCell(config->files, view, "PPSUB.OUTPUT.JPEG2"); // Rebinned cell twice76 77 pmReadout *ro1 = pmReadoutAlloc(cell1), *ro2 = pmReadoutAlloc(cell2); // Binned readouts78 if (!pmReadoutRebin(ro1, outRO, maskBad, bin1, bin1)) {79 psError(PS_ERR_UNKNOWN, false, "Unable to bin output (1st binning)");80 psFree(ro1);81 psFree(ro2);82 return false;83 }84 if (!pmReadoutRebin(ro2, ro1, 0, bin2, bin2)) {85 psError(PS_ERR_UNKNOWN, false, "Unable to bin output (2nd binning)");86 psFree(ro1);87 psFree(ro2);88 return false;89 }90 psFree(ro1);91 psFree(ro2);92 }93 94 #ifdef TESTING95 // Significance image96 {97 psImage *sig = (psImage*)psBinaryOp(NULL, outRO->image, "*", outRO->image);98 psBinaryOp(sig, sig, "/", outRO->variance);99 psFits *fits = psFitsOpen("significance.fits", "w");100 psFitsWriteImage(fits, NULL, sig, 0, NULL);101 psFitsClose(fits);102 psFree(sig);103 }104 #endif105 106 return true;107 }
Note:
See TracChangeset
for help on using the changeset viewer.
