Changeset 26076 for trunk/ppStack/src/ppStackConvolve.c
- Timestamp:
- Nov 9, 2009, 2:53:12 PM (17 years ago)
- Location:
- trunk/ppStack
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/ppStackConvolve.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/czw_branch/cleanup/ppStack merged eligible /branches/eam_branches/20090522/ppStack merged eligible /branches/eam_branches/20090715/ppStack merged eligible /branches/eam_branches/20090820/ppStack merged eligible /branches/pap/ppStack merged eligible /branches/pap_mops/ppStack 25137-25255
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/ppStack/src/ppStackConvolve.c
r23602 r26076 9 9 #include "ppStack.h" 10 10 #include "ppStackLoop.h" 11 12 //#define TESTING 13 11 14 12 15 // Update the value of a concept … … 39 42 options->weightings = psVectorAlloc(num, PS_TYPE_F32); // Combination weightings for images (1/noise^2) 40 43 psVectorInit(options->weightings, 0.0); 41 options->covariances = psArrayAlloc(num); // Covariance matrices 44 options->origCovars = psArrayAlloc(num); 45 options->convCovars = psArrayAlloc(num); // Covariance matrices 46 47 psVector *renorms = psVectorAlloc(num, PS_TYPE_F32); // Renormalisation values for variances 48 psVectorInit(renorms, NAN); 42 49 43 50 psList *fpaList = psListAlloc(NULL); // List of input FPAs, for concept averaging … … 79 86 // Background subtraction, scaling and normalisation is performed automatically by the image matching 80 87 psTimerStart("PPSTACK_MATCH"); 88 options->origCovars->data[i] = psMemIncrRefCounter(readout->covariance); 81 89 if (!ppStackMatch(readout, options, i, config)) { 82 90 psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i); … … 85 93 continue; 86 94 } 87 options->covariances->data[i] = psMemIncrRefCounter(readout->covariance); 95 options->convCovars->data[i] = psMemIncrRefCounter(readout->covariance); 96 97 float renorm = psMetadataLookupF32(NULL, readout->analysis, PM_READOUT_ANALYSIS_RENORM); 98 if (!isfinite(renorm)) { 99 renorm = 1.0; 100 } 101 renorms->data.F32[i] = renorm; 88 102 89 103 if (options->stats) { … … 114 128 pmHDU *hdu = readout->parent->parent->parent->hdu; // HDU for convolved image 115 129 assert(hdu); 116 ppStackWriteImage(options-> imageNames->data[i], hdu->header, readout->image, config);130 ppStackWriteImage(options->convImages->data[i], hdu->header, readout->image, config); 117 131 psMetadata *maskHeader = psMetadataCopy(NULL, hdu->header); // Copy of header, for mask 118 132 pmConfigMaskWriteHeader(config, maskHeader); 119 ppStackWriteImage(options-> maskNames->data[i], maskHeader, readout->mask, config);133 ppStackWriteImage(options->convMasks->data[i], maskHeader, readout->mask, config); 120 134 psFree(maskHeader); 121 psImageCovarianceTransfer(readout->variance, readout->covariance); 122 ppStackWriteImage(options->varianceNames->data[i], hdu->header, readout->variance, config); 135 ppStackWriteImage(options->convVariances->data[i], hdu->header, readout->variance, config); 123 136 #ifdef TESTING 124 137 { … … 129 142 psFree(name); 130 143 } 144 { 145 int numCols = readout->image->numCols, numRows = readout->image->numRows; 146 psImage *sn = psImageAlloc(numCols, numRows, PS_TYPE_F32); 147 for (int y = 0; y < numRows; y++) { 148 for (int x = 0; x < numCols; x++) { 149 sn->data.F32[y][x] = readout->image->data.F32[y][x] / 150 sqrtf(readout->variance->data.F32[y][x]); 151 } 152 } 153 psString name = NULL; 154 psStringAppend(&name, "signoise_%d.fits", i); 155 ppStackWriteImage(name, hdu->header, sn, config); 156 psFree(name); 157 psFree(sn); 158 } 131 159 #endif 132 160 … … 149 177 psFree(rng); 150 178 151 psFree(options->norm); options->norm = NULL;152 179 psFree(options->sourceLists); options->sourceLists = NULL; 153 180 psFree(options->psf); options->psf = NULL; … … 211 238 numGood = 0; // Number of good images 212 239 for (int i = 0; i < num; i++) { 213 if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PPSTACK_MASK_ALL) {240 if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PPSTACK_MASK_ALL) { 214 241 continue; 215 242 } … … 233 260 } 234 261 262 // Correct chi^2 for renormalisation 263 psBinaryOp(options->matchChi2, options->matchChi2, "/", renorms); 264 for (int i = 0; i < num; i++) { 265 psLogMsg("ppStack", PS_LOG_INFO, "Additional variance for image %d: %f\n", 266 i, options->matchChi2->data.F32[i]); 267 } 268 psFree(renorms); 269 235 270 return true; 236 271 }
Note:
See TracChangeset
for help on using the changeset viewer.
