Changeset 30772 for branches/eam_branches/ipp-20110213/psphot/src
- Timestamp:
- Mar 1, 2011, 6:21:28 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot/src
- Files:
-
- 14 edited
-
psphotApResid.c (modified) (2 diffs)
-
psphotArguments.c (modified) (1 diff)
-
psphotChoosePSF.c (modified) (1 diff)
-
psphotExtendedSourceFits.c (modified) (11 diffs)
-
psphotForcedArguments.c (modified) (2 diffs)
-
psphotMagnitudes.c (modified) (4 diffs)
-
psphotMakeGrowthCurve.c (modified) (1 diff)
-
psphotMakePSFArguments.c (modified) (2 diffs)
-
psphotSetThreads.c (modified) (1 diff)
-
psphotSourceSize.c (modified) (3 diffs)
-
psphotStackArguments.c (modified) (2 diffs)
-
psphotStackImageLoop.c (modified) (3 diffs)
-
psphotStackMatchPSFsUtils.c (modified) (1 diff)
-
psphotStackPSF.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
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.");
Note:
See TracChangeset
for help on using the changeset viewer.
