Changeset 27838 for branches/tap_branches/psphot/src/psphotMagnitudes.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotMagnitudes.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psphot merged eligible /branches/eam_branches/stackphot.20100406/psphot 27622-27655 /branches/pap_delete/psphot 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/psphot/src
- Property svn:ignore
-
old new 19 19 psphotMomentsStudy 20 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/tap_branches/psphot/src/psphotMagnitudes.c
r25755 r27838 1 1 # include "psphotInternal.h" 2 2 3 bool psphotMagnitudes(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources, const pmPSF *psf) { 3 bool psphotMagnitudes (pmConfig *config, const pmFPAview *view) 4 { 5 bool status = true; 6 7 // select the appropriate recipe information 8 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 9 psAssert (recipe, "missing recipe?"); 10 11 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 12 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 13 14 // skip the chisq image (optionally?) 15 int chisqNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.CHISQ.NUM"); 16 if (!status) chisqNum = -1; 17 18 // loop over the available readouts 19 for (int i = 0; i < num; i++) { 20 if (i == chisqNum) continue; // skip chisq image 21 22 // find the currently selected readout 23 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", i); // File of interest 24 psAssert (file, "missing file?"); 25 26 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 27 psAssert (readout, "missing readout?"); 28 29 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 30 psAssert (detections, "missing detections?"); 31 32 psArray *sources = detections->allSources; 33 psAssert (sources, "missing sources?"); 34 35 pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF"); 36 psAssert (psf, "missing psf?"); 37 38 if (!psphotMagnitudesReadout (config, recipe, view, readout, sources, psf)) { 39 psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for PSPHOT.INPUT entry %d", i); 40 return false; 41 } 42 } 43 return true; 44 } 45 46 bool psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf) { 4 47 5 48 bool status = false; 6 49 int Nap = 0; 7 50 51 if (!sources->n) { 52 psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping source magnitudes"); 53 return true; 54 } 55 8 56 psTimerStart ("psphot.mags"); 9 10 // select the appropriate recipe information11 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);12 assert (recipe);13 57 14 58 // determine the number of allowed threads … … 41 85 } 42 86 43 bool IGNORE_GROWTH = psMetadataLookupBool (&status, recipe, "IGNORE_GROWTH");87 bool IGNORE_GROWTH = psMetadataLookupBool (&status, recipe, "IGNORE_GROWTH"); 44 88 bool INTERPOLATE_AP = psMetadataLookupBool (&status, recipe, "INTERPOLATE_AP"); 89 bool DIFF_STATS = psMetadataLookupBool (&status, recipe, "INTERPOLATE_AP"); 45 90 46 91 pmSourcePhotometryMode photMode = PM_SOURCE_PHOT_APCORR | PM_SOURCE_PHOT_WEIGHT; 47 92 if (!IGNORE_GROWTH) photMode |= PM_SOURCE_PHOT_GROWTH; 48 93 if (INTERPOLATE_AP) photMode |= PM_SOURCE_PHOT_INTERP; 94 if (DIFF_STATS) photMode |= PM_SOURCE_PHOT_DIFFSTATS; 49 95 50 96 // choose Cx, Cy (see psphotThreadTools.c for overview of the concepts) … … 64 110 65 111 psArrayAdd(job->args, 1, cells->data[j]); // sources 66 psArrayAdd(job->args, 1, (pmPSF*)psf); // Casting away const112 psArrayAdd(job->args, 1, psf); 67 113 psArrayAdd(job->args, 1, binning); 68 114 psArrayAdd(job->args, 1, backModel); … … 179 225 } 180 226 181 # if (0)182 bool psphotMagnitudes_Unthreaded (int *nap, psArray *sources, pmPSF *psf, psImageBinning *binning, pmReadout *backModel, pmReadout *backStdev, pmSourcePhotometryMode photMode, psImageMaskType maskVal) {183 184 bool status;185 int Nap = 0;186 187 for (int i = 0; i < sources->n; i++) {188 pmSource *source = (pmSource *) sources->data[i];189 status = pmSourceMagnitudes (source, psf, photMode, maskVal);190 if (status && isfinite(source->apMag)) Nap ++;191 192 if (backModel) {193 psAssert (binning, "if backModel is defined, so should binning be");194 source->sky = psImageUnbinPixel(source->peak->x, source->peak->y, backModel->image, binning);195 if (isnan(source->sky) && false) {196 psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.sky");197 }198 } else {199 source->sky = NAN;200 }201 202 if (backStdev) {203 psAssert (binning, "if backStdev is defined, so should binning be");204 source->skyErr = psImageUnbinPixel(source->peak->x, source->peak->y, backStdev->image, binning);205 if (isnan(source->skyErr) && false) {206 psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.skyErr");207 }208 } else {209 source->skyErr = NAN;210 }211 }212 213 // change the value of a scalar on the array (wrap this and put it in psArray.h)214 *nap = Nap;215 216 return true;217 }218 # endif219 220 227 bool psphotPSFWeights(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources) { 221 228
Note:
See TracChangeset
for help on using the changeset viewer.
