Changeset 10326 for trunk/psModules/src/detrend/pmBias.c
- Timestamp:
- Nov 30, 2006, 2:14:20 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmBias.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmBias.c
r10302 r10326 8 8 9 9 #include "pmFPA.h" 10 #include "pmHDUUtils.h" 10 11 #include "pmBias.h" 11 12 12 13 13 static void overscanOptionsFree(pmOverscanOptions *options) … … 212 212 } 213 213 214 // psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now, used for reporting214 pmHDU *hdu = pmHDUFromReadout(in); // HDU of interest 215 215 216 216 psImage *image = in->image; // The input image … … 235 235 } 236 236 psStats *stats = psStatsAlloc(statistic); // A new psStats, to avoid clobbering original 237 238 psString comment = NULL; // Comment to add 239 psStringAppend(&comment, "Subtracting overscan (stat %x; type %x; order %d)", 240 statistic, overscanOpts->fitType, overscanOpts->order); 241 psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, 242 comment, ""); 243 psFree(comment); 237 244 238 245 // Reduce all overscan pixels to a single value … … 245 252 pixels = psVectorRealloc(pixels, pixels->n + overscan->numRows * overscan->numCols); 246 253 pixels->n += overscan->numRows * overscan->numCols; 247 // XXX Reimplement with memcpy248 254 for (int i = 0; i < overscan->numRows; i++) { 249 for (int j = 0; j < overscan->numCols; j++) { 250 pixels->data.F32[index++] = overscan->data.F32[i][j]; 251 } 252 } 253 255 memcpy(&pixels->data.F32[index], overscan->data.F32[i], 256 overscan->numCols * sizeof(psF32)); 257 index += overscan->numCols; 258 } 254 259 } 255 260 psFree(iter); … … 260 265 (void)psBinaryOp(image, image, "-", psScalarAlloc((float)reduced, PS_TYPE_F32)); 261 266 } else { 262 263 267 // We do the regular overscan subtraction 264 265 268 bool readRows = psMetadataLookupBool(NULL, in->parent->concepts, "CELL.READDIR");// Read direction 266 269 … … 357 360 // Bias frame subtraction 358 361 if (bias) { 359 if (!subtractFrame(in, bias, 1.0)) 362 psVector *md5 = psImageMD5(bias->image); // md5 hash 363 psString md5string = psMD5toString(md5); // String 364 psFree(md5); 365 psStringPrepend(&md5string, "BIAS image MD5: "); 366 psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, 367 md5string, ""); 368 psFree(md5string); 369 370 if (!subtractFrame(in, bias, 1.0)) { 360 371 return false; 372 } 361 373 } 362 374 … … 365 377 float inTime = psMetadataLookupF32(NULL, in->parent->concepts, "CELL.DARKTIME"); 366 378 float darkTime = psMetadataLookupF32(NULL, dark->parent->concepts, "CELL.DARKTIME"); 367 if (!subtractFrame(in, dark, inTime/darkTime)) 379 380 psVector *md5 = psImageMD5(dark->image); // md5 hash 381 psString md5string = psMD5toString(md5); // String 382 psFree(md5); 383 psStringPrepend(&md5string, "DARK image (scale %.3f) MD5: ", inTime/darkTime); 384 psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, 385 md5string, ""); 386 psFree(md5string); 387 388 if (!subtractFrame(in, dark, inTime/darkTime)) { 368 389 return false; 369 } 390 } 391 } 392 393 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now, used for reporting 394 psString timeString = psTimeToISO(time); // String with time 395 psFree(time); 396 psStringPrepend(&timeString, "Bias processing completed at "); 397 psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, 398 timeString, ""); 399 psFree(timeString); 400 370 401 371 402 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
