Changeset 30772
- Timestamp:
- Mar 1, 2011, 6:21:28 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213
- Files:
-
- 37 edited
-
ippconfig/gpc1/camera.config (modified) (1 diff)
-
ppImage/src/ppImageAddNoise.c (modified) (1 diff)
-
ppImage/src/ppImageArguments.c (modified) (3 diffs)
-
ppStack/src/ppStackArguments.c (modified) (3 diffs)
-
ppStack/src/ppStackFiles.c (modified) (2 diffs)
-
ppStack/src/ppStackLoop.c (modified) (1 diff)
-
ppStack/src/ppStackMatch.c (modified) (1 diff)
-
ppStack/src/ppStackReject.c (modified) (1 diff)
-
ppStack/src/ppStackThread.c (modified) (2 diffs)
-
ppStack/src/ppStackThread.h (modified) (1 diff)
-
ppSub/src/ppSub.h (modified) (2 diffs)
-
ppSub/src/ppSubArguments.c (modified) (4 diffs)
-
ppSub/src/ppSubConvolve.c (modified) (5 diffs)
-
ppSub/src/ppSubMatchPSFs.c (modified) (1 diff)
-
psLib/src/sys/psMemory.c (modified) (2 diffs)
-
psLib/src/sys/psMemory.h (modified) (1 diff)
-
psLib/src/types/psArguments.h (modified) (2 diffs)
-
psModules/src/objects/pmPSF.c (modified) (2 diffs)
-
psModules/src/objects/pmPSFtryFitPSF.c (modified) (1 diff)
-
psModules/src/objects/pmSourceMasks.h (modified) (1 diff)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (9 diffs)
-
psModules/src/objects/pmSourcePhotometry.h (modified) (1 diff)
-
psphot/src/psphotApResid.c (modified) (2 diffs)
-
psphot/src/psphotArguments.c (modified) (1 diff)
-
psphot/src/psphotChoosePSF.c (modified) (1 diff)
-
psphot/src/psphotExtendedSourceFits.c (modified) (11 diffs)
-
psphot/src/psphotForcedArguments.c (modified) (2 diffs)
-
psphot/src/psphotMagnitudes.c (modified) (4 diffs)
-
psphot/src/psphotMakeGrowthCurve.c (modified) (1 diff)
-
psphot/src/psphotMakePSFArguments.c (modified) (2 diffs)
-
psphot/src/psphotSetThreads.c (modified) (1 diff)
-
psphot/src/psphotSourceSize.c (modified) (3 diffs)
-
psphot/src/psphotStackArguments.c (modified) (2 diffs)
-
psphot/src/psphotStackImageLoop.c (modified) (3 diffs)
-
psphot/src/psphotStackMatchPSFsUtils.c (modified) (1 diff)
-
psphot/src/psphotStackPSF.c (modified) (1 diff)
-
pswarp/src/pswarpArguments.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ippconfig/gpc1/camera.config
r29921 r30772 133 133 CMF.DATA STR {CHIP.NAME}.psf # use .PSF and .EXT? 134 134 CMF.XSRC STR {CHIP.NAME}.xsrc # use .PSF and .EXT? 135 CMF.XRAD STR {CHIP.NAME}.xrad # use .PSF and .EXT? 135 136 CMF.XFIT STR {CHIP.NAME}.xfit # use .PSF and .EXT? 136 137 CMF.DETEFF STR {CHIP.NAME}.deteff -
branches/eam_branches/ipp-20110213/ppImage/src/ppImageAddNoise.c
r30680 r30772 90 90 // Update the metadata about exposure time 91 91 psMetadataAddF32(inReadout->parent->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]); 92 psMetadataAddF32(inReadout->parent->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]); 92 93 psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "EXPTIME", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]); 93 94 ppImageRandomGaussianFree(); -
branches/eam_branches/ipp-20110213/ppImage/src/ppImageArguments.c
r29833 r30772 55 55 } 56 56 57 // generic arguments (version -- ignored in this case, dumpconfig) 58 PS_ARGUMENTS_GENERIC( psphot, config, argc, argv ); 59 60 // thread arguments 61 PS_ARGUMENTS_THREADS( psphot, config, argc, argv ) 62 57 63 // save the following additional recipe values based on command-line options 58 64 // these options override the PPIMAGE recipe values loaded from recipe files … … 84 90 psArgumentRemove(argnum, &argc, argv); 85 91 pmVisualSetVisual(true); 86 }87 88 // Number of threads89 if ((argnum = psArgumentGet(argc, argv, "-threads"))) {90 psArgumentRemove(argnum, &argc, argv);91 int nThreads = atoi(argv[argnum]);92 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NTHREADS", 0, "number of warp threads", nThreads);93 psArgumentRemove(argnum, &argc, argv);94 95 // create the thread pool with number of desired threads, supplying our thread launcher function96 // XXX need to determine the number of threads from the config data97 psThreadPoolInit (nThreads);98 92 } 99 93 … … 152 146 } 153 147 154 if ((argnum = psArgumentGet(argc, argv, "-dumpconfig"))) {155 psArgumentRemove(argnum, &argc, argv);156 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DUMP_CONFIG", PS_META_REPLACE,157 "Filename for configuration dump", argv[argnum]);158 psArgumentRemove(argnum, &argc, argv);159 }160 161 148 if (argc != 2) usage (); 162 149 -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackArguments.c
r30620 r30772 110 110 { 111 111 assert(config); 112 113 // generic arguments (version, dumpconfig) 114 PS_ARGUMENTS_GENERIC( ppStack, config, argc, argv ); 115 116 // thread arguments 117 PS_ARGUMENTS_THREADS( ppStack, config, argc, argv ) 112 118 113 119 { … … 181 187 psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-variance", 0, "Suffix for temporary variance maps", NULL); 182 188 psMetadataAddBool(arguments, PS_LIST_TAIL, "-temp-delete", 0, "Delete temporary files on completion?", false); 183 psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads to use", 0);184 189 psMetadataAddBool(arguments, PS_LIST_TAIL, "-visual", 0, "visualisation", false); 185 190 … … 238 243 valueArgStr(arguments, "-stats", "STATS", arguments); 239 244 240 int numThreads = psMetadataLookupS32(NULL, arguments, "-threads"); // Number of threads241 if (numThreads > 0 && !psThreadPoolInit(numThreads)) {242 psError(PPSTACK_ERR_ARGUMENTS, false, "Unable to setup %d threads", numThreads);243 return false;244 }245 246 245 psMetadataAddBool(arguments, PS_LIST_TAIL, "PPSTACK.DEBUG.STACK", 0, 247 246 "Read old convolved images to debug stack?", debugStack); -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackFiles.c
r30620 r30772 65 65 for (int i = 0; i < numLeaks; i++) { 66 66 psMemBlock *mb = leaks[i]; 67 fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, 68 mb->file, mb->lineno); 67 fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, mb->file, mb->lineno); 69 68 total += mb->userMemorySize; 70 69 } … … 75 74 num++; 76 75 } 77 78 79 76 80 77 // Activate/deactivate a list of files -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackLoop.c
r30620 r30772 55 55 } 56 56 57 // Start threading 58 ppStackThreadInit(); 57 // Define threading elements 59 58 ppStackThreadData *stack = ppStackThreadDataSetup(options, config, true); 60 59 if (!stack) { -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackMatch.c
r30684 r30772 142 142 bool mdok; // Status of MD lookup 143 143 float penalty = psMetadataLookupF32(NULL, ppsub, "PENALTY"); // Penalty for wideness 144 int threads = psMetadataLookupS32(NULL, config->arguments, " -threads"); // Number of threads144 int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads 145 145 146 146 // Replaced pmReadoutMaskNonfinite with pmReadoutMaskInvalid (tests for already masked pixels) -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackReject.c
r30620 r30772 55 55 56 56 // Reject bad pixels 57 if (psMetadataLookupS32(NULL, config->arguments, " -threads") > 0) {57 if (psMetadataLookupS32(NULL, config->arguments, "NTHREADS") > 0) { 58 58 pmStackRejectThreadsInit(); 59 59 } -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.c
r30620 r30772 101 101 } 102 102 103 int numThreads = psMetadataLookupS32(NULL, config->arguments, " -threads"); // Number of threads103 int numThreads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads 104 104 105 105 // Generate readouts for each input file in each file group … … 248 248 249 249 250 void ppStack ThreadInit(void)250 void ppStackSetThreads(void) 251 251 { 252 252 static bool threaded = false; // Are we running threaded? -
branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.h
r30620 r30772 43 43 44 44 // Initialise the threads 45 void ppStack ThreadInit(void);45 void ppStackSetThreads(void); 46 46 47 47 -
branches/eam_branches/ipp-20110213/ppSub/src/ppSub.h
r29937 r30772 128 128 void ppSubVersionPrint(void); 129 129 130 /// write the version info to a string 131 psString ppSubVersionLong(void); 132 130 133 /// Mark the data quality as bad and prepare to suspend processing 131 134 void ppSubDataQuality(ppSubData *data, ///< Processing data … … 185 188 bool ppSubSetSourceImageIDs (psArray *sources, int imageID); 186 189 190 void ppSubSetThreads (void); 191 187 192 ///@} 188 193 #endif -
branches/eam_branches/ipp-20110213/ppSub/src/ppSubArguments.c
r29937 r30772 57 57 } 58 58 59 void ppSubSetThreads (void) { 60 // ppSub does not have any of its own thread handlers 61 return; 62 } 63 59 64 bool ppSubArguments(int argc, char *argv[], ppSubData *data) 60 65 { … … 62 67 pmConfig *config = data->config; 63 68 assert(config); 69 70 // generic arguments (version, dumpconfig) 71 PS_ARGUMENTS_GENERIC( ppSub, config, argc, argv ); 72 73 // thread arguments 74 PS_ARGUMENTS_THREADS( ppSub, config, argc, argv ) 64 75 65 76 int argNum = psArgumentGet(argc, argv, "-debug"); // Debugging argument number … … 82 93 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL); 83 94 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stamps", 0, "Stamps filename; x,y on each line", NULL); 84 psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads", 0);85 psMetadataAddStr(arguments, PS_LIST_TAIL, "-dumpconfig", 0, "file to dump configuration to", NULL);86 95 psMetadataAddS32(arguments, PS_LIST_TAIL, "-convolve", 0, "Image to convolve [1 or 2]", 0); 87 96 psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Perform photometry?", NULL); … … 166 175 } 167 176 168 int threads = psMetadataLookupS32(NULL, arguments, "-threads"); // Number of threads169 if (threads > 0) {170 if (!psThreadPoolInit(threads)) {171 psError(psErrorCodeLast(), false, "Unable to setup %d threads", threads);172 return false;173 }174 }175 176 177 psTrace("ppSub", 1, "Done reading command-line arguments\n"); 177 178 -
branches/eam_branches/ipp-20110213/ppSub/src/ppSubConvolve.c
r29551 r30772 39 39 } 40 40 41 void ppSubSetThreads (void) { 42 // ppSub does not have any of its own thread handlers 43 return; 44 } 41 45 42 46 int main(int argc, char *argv[]) … … 49 53 goto die; 50 54 } 55 56 // generic arguments (version, dumpconfig) 57 PS_ARGUMENTS_GENERIC( ppSub, config, argc, argv ); 58 59 // thread arguments 60 PS_ARGUMENTS_THREADS( ppSub, config, argc, argv ) 51 61 52 62 bool reference = false; // Input is actually the reference image? … … 59 69 psMetadataAddStr(arguments, PS_LIST_TAIL, "-kernel", 0, "Convolution kernel", NULL); 60 70 psMetadataAddBool(arguments, PS_LIST_TAIL, "-reference", 0, "Input is actually reference?", false); 61 psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Threads to use", 0);62 71 psMetadataAddBool(arguments, PS_LIST_TAIL, "-save-all", 0, "Save all outputs?", false); 63 72 … … 75 84 76 85 reference = psMetadataLookupBool(NULL, arguments, "-reference"); 77 threads = psMetadataLookupS32(NULL, arguments, " -threads");86 threads = psMetadataLookupS32(NULL, arguments, "NTHREADS"); 78 87 fileList("PPSUB.INPUT", inImage, "Input image", config); 79 88 fileList("PPSUB.INPUT.MASK", inMask, "Input mask", config); … … 239 248 if (threads > 0) { 240 249 pmSubtractionThreadsInit(); 241 psThreadPoolInit(threads);242 250 } 243 251 -
branches/eam_branches/ipp-20110213/ppSub/src/ppSubMatchPSFs.c
r30619 r30772 374 374 } 375 375 376 int threads = psMetadataLookupS32(NULL, config->arguments, " -threads"); // Number of threads376 int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads 377 377 if (threads > 0) { 378 378 pmSubtractionThreadsInit(); -
branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.c
r30595 r30772 27 27 #include <string.h> 28 28 #include <assert.h> 29 #include <unistd.h> 29 30 30 31 #if defined(PS_MEM_BACKTRACE) && defined(HAVE_BACKTRACE) … … 1090 1091 return (memBlock1->freeFunc == memBlock2->freeFunc); 1091 1092 } 1093 1094 bool static dumpMemory = false; 1095 1096 void psMemDumpSetState (bool state) { 1097 dumpMemory = state; 1098 } 1099 1100 void psMemDump(const char *name) 1101 { 1102 if (!dumpMemory) return; 1103 1104 char filename[1024]; // don't make your sub-names too long! 1105 static int num = 0; // Counter, to make files unique and give an idea of sequence 1106 1107 snprintf (filename, 1024, "memdump_%s_%03d.txt", name, num); 1108 FILE *memFile = fopen(filename, "w"); 1109 1110 psMemBlock **leaks = NULL; 1111 int numLeaks = psMemCheckLeaks(0, &leaks, NULL, true); 1112 fprintf(memFile, "# MemBlock Size Source\n"); 1113 unsigned long total = 0; // Total memory used 1114 for (int i = 0; i < numLeaks; i++) { 1115 psMemBlock *mb = leaks[i]; 1116 fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, mb->file, mb->lineno); 1117 total += mb->userMemorySize; 1118 } 1119 fclose(memFile); 1120 psFree(leaks); 1121 1122 fprintf(stderr, "Memdump %s %d: Memory use: %ld, sbrk: %p\n", name, num, total, (void *) sbrk(0)); 1123 num++; 1124 } -
branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.h
r26892 r30772 647 647 ); 648 648 649 void psMemDumpSetState (bool state); 650 void psMemDump(const char *name); 651 649 652 // Ensure this is a psLib pointer 650 653 #define PS_ASSERT_PTR_HEAVY(PTR, RVAL) \ -
branches/eam_branches/ipp-20110213/psLib/src/types/psArguments.h
r24143 r30772 81 81 * specific routine called pkgnameVersionLong() is presumed to exist. 82 82 */ 83 #define PS ARGUMENTS_INSTANTIATE_GENERICS( pkgname, config, argc, argv ) \83 #define PS_ARGUMENTS_GENERIC( pkgname, config, argc, argv ) \ 84 84 { int N= psArgumentGet (argc, argv, "-version"); \ 85 85 if (N) { \ … … 115 115 * presumed to exist. 116 116 */ 117 #define PS ARGUMENTS_INSTANTIATE_THREADSARG( pkgname, config, argc, argv ) \117 #define PS_ARGUMENTS_THREADS( pkgname, config, argc, argv ) \ 118 118 { int N= psArgumentGet(argc, argv, "-threads"); \ 119 119 if (N) { \ -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSF.c
r29004 r30772 430 430 return NAN; 431 431 } 432 433 // get the model full-width at half-max 434 float fwhmMajor = 2*model->modelRadius (model->params, 0.5); 435 436 # if (0) 432 437 psF32 *params = model->params->data.F32; // Model parameters 433 438 psEllipseAxes axes = pmPSF_ModelToAxes(params, MAX_AXIS_RATIO); // Ellipse axes … … 439 444 440 445 return fwhm; 441 } 446 # else 447 448 psFree(model); 449 450 return fwhmMajor; 451 # endif 452 } -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSFtryFitPSF.c
r30621 r30772 109 109 110 110 // This function calculates the psf and aperture magnitudes 111 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal, markVal ); // raw PSF mag, AP mag111 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal, markVal, options->apRadius); // raw PSF mag, AP mag 112 112 if (!status || isnan(source->apMag)) { 113 113 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); // clear the circular mask -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceMasks.h
r29546 r30772 46 46 PM_SOURCE_MODE2_DIFF_WITH_DOUBLE = 0x00000002, ///< diff source matched to positive detections in both images 47 47 PM_SOURCE_MODE2_MATCHED = 0x00000004, ///< diff source matched to positive detections in both images 48 49 PM_SOURCE_MODE2_ON_SPIKE = 0x00000008, ///< > 25% of (PSF-weighted) pixels land on diffraction spike 50 PM_SOURCE_MODE2_ON_STARCORE = 0x00000010, ///< > 25% of (PSF-weighted) pixels land on starcore 51 PM_SOURCE_MODE2_ON_BURNTOOL = 0x00000020, ///< > 25% of (PSF-weighted) pixels land on burntool 52 PM_SOURCE_MODE2_ON_CONVPOOR = 0x00000040, ///< > 25% of (PSF-weighted) pixels land on convpoor 48 53 } pmSourceMode2; 49 54 -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.c
r30763 r30772 23 23 #include "pmFPAMaskWeight.h" 24 24 25 #include "pmConfigMask.h" 25 26 #include "pmTrend2D.h" 26 27 #include "pmResiduals.h" … … 49 50 static float AP_MIN_SN = 0.0; 50 51 51 bool pmSourceMagnitudesInit (psMetadata *config) 52 { 53 PS_ASSERT_PTR_NON_NULL(config, false); 52 // make this a bit more clever and dynamic 53 static psImageMaskType maskSuspect = 0; 54 static psImageMaskType maskSpike = 0; 55 static psImageMaskType maskStarCore = 0; 56 static psImageMaskType maskBurntool = 0; 57 static psImageMaskType maskConvPoor = 0; 58 59 bool pmSourceMagnitudesInit (pmConfig *config, psMetadata *recipe) 60 { 61 PS_ASSERT_PTR_NON_NULL(recipe, false); 54 62 bool status; 55 63 56 float limit = psMetadataLookupF32 (&status, config, "AP_MIN_SN"); 64 // we are going to test specially against these poor values 65 if (config) { 66 maskSpike = pmConfigMaskGet("SPIKE", config); 67 maskStarCore = pmConfigMaskGet("STARCORE", config); 68 maskBurntool = pmConfigMaskGet("BURNTOOL", config); 69 maskConvPoor = pmConfigMaskGet("CONV.POOR", config); 70 maskSuspect = maskSpike | maskStarCore | maskBurntool | maskConvPoor; 71 } 72 73 float limit = psMetadataLookupF32 (&status, recipe, "AP_MIN_SN"); 57 74 if (status) { 58 75 AP_MIN_SN = limit; … … 77 94 // XXX masked region should be (optionally) elliptical 78 95 // if mode is PM_SOURCE_PHOT_PSFONLY, we skip all other magnitudes 79 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal )96 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal, float radius) 80 97 { 81 98 PS_ASSERT_PTR_NON_NULL(source, false); … … 166 183 // measure the contribution of included pixels 167 184 if (mode & PM_SOURCE_PHOT_WEIGHT) { 168 pmSourcePixelWeight ( &source->pixWeightNotBad, &source->pixWeightNotPoor, model, source->maskObj, maskVal, markVal);185 pmSourcePixelWeight (source, model, source->maskObj, maskVal, radius); 169 186 } 170 187 … … 342 359 343 360 // return source aperture magnitude 344 bool pmSourcePixelWeight (float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal) 345 { 346 PS_ASSERT_PTR_NON_NULL(pixWeightNotBad, false); 347 PS_ASSERT_PTR_NON_NULL(pixWeightNotPoor, false); 361 bool pmSourcePixelWeight (pmSource *source, pmModel *model, psImage *mask, psImageMaskType maskVal, float radius) 362 { 363 PS_ASSERT_PTR_NON_NULL(source, false); 364 source->pixWeightNotBad = NAN; 365 source->pixWeightNotPoor = NAN; 366 348 367 PS_ASSERT_PTR_NON_NULL(mask, false); 349 368 PS_ASSERT_PTR_NON_NULL(model, false); … … 355 374 float value; 356 375 376 float spikeSum = 0; 377 float starcoreSum = 0; 378 float burntoolSum = 0; 379 float convpoorSum = 0; 380 357 381 int Xo, Yo, dP; 358 382 int dX, DX, NX; 359 383 int dY, DY, NY; 360 384 361 *pixWeightNotBad = 0.0; 362 *pixWeightNotPoor = 0.0; 385 float radius2 = PS_SQR(radius); 363 386 364 387 // we only care about the value of the object model, not the local sky … … 387 410 NY = mask->numRows; 388 411 412 psImageMaskType maskBad = maskVal; 413 maskBad &= ~maskSuspect; 414 389 415 // measure modelSum and validSum. this function is applied to a sources' subimage. the 390 416 // value of DX is chosen (see above) to cover the full possible size of the subimage if it 391 417 // were not by an edge; ie, if the source is cut in half by an image edge, we correctly 392 418 // count the virtual pixels off the edge in normalizing the value of the pixWeight 419 420 // we skip any pixels [real or virtual] outside of the specified radius (nominally the aperture radius) 393 421 for (int ix = -DX; ix < DX + 1; ix++) { 422 if (ix > radius) continue; 394 423 int mx = ix + dX; 395 424 for (int iy = -DY; iy < DY + 1; iy++) { 425 if (iy > radius) continue; 426 if (ix*ix + iy*iy > radius2) continue; 396 427 int my = iy + dY; 397 428 … … 409 440 if (my >= NY) continue; 410 441 411 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)) { 442 // count pixels which are masked only with bad pixels 443 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskBad)) { 412 444 notBadSum += value; 413 445 } 414 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & ~markVal)) { 446 447 // count pixels which are masked with an mask bit (bad or poor) 448 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)) { 415 449 notPoorSum += value; 416 450 } 451 452 // count pixels which are masked with an mask bit (bad or poor) 453 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskSpike) { 454 spikeSum += value; 455 } 456 // count pixels which are masked with an mask bit (bad or poor) 457 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskStarCore) { 458 starcoreSum += value; 459 } 460 // count pixels which are masked with an mask bit (bad or poor) 461 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskBurntool) { 462 burntoolSum += value; 463 } 464 // count pixels which are masked with an mask bit (bad or poor) 465 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskConvPoor) { 466 convpoorSum += value; 467 } 417 468 } 418 469 } 419 470 psFree (coord); 420 471 421 *pixWeightNotBad = notBadSum / modelSum; 422 *pixWeightNotPoor = notPoorSum / modelSum; 423 424 if (false && isfinite(*pixWeightNotBad) && isfinite(*pixWeightNotPoor)) { 425 psAssert (*pixWeightNotBad <= *pixWeightNotPoor, "error: all bad pixels should also be poor"); 472 source->pixWeightNotBad = notBadSum / modelSum; 473 source->pixWeightNotPoor = notPoorSum / modelSum; 474 475 if ((spikeSum/modelSum) > 0.25) { 476 source->mode2 |= PM_SOURCE_MODE2_ON_SPIKE; 477 } 478 if ((starcoreSum/modelSum) > 0.25) { 479 source->mode2 |= PM_SOURCE_MODE2_ON_STARCORE; 480 } 481 if ((burntoolSum/modelSum) > 0.25) { 482 source->mode2 |= PM_SOURCE_MODE2_ON_BURNTOOL; 483 } 484 if ((convpoorSum/modelSum) > 0.25) { 485 source->mode2 |= PM_SOURCE_MODE2_ON_CONVPOOR; 486 } 487 488 if (isfinite(source->pixWeightNotBad) && isfinite(source->pixWeightNotPoor)) { 489 psAssert (source->pixWeightNotBad <= source->pixWeightNotPoor, "error: all bad pixels should also be poor"); 426 490 } 427 491 … … 431 495 # define FLUX_LIMIT 3.0 432 496 433 // measure stats that may be us ingin difference images for distinguishing real sources from bad residuals497 // measure stats that may be used in difference images for distinguishing real sources from bad residuals 434 498 bool pmSourceMeasureDiffStats (pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 435 499 { -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.h
r30763 r30772 64 64 ); 65 65 66 bool pmSourceMagnitudesInit (p sMetadata *config);67 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal );66 bool pmSourceMagnitudesInit (pmConfig *config, psMetadata *recipe); 67 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal, float radius); 68 68 69 bool pmSourcePixelWeight ( float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal);69 bool pmSourcePixelWeight (pmSource *source, pmModel *model, psImage *mask, psImageMaskType maskVal, float radius); 70 70 71 71 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psImageMaskType maskVal, const float covarFactor, int nParams); -
branches/eam_branches/ipp-20110213/psphot/src/psphotApResid.c
r30764 r30772 117 117 118 118 // set limits on the aperture magnitudes 119 pmSourceMagnitudesInit ( recipe);119 pmSourceMagnitudesInit (config, recipe); 120 120 121 121 // threaded measurement of the source magnitudes … … 466 466 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal); 467 467 468 bool status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal );468 bool status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius); 469 469 470 470 // clear the mask bit -
branches/eam_branches/ipp-20110213/psphot/src/psphotArguments.c
r29004 r30772 109 109 } 110 110 111 PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv ); 111 // generic arguments (version, dumpconfig) 112 PS_ARGUMENTS_GENERIC( psphot, config, argc, argv ); 113 114 // thread arguments 115 PS_ARGUMENTS_THREADS( psphot, config, argc, argv ) 112 116 113 117 // save the following additional recipe values based on command-line options 114 118 // these options override the PSPHOT recipe values loaded from recipe files 115 119 psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE); 116 117 // Number of threads is handled118 PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )119 120 120 121 // run the test model (requires X,Y coordinate) -
branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c
r30764 r30772 448 448 } 449 449 psFree (modelPSF); 450 451 // float fwhmtest = pmPSFtoFWHM(psf, xc, yc); 452 // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest); 450 453 } 451 454 } -
branches/eam_branches/ipp-20110213/psphot/src/psphotExtendedSourceFits.c
r30764 r30772 43 43 int NplainPass = 0; 44 44 int Nfaint = 0; 45 int Nfail = 0; 45 46 46 47 psTimerStart ("psphot.extended"); … … 176 177 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nplain 177 178 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for NplainPass 178 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfain 179 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfaint 180 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail 179 181 180 182 // set this to 0 to run without threading … … 204 206 scalar = job->args->data[12]; 205 207 Nfaint += scalar->data.S32; 208 scalar = job->args->data[13]; 209 Nfail += scalar->data.S32; 206 210 psFree(job); 207 211 # endif … … 234 238 scalar = job->args->data[12]; 235 239 Nfaint += scalar->data.S32; 240 scalar = job->args->data[13]; 241 Nfail += scalar->data.S32; 236 242 } 237 243 psFree(job); … … 244 250 psLogMsg ("psphot", PS_LOG_INFO, " %d convolved models (%d passed)\n", Nconvolve, NconvolvePass); 245 251 psLogMsg ("psphot", PS_LOG_INFO, " %d plain models (%d passed)\n", Nplain, NplainPass); 246 psLogMsg ("psphot", PS_LOG_INFO, " %d too faint to fit \n", Nfaint);252 psLogMsg ("psphot", PS_LOG_INFO, " %d too faint to fit, %d failed\n", Nfaint, Nfail); 247 253 return true; 248 254 } … … 253 259 bool status; 254 260 int Next = 0; 261 int Nfaint = 0; 262 int Nfail = 0; 255 263 int Nconvolve = 0; 256 264 int NconvolvePass = 0; 257 265 int Nplain = 0; 258 int Nfaint = 0;259 266 int NplainPass = 0; 260 267 bool savePics = false; … … 271 278 psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[6],PS_TYPE_IMAGE_MASK_DATA); 272 279 273 pthread_t tid = pthread_self(); // Thread identifier280 // pthread_t tid = pthread_self(); // Thread identifier 274 281 275 282 // Define source fitting parameters for extended source fits … … 305 312 // if (source->modelEXT == NULL) continue; 306 313 307 fprintf (stderr, "fit %d,%d in thread %d\n", source->peak->x, source->peak->y, (int) tid);314 // fprintf (stderr, "fit %d,%d in thread %d\n", source->peak->x, source->peak->y, (int) tid); 308 315 309 316 // replace object in image … … 398 405 if (!modelFit) { 399 406 psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->Mx, source->moments->My); 407 Nfail ++; 400 408 continue; 401 409 } … … 412 420 if (!modelFit) { 413 421 psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->Mx, source->moments->My); 422 Nfail ++; 414 423 continue; 415 424 } … … 529 538 scalar->data.S32 = Nfaint; 530 539 540 scalar = job->args->data[13]; 541 scalar->data.S32 = Nfail; 542 531 543 return true; 532 544 } -
branches/eam_branches/ipp-20110213/psphot/src/psphotForcedArguments.c
r25981 r30772 103 103 } 104 104 105 PS ARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );105 PS_ARGUMENTS_GENERIC( psphot, config, argc, argv ); 106 106 107 107 // save the following additional recipe values based on command-line options … … 110 110 111 111 // Number of threads is handled 112 PS ARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )112 PS_ARGUMENTS_THREADS( psphot, config, argc, argv ) 113 113 114 114 // visual : interactive display mode -
branches/eam_branches/ipp-20110213/psphot/src/psphotMagnitudes.c
r29936 r30772 76 76 maskVal |= markVal; 77 77 78 pmSourceMagnitudesInit ( recipe);78 pmSourceMagnitudesInit (config, recipe); 79 79 80 80 // the binning details are saved on the analysis metadata … … 176 176 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal); 177 177 178 status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal );178 status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius); 179 179 if (status && isfinite(source->apMag)) Nap ++; 180 180 … … 295 295 psArray *sources = job->args->data[0]; 296 296 psImageMaskType maskVal = PS_SCALAR_VALUE(job->args->data[1],PS_TYPE_IMAGE_MASK_DATA); 297 psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[2],PS_TYPE_IMAGE_MASK_DATA);298 297 299 298 for (int i = 0; i < sources->n; i++) { … … 309 308 } 310 309 311 status = pmSourcePixelWeight ( &source->pixWeightNotBad, &source->pixWeightNotPoor, model, source->maskObj, maskVal, markVal);310 status = pmSourcePixelWeight (source, model, source->maskObj, maskVal, source->apRadius); 312 311 if (!status) { 313 312 psTrace ("psphot", 3, "fail to measure pixel weight"); -
branches/eam_branches/ipp-20110213/psphot/src/psphotMakeGrowthCurve.c
r21183 r30772 8 8 9 9 // set limits on the aperture magnitudes 10 pmSourceMagnitudesInit ( recipe);10 pmSourceMagnitudesInit (NULL, recipe); 11 11 12 12 // bit-masks to test for good/bad pixels -
branches/eam_branches/ipp-20110213/psphot/src/psphotMakePSFArguments.c
r25982 r30772 103 103 } 104 104 105 PS ARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );105 PS_ARGUMENTS_GENERIC( psphot, config, argc, argv ); 106 106 107 107 // save the following additional recipe values based on command-line options … … 110 110 111 111 // Number of threads is handled 112 PS ARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )112 PS_ARGUMENTS_THREADS( psphot, config, argc, argv ) 113 113 114 114 // visual : interactive display mode -
branches/eam_branches/ipp-20110213/psphot/src/psphotSetThreads.c
r30624 r30772 35 35 psFree(task); 36 36 37 task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 1 3);37 task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 14); 38 38 task->function = &psphotExtendedSourceFits_Threaded; 39 39 psThreadTaskAdd(task); -
branches/eam_branches/ipp-20110213/psphot/src/psphotSourceSize.c
r30624 r30772 207 207 num++; 208 208 209 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal );209 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius); 210 210 211 211 float kMag = -2.5*log10(source->moments->KronFlux); … … 327 327 328 328 // XXX can we test if psfMag is set and calculate only if needed? 329 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal );329 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius); 330 330 331 331 // convert to Mmaj, Mmin: … … 501 501 // psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(options->markVal)); 502 502 // psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", options->markVal); 503 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal );503 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius); 504 504 505 505 // clear the mask bit -
branches/eam_branches/ipp-20110213/psphot/src/psphotStackArguments.c
r30624 r30772 22 22 } 23 23 24 // -version and -dumpconfig arguments 25 PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv ); 24 // generic arguments (version, dumpconfig) 25 PS_ARGUMENTS_GENERIC( psphot, config, argc, argv ); 26 27 // thread arguments 28 PS_ARGUMENTS_THREADS( psphot, config, argc, argv ) 26 29 27 30 // save the following additional recipe values based on command-line options … … 29 32 psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE); 30 33 31 // Number of threads is handled32 PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )33 34 34 // visual : interactive display mode 35 35 if ((N = psArgumentGet (argc, argv, "-visual"))) { 36 36 psArgumentRemove (N, &argc, argv); 37 37 pmVisualSetVisual(true); 38 } 39 40 // memdump : enable memory spot checks 41 if ((N = psArgumentGet (argc, argv, "-memdump"))) { 42 psArgumentRemove (N, &argc, argv); 43 psMemDumpSetState(true); 38 44 } 39 45 -
branches/eam_branches/ipp-20110213/psphot/src/psphotStackImageLoop.c
r30624 r30772 50 50 psLogMsg ("psphot", 6, "Readout %d: %x %x\n", view->readout, cell->file_exists, cell->process); 51 51 if (! readout->data_exists) { continue; } 52 53 psMemDump("load"); 52 54 53 55 // PSF matching … … 57 59 return false; 58 60 } 61 psMemDump("stackmatch"); 59 62 60 63 // XXX for now, we assume there is only a single chip in the PHU: … … 64 67 return false; 65 68 } 66 69 psMemDump("psphot"); 67 70 } 68 71 // drop all versions of the internal files -
branches/eam_branches/ipp-20110213/psphot/src/psphotStackMatchPSFsUtils.c
r30707 r30772 287 287 288 288 float penalty = psMetadataLookupF32(NULL, subRecipe, "PENALTY"); // Penalty for wideness 289 int threads = psMetadataLookupS32(NULL, config->arguments, " -threads"); // Number of threads289 int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads 290 290 291 291 int order = psMetadataLookupS32(NULL, subRecipe, "SPATIAL.ORDER"); // Spatial polynomial order -
branches/eam_branches/ipp-20110213/psphot/src/psphotStackPSF.c
r30624 r30772 56 56 } 57 57 58 float Sxx = sqrt(2.0)*targetFWHM / 2.35; 58 // measured scale factors (fwhm = Sxx * 2.35 * scaleFactor / sqrt(2.0)) 59 // GAUSS : 1.000 60 // PGAUSS : 1.006 61 // QGAUSS : 1.151 62 // RGAUSS : 0.883 63 // PS1_V1 : 1.134 64 65 float scaleFactor = NAN; 66 if (!strcmp(psfModel, "PS_MODEL_GAUSS")) { 67 scaleFactor = 1.000; 68 } 69 if (!strcmp(psfModel, "PS_MODEL_PGAUSS")) { 70 scaleFactor = 1.0006; 71 } 72 if (!strcmp(psfModel, "PS_MODEL_QGAUSS")) { 73 scaleFactor = 1.151; 74 } 75 if (!strcmp(psfModel, "PS_MODEL_RGAUSS")) { 76 scaleFactor = 0.883; 77 } 78 if (!strcmp(psfModel, "PS_MODEL_PS1_V1")) { 79 scaleFactor = 1.134; 80 } 81 psAssert (isfinite(scaleFactor), "invalid model for PSF"); 82 83 float Sxx = sqrt(2.0)*targetFWHM / 2.35 / scaleFactor; 59 84 60 85 // XXX probably should make the model type (and par 7) optional from recipe 61 psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0); 86 // psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0); 87 psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 0.2); 62 88 if (!psf) { 63 89 psError(PSPHOT_ERR_PSF, false, "Unable to build dummy PSF."); -
branches/eam_branches/ipp-20110213/pswarp/src/pswarpArguments.c
r27227 r30772 42 42 } 43 43 44 // generic arguments (version, dumpconfig) 45 PS_ARGUMENTS_GENERIC( pswarp, config, argc, argv ); 46 47 // thread arguments 48 PS_ARGUMENTS_THREADS( pswarp, config, argc, argv ) 49 44 50 // save the following additional recipe values based on command-line options 45 51 // these options override the PSWARP recipe values loaded from recipe files … … 76 82 } 77 83 78 // Number of threads79 if ((N = psArgumentGet(argc, argv, "-threads"))) {80 psArgumentRemove(N, &argc, argv);81 int nThreads = atoi(argv[N]);82 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NTHREADS", 0, "number of warp threads", nThreads);83 psArgumentRemove(N, &argc, argv);84 85 // create the thread pool with number of desired threads, supplying our thread launcher function86 // XXX need to determine the number of threads from the config data87 psThreadPoolInit (nThreads);88 }89 84 pswarpSetThreads(); 90 91 if ((N = psArgumentGet(argc, argv, "-dumpconfig"))) {92 psArgumentRemove(N, &argc, argv);93 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DUMP_CONFIG", PS_META_REPLACE,94 "Filename for configuration dump", argv[N]);95 psArgumentRemove(N, &argc, argv);96 }97 98 85 99 86 pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
Note:
See TracChangeset
for help on using the changeset viewer.
