Changeset 14639
- Timestamp:
- Aug 23, 2007, 12:30:43 PM (19 years ago)
- Location:
- branches/eam_branch_20070817/psModules
- Files:
-
- 9 edited
-
src/camera/pmFPA.c (modified) (4 diffs)
-
src/imcombine/Makefile.am (modified) (1 diff)
-
src/imcombine/pmStack.c (modified) (15 diffs)
-
src/imcombine/pmStack.h (modified) (4 diffs)
-
src/imcombine/pmSubtraction.c (modified) (6 diffs)
-
src/imcombine/pmSubtraction.h (modified) (1 diff)
-
src/psmodules.h (modified) (2 diffs)
-
test/camera/Makefile.am (modified) (1 diff)
-
test/config/data/SampleIPPConfig (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070817/psModules/src/camera/pmFPA.c
r14201 r14639 162 162 void pmReadoutFreeData (pmReadout *readout) 163 163 { 164 if (!readout) { 165 return; 166 } 164 167 psFree(readout->image); 165 168 psFree(readout->mask); … … 177 180 void pmCellFreeData(pmCell *cell) 178 181 { 179 PS_ASSERT_PTR_NON_NULL(cell,); 182 if (!cell) { 183 return; 184 } 180 185 181 186 for (int i = 0; i < cell->readouts->n; i++) { … … 197 202 void pmChipFreeData(pmChip *chip) 198 203 { 199 PS_ASSERT_PTR_NON_NULL(chip,); 204 if (!chip) { 205 return; 206 } 200 207 201 208 for (int i = 0; i < chip->cells->n; i++) { … … 217 224 void pmFPAFreeData(pmFPA *fpa) 218 225 { 219 PS_ASSERT_PTR_NON_NULL(fpa,); 226 if (!fpa) { 227 return; 228 } 220 229 221 230 for (int i = 0; i < fpa->chips->n; i++) { -
branches/eam_branch_20070817/psModules/src/imcombine/Makefile.am
r13457 r14639 7 7 pmReadoutCombine.c \ 8 8 pmStack.c \ 9 pmStackReject.c \ 9 10 pmSubtraction.c \ 10 11 pmSubtractionKernels.c \ 11 pmSubtractionStamps.c 12 pmSubtractionStamps.c \ 13 pmSubtractionMatch.c 12 14 13 15 pkginclude_HEADERS = \ 14 16 pmReadoutCombine.h \ 15 17 pmStack.h \ 18 pmStackReject.h \ 16 19 pmSubtraction.h \ 17 20 pmSubtractionKernels.h \ 18 pmSubtractionStamps.h 21 pmSubtractionStamps.h \ 22 pmSubtractionMatch.h 19 23 20 24 CLEANFILES = *~ -
branches/eam_branch_20070817/psModules/src/imcombine/pmStack.c
r14459 r14639 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $11 * @date $Date: 2007-08- 10 00:34:04$10 * @version $Revision: 1.11.2.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-08-23 22:30:43 $ 12 12 * 13 13 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 73 73 static void stackDataFree(pmStackData *data) 74 74 { 75 psFree(data->detector); 76 psFree(data->sky); 75 psFree(data->readout); 77 76 psFree(data->pixels); 78 77 return; … … 222 221 for (int i = 0; i < num; i++) { 223 222 pmStackData *data = inputs->data[i]; // Stack data of interest 224 psImage *image = data-> sky->image; // Image of interest225 psImage *weight = data-> sky->weight; // Weight map of interest226 psImage *mask = data-> sky->mask; // Mask of interest223 psImage *image = data->readout->image; // Image of interest 224 psImage *weight = data->readout->weight; // Weight map of interest 225 psImage *mask = data->readout->mask; // Mask of interest 227 226 pixelData->data.F32[i] = image->data.F32[y][x]; 228 227 if (weight) { … … 306 305 307 306 // Ensure the input array of pmStackData is valid, and get some details out of it 308 static bool validateInputData(bool *haveDetector, // Do we have the detector images? 309 bool *haveSky, // Do we have the sky images? 310 bool *haveSkyWeights, // Do we have weights in the sky images? 307 static bool validateInputData(bool *haveWeights, // Do we have weights in the sky images? 311 308 bool *havePixels, // Do we have lists of pixels? 312 309 int *num, // Number of inputs … … 317 314 PS_ASSERT_ARRAY_NON_NULL(input, false); 318 315 *num = input->n; 319 { 320 pmStackData *data = input->data[0]; // First image off the rank 321 PS_ASSERT_PTR_NON_NULL(data, false); 322 assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type 323 *haveDetector = (data->detector != NULL); 324 if (*haveDetector) { 325 PS_ASSERT_IMAGE_NON_NULL(data->detector->image, false); 326 PS_ASSERT_IMAGE_NON_NULL(data->detector->mask, false); 327 PS_ASSERT_IMAGES_SIZE_EQUAL(data->detector->image, data->detector->mask, false); 328 PS_ASSERT_IMAGE_TYPE(data->detector->image, PS_TYPE_F32, false); 329 PS_ASSERT_IMAGE_TYPE(data->detector->mask, PS_TYPE_MASK, false); 330 } 331 *haveSky = (data->sky != NULL); 332 *haveSkyWeights = false; 333 if (*haveSky) { 334 PS_ASSERT_IMAGE_NON_NULL(data->sky->image, false); 335 PS_ASSERT_IMAGE_TYPE(data->sky->image, PS_TYPE_F32, false); 336 PS_ASSERT_IMAGE_NON_NULL(data->sky->mask, false); 337 PS_ASSERT_IMAGE_TYPE(data->sky->mask, PS_TYPE_MASK, false); 338 PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->mask, false); 339 *numCols = data->sky->image->numCols; 340 *numRows = data->sky->image->numRows; 341 if (data->sky->weight) { 342 *haveSkyWeights = true; 343 PS_ASSERT_IMAGE_NON_NULL(data->sky->weight, false); 344 PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->weight, false); 345 PS_ASSERT_IMAGE_TYPE(data->sky->weight, PS_TYPE_F32, false); 346 } 347 } 348 *havePixels = (data->pixels != NULL); 349 } 316 317 // The first is a template 318 pmStackData *data = input->data[0]; // First image off the rank 319 PS_ASSERT_PTR_NON_NULL(data, false); 320 assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type 321 *haveWeights = false; 322 PS_ASSERT_IMAGE_NON_NULL(data->readout->image, false); 323 PS_ASSERT_IMAGE_TYPE(data->readout->image, PS_TYPE_F32, false); 324 PS_ASSERT_IMAGE_NON_NULL(data->readout->mask, false); 325 PS_ASSERT_IMAGE_TYPE(data->readout->mask, PS_TYPE_MASK, false); 326 PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->mask, false); 327 *numCols = data->readout->image->numCols; 328 *numRows = data->readout->image->numRows; 329 if (data->readout->weight) { 330 *haveWeights = true; 331 PS_ASSERT_IMAGE_NON_NULL(data->readout->weight, false); 332 PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->weight, false); 333 PS_ASSERT_IMAGE_TYPE(data->readout->weight, PS_TYPE_F32, false); 334 } 335 *havePixels = (data->pixels != NULL); 336 337 // Make sure the rest correspond with the first 350 338 for (int i = 1; i < *num; i++) { 351 339 pmStackData *data = input->data[i]; // Stack data for this input 352 340 assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type 353 if ((*haveDetector && !data->detector) || (data->detector && !*haveDetector)) { 354 psError(PS_ERR_UNEXPECTED_NULL, true, 355 "The detector readout is specified in some but not all inputs."); 356 return false; 357 } 358 if ((*haveSky && !data->sky) || (data->sky && !*haveSky)) { 359 psError(PS_ERR_UNEXPECTED_NULL, true, "The sky cell is specified in some but not all inputs."); 341 if (!data->readout) { 342 psError(PS_ERR_UNEXPECTED_NULL, true, "The readout is specified in some but not all inputs."); 360 343 return false; 361 344 } … … 364 347 return false; 365 348 } 366 if (*haveDetector) { 367 PS_ASSERT_IMAGE_NON_NULL(data->detector->image, false); 368 PS_ASSERT_IMAGE_NON_NULL(data->detector->mask, false); 369 PS_ASSERT_IMAGE_TYPE(data->detector->image, PS_TYPE_F32, false); 370 PS_ASSERT_IMAGE_TYPE(data->detector->mask, PS_TYPE_MASK, false); 371 PS_ASSERT_IMAGES_SIZE_EQUAL(data->detector->image, data->detector->mask, false); 372 } 373 if (*haveSky) { 374 PS_ASSERT_IMAGE_NON_NULL(data->sky->image, false); 375 PS_ASSERT_IMAGE_NON_NULL(data->sky->mask, false); 376 PS_ASSERT_IMAGE_TYPE(data->sky->image, PS_TYPE_F32, false); 377 PS_ASSERT_IMAGE_TYPE(data->sky->mask, PS_TYPE_MASK, false); 378 PS_ASSERT_IMAGE_SIZE(data->sky->image, *numCols, *numRows, false); 379 PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->mask, false); 380 if (*haveSkyWeights) { 381 PS_ASSERT_IMAGE_NON_NULL(data->sky->weight, false); 382 PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->weight, false); 383 PS_ASSERT_IMAGE_TYPE(data->sky->weight, PS_TYPE_F32, false); 384 } 349 PS_ASSERT_IMAGE_NON_NULL(data->readout->image, false); 350 PS_ASSERT_IMAGE_NON_NULL(data->readout->mask, false); 351 PS_ASSERT_IMAGE_TYPE(data->readout->image, PS_TYPE_F32, false); 352 PS_ASSERT_IMAGE_TYPE(data->readout->mask, PS_TYPE_MASK, false); 353 PS_ASSERT_IMAGE_SIZE(data->readout->image, *numCols, *numRows, false); 354 PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->mask, false); 355 if (*haveWeights) { 356 PS_ASSERT_IMAGE_NON_NULL(data->readout->weight, false); 357 PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->weight, false); 358 PS_ASSERT_IMAGE_TYPE(data->readout->weight, PS_TYPE_F32, false); 385 359 } 386 360 } … … 390 364 391 365 392 366 #if 0 393 367 // Examine a pixel carefully to see if it should be rejected in the stack by convolving all the input images 394 368 // to the same seeing, and clipping there. … … 416 390 pmStackData *data = input->data[i]; // Stacking data 417 391 int radius = extent * seeing->data.F32[i]; // How much to convolve 418 psImage *image = data-> sky->image; // Image to convolve419 psImage *mask = data-> sky->mask; // Image mask392 psImage *image = data->readout->image; // Image to convolve 393 psImage *mask = data->readout->mask; // Image mask 420 394 421 395 int xMin = PS_MAX(xPix - radius, 0); … … 476 450 return true; 477 451 } 478 452 #endif 479 453 480 454 … … 530 504 531 505 /// Constructor 532 pmStackData *pmStackDataAlloc(pmReadout * sky, float seeing, float weight)506 pmStackData *pmStackDataAlloc(pmReadout *readout, float weight) 533 507 { 534 508 pmStackData *data = psAlloc(sizeof(pmStackData)); // Stack data, to return 535 509 psMemSetDeallocator(data, (psFreeFunc)stackDataFree); 536 510 537 data->detector = NULL; 538 539 data->sky = psMemIncrRefCounter(sky); 511 data->readout = psMemIncrRefCounter(readout); 540 512 data->pixels = NULL; 541 data->seeing = seeing;542 513 data->weight = weight; 543 514 … … 550 521 { 551 522 PS_ASSERT_PTR_NON_NULL(combined, false); 552 bool haveDetector; // Do we have the detector images? 553 bool haveSky; // Do we have the sky images? 554 bool haveSkyWeights; // Do we have the sky weight maps? 523 bool haveWeights; // Do we have the weight maps? 555 524 bool havePixels; // Do we have lists of pixels? 556 525 int num; // Number of inputs 557 526 int numCols, numRows; // Size of (sky) images 558 if (!validateInputData(&haveDetector, &haveSky, &haveSkyWeights, &havePixels, &num, 559 &numCols, &numRows, input)) { 527 if (!validateInputData(&haveWeights, &havePixels, &num, &numCols, &numRows, input)) { 560 528 return false; 561 529 } … … 571 539 PS_ASSERT_IMAGES_SIZE_EQUAL(combined->image, combined->mask, false); 572 540 } 573 if (!haveDetector && !haveSky) {574 psError(PS_ERR_UNEXPECTED_NULL, true, "Nothing to combine!");575 return false;576 }577 578 579 if (!haveSky) {580 // Need to generate the sky cell images581 582 // ...583 584 #if 0585 numCols = data->sky->image->numCols;586 numRows = data->sky->image->numRows;587 #endif588 }589 541 590 542 // Pull out the weightings … … 635 587 636 588 psImage *combinedWeights = combined->weight; // Combined weight map 637 if (have SkyWeights && !combinedWeights) {589 if (haveWeights && !combinedWeights) { 638 590 combined->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32); 639 591 combinedWeights = combined->weight; … … 668 620 psFree(buffer); 669 621 670 psList *cells = psListAlloc(NULL); // List of cells, for concept update671 for (int i = 0; i < num; i++) {672 pmStackData *data = input->data[i]; // Stacking data; contains the list of pixels673 psListAdd(cells, PS_LIST_TAIL, data->sky->parent);674 }675 if (!pmConceptsAverageCells(combined->parent, cells, NULL, NULL, false)) {676 psError(PS_ERR_UNKNOWN, false, "Unable to average concepts for input sky readouts.");677 psFree(cells);678 return false;679 }680 psFree(cells);681 682 622 return true; 683 623 } 684 624 625 #if 0 685 626 bool pmStackReject(psArray *input, psMaskType maskVal, float extent, float threshold) 686 627 { 687 bool haveDetector; // Do we have the detector images? 688 bool haveSky; // Do we have the sky images? 689 bool haveSkyWeights; // Do we have the sky weight maps? 628 bool haveWeights; // Do we have the sky weight maps? 690 629 bool havePixels; // Do we have lists of pixels? 691 630 int num; // Number of inputs 692 631 int numCols, numRows; // Size of (sky) images 693 if (!validateInputData(&haveDetector, &haveSky, &haveSkyWeights, &havePixels, 694 &num, &numCols, &numRows, input)) { 632 if (!validateInputData(&haveWeights, &havePixels, &num, &numCols, &numRows, input)) { 695 633 return false; 696 634 } … … 768 706 return true; 769 707 } 770 708 #endif -
branches/eam_branch_20070817/psModules/src/imcombine/pmStack.h
r13457 r14639 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 5-22 03:59:32$10 * @version $Revision: 1.1.6.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-08-23 22:30:43 $ 12 12 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii 13 13 */ … … 26 26 /// Container for input image 27 27 typedef struct { 28 pmReadout *detector; ///< Original (unwarped) readout from the detector 29 pmReadout *sky; ///< Warped readout (sky cell) 28 pmReadout *readout; ///< Warped readout (sky cell) 30 29 psPixels *pixels; ///< Pixels to inspect or reject 31 float seeing; ///< Seeing FWHM (pixels)32 30 float weight; ///< Weight to apply 33 31 } pmStackData; 34 32 35 33 /// Constructor 36 pmStackData *pmStackDataAlloc(pmReadout *sky, ///< Warped readout (sky cell) 37 float seeing, ///< Seeing FWHM (pixels) 34 pmStackData *pmStackDataAlloc(pmReadout *readout, ///< Warped readout (sky cell) 38 35 float weight ///< Weight to apply 39 36 ); … … 61 58 #endif 62 59 60 #if 0 63 61 /// Reject pixles in input images 64 62 bool pmStackReject(psArray *input, ///< Input array of pmStackData … … 67 65 float threshold ///< Rejection threshold, in standard deviations 68 66 ); 67 #endif 69 68 70 69 #if 0 -
branches/eam_branch_20070817/psModules/src/imcombine/pmSubtraction.c
r14540 r14639 4 4 * @author GLG, MHPCC 5 5 * 6 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $7 * @date $Date: 2007-08- 17 01:50:50$6 * @version $Revision: 1.42.2.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-08-23 22:30:43 $ 8 8 * 9 9 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 24 24 25 25 #include "pmSubtraction.h" 26 27 #define PIXEL_LIST_BUFFER 100 // Number of entries to add to pixel list at a time 28 26 29 27 30 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 136 139 137 140 // Normalising sum of kernel component to unity 138 float norm = kernelWeighting(1.0 / (float)((uStop - uStart ) * (vStop - vStart)),141 float norm = kernelWeighting(1.0 / (float)((uStop - uStart + 1) * (vStop - vStart + 1)), 139 142 varianceWeighting); 140 143 … … 245 248 } 246 249 } 247 sum /= (uStop - uStart ) * (vStop - vStart); // Normalising sum of kernel component to unity250 sum /= (uStop - uStart + 1) * (vStop - vStart + 1); // Normalising sum of kernel component to unity 248 251 if (kernels->spatialOrder > 0 && index != kernels->subIndex) { 249 252 // The (0,0) element is subtracted from most kernels to preserve photometric scaling … … 880 883 } 881 884 882 float background = solution->data.F64[solution->n-1]; // The difference in background 885 int numBackground = polyTerms(kernels->bgOrder); // Number of background terms 886 float background = solution->data.F64[solution->n - numBackground]; // The difference in background 883 887 int numCols = inImage->numCols, numRows = inImage->numRows; // Image dimensions 884 888 … … 1017 1021 return true; 1018 1022 } 1023 1024 -
branches/eam_branch_20070817/psModules/src/imcombine/pmSubtraction.h
r14524 r14639 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $9 * @date $Date: 2007-08- 16 02:57:34$8 * @version $Revision: 1.9.2.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-08-23 22:30:43 $ 10 10 * Copyright 2004-207 Institute for Astronomy, University of Hawaii 11 11 */ -
branches/eam_branch_20070817/psModules/src/psmodules.h
r14613 r14639 54 54 #include <pmFPACalibration.h> 55 55 #include <pmReadoutStack.h> 56 #include <pmFPAUtils.h> 56 57 57 58 // the following headers are from psModule:detrend … … 73 74 // the following headers are from psModule:imcombine 74 75 #include <pmStack.h> 76 #include <pmStackReject.h> 75 77 #include <pmSubtraction.h> 76 78 #include <pmSubtractionStamps.h> 77 79 #include <pmSubtractionKernels.h> 80 #include <pmSubtractionMatch.h> 78 81 #include <pmReadoutCombine.h> 79 82 -
branches/eam_branch_20070817/psModules/test/camera/Makefile.am
r13644 r14639 11 11 $(PSMODULES_LIBS) 12 12 13 TEST_PROGS = 13 TEST_PROGS = \ 14 tap_pmFPAReadWrite 14 15 15 16 if BUILD_TESTS -
branches/eam_branch_20070817/psModules/test/config/data/SampleIPPConfig
r5735 r14639 1 1 ### Example .ipprc file 2 PATH STR . 3 DATAPATH str datapath 2 4 3 5 ### Database configuration 4 DBSERVER STR ippdb.ifa.hawaii.edu # Database host name (for psDBInit) 5 DBUSER STR ipp # Database user name (for psDBInit) 6 DBPASSWORD STR password # Database password (for psDBInit) 6 DBSERVER STR localhost 7 DBUSER STR test 8 DBPASSWORD STR "" 9 DBNAME STR test 10 DBPORT S32 0 7 11 8 12 ### Setups for each camera system 9 CAMERAS METADATA 10 MEGACAM_RAW STR megacam_raw.config 11 MEGACAM_SPLICE STR megacam_splice.config 12 GPC1_RAW STR gpc1_raw.config 13 LRIS_BLUE STR lris_blue.config 14 LRIS_RED STR lris_red.config 15 END 13 CAMERAS METADATA 14 CAMERA0 STR camera0/camera.config 15 CAMERA1 STR camera1/camera.config 16 END 16 17 17 ### psLib setup 18 #TIME STR /home/mithrandir/price/pan-starrs/jhroot/i686-pc-linux-gnu/etc/pslib/psTime.config # Time configuration file 19 LOGLEVEL S32 3 # Logging level; 3=INFO 20 LOGFORMAT STR HLNM # Log format 21 LOGDEST STR STDOUT # Log destination 22 TRACE METADATA # Trace levels 23 dummyTraceFunc01 S32 1 24 dummyTraceFunc02 S32 2 25 END 26 ARBITRARY_STRING_S32 S32 20 27 ARBITRARY_STRING_F32 F32 21.0 28 ARBITRARY_STRING_F64 F64 22.0 29 ARBITRARY_STRING_STR STR 19.0 30 ARBITRARY_STRING_BOOL_T BOOL true 31 ARBITRARY_STRING_BOOL_F BOOL false 18 ### Setups for psLib 19 TIME STR time.config 20 LOGLEVEL S32 3 21 LOGFORMAT STR HLNM 22 LOGDEST STR STDOUT 32 23 24 ### Default trace logging initializations 25 TRACE METADATA 26 dummyTraceFacility01 S32 1 27 dummyTraceFacility02 S32 2 28 END 29 30 ### Predefined recipe files 31 RECIPES METADATA # Site-level recipes 32 R00 STR recipes/R00.config 33 R01 STR recipes/R01.config 34 R02 STR recipes/R02.config 35 R03 STR recipes/R03.config 36 END 37 38 ### Misc arbitraty metadata 39 ARBITRARY_STRING_S32 S32 20 40 ARBITRARY_STRING_F32 F32 21.0 41 ARBITRARY_STRING_F64 F64 22.0 42 ARBITRARY_STRING_STR STR 19.0 43 ARBITRARY_STRING_BOOL_T BOOL true 44 ARBITRARY_STRING_BOOL_F BOOL false 45
Note:
See TracChangeset
for help on using the changeset viewer.
