- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (2 props)
-
psphot/src/psphotEfficiency.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot/src
- Property svn:ignore
-
old new 22 22 psphotMakePSF 23 23 psphotStack 24 psphotModelTest
-
- Property svn:mergeinfo set to
- Property svn:ignore
-
branches/meh_branches/ppstack_test/psphot/src/psphotEfficiency.c
r31452 r33415 99 99 100 100 /// Generate a fake image and add it in to the existing readout 101 static booleffGenerate(psImage **xSrc, psImage **ySrc, // Positions of sources101 static pmReadout *effGenerate(psImage **xSrc, psImage **ySrc, // Positions of sources 102 102 const pmReadout *ro, // Readout of interest 103 103 const pmPSF *psf, // Point-spread function … … 152 152 psFree(xAll); 153 153 psFree(yAll); 154 return false;154 return NULL; 155 155 } 156 156 psFree(magAll); … … 161 161 162 162 psBinaryOp(ro->image, ro->image, "+", fakeRO->image); 163 psFree(fakeRO); 164 165 return true;163 164 // return the readout so we can subtract it later 165 return fakeRO; 166 166 } 167 167 … … 169 169 { 170 170 bool status = true; 171 172 fprintf (stdout, "\n"); 173 psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Efficiency ---"); 171 174 172 175 // select the appropriate recipe information … … 252 255 253 256 // remove all sources, adding noise for subtracted sources 254 psphotRemoveAllSources (realSources, recipe);257 psphotRemoveAllSourcesByArray(realSources, recipe); 255 258 256 259 #if TESTING … … 290 293 291 294 psImage *xFake = NULL, *yFake = NULL; // Coordinates of sources, each bin in a row 292 if (!effGenerate(&xFake, &yFake, readout, psf, magOffsets,293 numSources, magLim, radius, minFlux)) {295 pmReadout *fakeRO = effGenerate(&xFake, &yFake, readout, psf, magOffsets, numSources, magLim, radius, minFlux); 296 if (!fakeRO) { 294 297 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake sources"); 295 298 psFree(xFake); … … 416 419 psFree(significance); 417 420 421 // psphotFitSourcesLinearReadout subtracts the model fits 418 422 if (!psphotFitSourcesLinearReadout(recipe, readout, fakeSourcesAll, psf, true)) { 419 423 psError(PS_ERR_UNKNOWN, false, "Unable to perform linear fit on fake sources."); … … 427 431 psf->ApTrend = NULL; 428 432 433 // measure the magnitudes and fluxes for the sources 429 434 if (!psphotMagnitudesReadout(config, recipe, view, readout, fakeSourcesAll, psf)) { 430 435 psError(PS_ERR_UNKNOWN, false, "Unable to measure magnitudes of fake sources."); … … 433 438 psf->ApTrend = apTrend; // Casting away const! 434 439 return false; 440 } 441 442 // replace the subtracted model fits 443 for (int i = 0; i < fakeSourcesAll->n; i++) { 444 pmSource *source = fakeSourcesAll->data[i]; 445 446 // replace other sources? 447 if (!(source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED)) continue; 448 449 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 435 450 } 436 451 psFree(fakeSourcesAll); … … 515 530 psFree(fakeSources); 516 531 532 // subtract the faked sources from the original image 533 psBinaryOp(readout->image, readout->image, "-", fakeRO->image); 534 psFree(fakeRO); 535 517 536 pmDetEff *de = pmDetEffAlloc(magLim, numSources, numBins); // Detection efficiency 518 537 de->magOffsets = psVectorCopy(NULL, magOffsets, PS_TYPE_F32); … … 529 548 psFree(de); 530 549 531 psLogMsg("psphot", PS_LOG_ INFO, "Detection efficiency: %lf sec\n", psTimerClear("psphot.fake"));550 psLogMsg("psphot", PS_LOG_WARN, "Detection efficiency: %lf sec\n", psTimerClear("psphot.fake")); 532 551 533 552 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
