Changeset 25275
- Timestamp:
- Sep 4, 2009, 2:18:54 PM (17 years ago)
- Location:
- branches/eam_branches/20090715/psphot/src
- Files:
-
- 1 added
- 10 edited
-
Makefile.am (modified) (3 diffs)
-
pmPetrosian.h (modified) (4 diffs)
-
psphot.h (modified) (2 diffs)
-
psphotInternal.h (modified) (1 diff)
-
psphotPetrosianAnalysis.c (added)
-
psphotPetrosianProfile.c (modified) (3 diffs)
-
psphotPetrosianRadialBins.c (modified) (4 diffs)
-
psphotPetrosianStats.c (modified) (8 diffs)
-
psphotPetrosianStudy.c (modified) (1 diff)
-
psphotPetrosianVisual.c (modified) (2 diffs)
-
psphotRadiiFromProfiles.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/Makefile.am
r25178 r25275 25 25 libpsphot_la_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 26 26 27 # bin_PROGRAMS = psphot psphotTest psphotMomentsStudy psphotPetrosianStudy 28 bin_PROGRAMS = psphotPetrosianStudy 27 bin_PROGRAMS = psphot psphotTest psphotMomentsStudy psphotPetrosianStudy 28 # bin_PROGRAMS = psphotPetrosianStudy 29 # bin_PROGRAMS = psphot 29 30 30 31 psphot_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) … … 68 69 69 70 psphotPetrosianStudy_SOURCES = \ 70 psphotPetrosianStudy.c \ 71 psphotPetrosianProfile.c \ 72 psphotRadialProfileByAngle.c \ 73 psphotRadiiFromProfiles.c \ 74 psphotEllipticalContour.c \ 75 psphotEllipticalProfile.c \ 76 psphotPetrosianRadialBins.c \ 77 psphotPetrosianVisual.c \ 78 psphotPetrosianStats.c 71 psphotPetrosianStudy.c 79 72 80 73 libpsphot_la_SOURCES = \ … … 145 138 psphotThreadTools.c \ 146 139 psphotAddNoise.c \ 140 psphotPetrosianProfile.c \ 141 psphotRadialProfileByAngle.c \ 142 psphotRadiiFromProfiles.c \ 143 psphotEllipticalContour.c \ 144 psphotEllipticalProfile.c \ 145 psphotPetrosianRadialBins.c \ 146 psphotPetrosianVisual.c \ 147 psphotPetrosianStats.c \ 148 psphotPetrosianAnalysis.c \ 147 149 pmPetrosian.c 150 148 151 149 152 # dropped? psphotGrowthCurve.c -
branches/eam_branches/20090715/psphot/src/pmPetrosian.h
r25178 r25275 35 35 bool psphotPetrosianFreeVectors(pmPetrosian *petrosian); 36 36 37 bool psphotPetrosianProfile (pmSource *source );37 bool psphotPetrosianProfile (pmSource *source, float skynoise); 38 38 bool psphotRadialProfilesByAngles (pmPetrosian *petro, pmSource *source, int Nsec, float Rmax); 39 39 float psphotRadiusFromProfile (psVector *radius, psVector *flux, float fluxMin, float fluxMax); … … 41 41 bool psphotEllipticalProfile (pmSource *source, pmPetrosian *petrosian); 42 42 bool psphotEllipticalContour (pmPetrosian *petrosian); 43 bool psphotPetrosianRadialBins (pmSource *source, pmPetrosian *petrosian, float radiusMax );43 bool psphotPetrosianRadialBins (pmSource *source, pmPetrosian *petrosian, float radiusMax, float skynoise); 44 44 bool psphotPetrosianStats (pmPetrosian *petrosian); 45 45 … … 48 48 49 49 bool psphotPetrosianVisualProfileByAngle (psVector *radius, psVector *flux); 50 bool psphotPetrosianVisualProfileRadii (psVector *radius, psVector *flux, psVector *radiusBin, psVector *fluxBin, float RadiusRef);50 bool psphotPetrosianVisualProfileRadii (psVector *radius, psVector *flux, psVector *radiusBin, psVector *fluxBin, float peakFlux, float RadiusRef); 51 51 bool psphotPetrosianVisualEllipticalContour (pmPetrosian *petrosian); 52 52 … … 57 57 float petFlux, float radiusForFlux); 58 58 59 bool pmVisualLimitsFromVectors (Graphdata *graphdata, psVector *xVec, psVector *yVec);60 61 59 /// @} 62 60 -
branches/eam_branches/20090715/psphot/src/psphot.h
r25022 r25275 8 8 #include <psmodules.h> 9 9 #include "psphotErrorCodes.h" 10 #include "pmPetrosian.h" 10 11 11 12 #define PSPHOT_RECIPE "PSPHOT" // Name of the recipe to use … … 192 193 bool psphotVisualPlotSourceSize (psArray *sources); 193 194 195 bool psphotVisualShowPetrosian (pmSource *source, pmPetrosian *petrosian); 196 bool psphotPetrosianAnalysis (pmReadout *readout, psArray *sources, psMetadata *recipe); 197 194 198 bool psphotImageQuality (psMetadata *recipe, psArray *sources); 195 199 -
branches/eam_branches/20090715/psphot/src/psphotInternal.h
r25105 r25275 14 14 #include <psmodules.h> 15 15 #include "psphot.h" 16 #include "pmPetrosian.h"17 16 18 17 #endif -
branches/eam_branches/20090715/psphot/src/psphotPetrosianProfile.c
r25178 r25275 7 7 // structure to something the pmRadialProfile 8 8 9 bool psphotPetrosianProfile (pmSource *source ) {9 bool psphotPetrosianProfile (pmSource *source, float skynoise) { 10 10 11 11 // container to hold results from the radial profile analysis … … 48 48 // integrate the radial profile for radial bins defined for the petrosian measurement: 49 49 // SB_i (r_i) where \alpha r_i < r < \beta r_i 50 if (!psphotPetrosianRadialBins (source, petrosian, Rmax )) {50 if (!psphotPetrosianRadialBins (source, petrosian, Rmax, skynoise)) { 51 51 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 52 52 return false; … … 59 59 } 60 60 61 // XXX this will only work in the psphot context, not the psphotPetrosianStudy... 62 // XXX add the petrosian to the pmSource structure... 63 psphotVisualShowPetrosian (source, petrosian); 64 61 65 psphotPetrosianFreeVectors(petrosian); 62 66 -
branches/eam_branches/20090715/psphot/src/psphotPetrosianRadialBins.c
r25178 r25275 13 13 // track the non-overlapping radius values. 14 14 15 bool psphotPetrosianRadialBins (pmSource *source, pmPetrosian *petrosian, float radiusMax) { 15 bool psphotPetrosianRadialBins (pmSource *source, pmPetrosian *petrosian, float radiusMax, float skynoise) { 16 17 // XXX for testing, let's just set this to a value 18 19 float skyModelErrorSQ = PS_SQR(skynoise); 20 21 # if (0) 22 // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN 23 pmReadout *backModel = psphotSelectBackground (config, view); 24 pmReadout *backStdev = psphotSelectBackgroundStdev (config, view); 25 # endif 16 26 17 27 psVector *radius = petrosian->radiusElliptical; … … 104 114 psVector *values = psVectorAllocEmpty (flux->n, PS_TYPE_F32); 105 115 psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 116 // psStats *stats = psStatsAlloc(PS_STAT_FITTED_MEAN_V4 | PS_STAT_FITTED_STDEV_V4); 106 117 107 118 // integrate flux, radius for each of these bins. since flux is sorted by radius, … … 123 134 // binSB->data.F32[nOut] = stats->sampleMedian; 124 135 binSB->data.F32[nOut] = stats->robustMedian; 125 binSBstdev->data.F32[nOut] = stats->robustStdev / sqrt(values->n); 136 binSBstdev->data.F32[nOut] = sqrt(PS_SQR(stats->robustStdev) / values->n + skyModelErrorSQ); 137 // binSB->data.F32[nOut] = stats->fittedMean; 138 // binSBstdev->data.F32[nOut] = sqrt(PS_SQR(stats->fittedStdev) / values->n + skyModelErrorSQ); 139 140 // error in the SB is the stdev per bin / sqrt (number of pixels) 141 // added in quadrature to a fraction of the local sky (not the 142 // residual flux, but the sky from the sky model) 126 143 127 144 if (1) { … … 153 170 petrosian->binSBstdev = binSBstdev; 154 171 155 psphotPetrosianVisualProfileRadii (radius, flux, binRad, binSB, 0.0);172 psphotPetrosianVisualProfileRadii (radius, flux, binRad, binSB, source->peak->flux, 0.0); 156 173 157 174 psFree(radMin); -
branches/eam_branches/20090715/psphot/src/psphotPetrosianStats.c
r25204 r25275 32 32 float dFsum2 = 0.0; 33 33 34 float nSigma = 3.0; 35 int lowestSignificantRadius = 0; 36 float lowestSignificantRatio = 1.0; 37 34 38 int nOut = 0; 35 39 for (int i = 0; i < binSB->n; i++) { … … 48 52 areaInner += areaSum->data.F32[nOut-1]; 49 53 fluxInner += fluxSum->data.F32[nOut-1]; 50 fluxInnerErr2 = PS_SQR(fluxSumErr2->data.F32[nOut-1] * areaSum->data.F32[nOut-1]);54 fluxInnerErr2 += fluxSumErr2->data.F32[nOut-1]; 51 55 } 52 56 … … 64 68 65 69 float meanSBerr = sqrt(fluxInnerErr2) / areaInner; 66 float ratioErr = ratio* sqrt(PS_SQR(binSBstdev->data.F32[i]/binSB->data.F32[i]) + PS_SQR(meanSBerr/meanSB->data.F32[nOut]));70 float ratioErr = fabs(ratio) * sqrt(PS_SQR(binSBstdev->data.F32[i]/binSB->data.F32[i]) + PS_SQR(meanSBerr/meanSB->data.F32[nOut])); 67 71 68 72 psVectorAppend(petRatioErr, ratioErr); … … 74 78 75 79 if (1) { 76 fprintf (stderr, "%3d : %5.2f : %5.3f %5.3f : %5.3f %5.3f : %5.1f %5.1f\n", 77 i, refRadius->data.F32[nOut], binSB->data.F32[i], meanSB->data.F32[nOut], petRatio->data.F32[nOut], petRatioErr->data.F32[nOut], fluxSum->data.F32[nOut], areaSum->data.F32[nOut]); 80 fprintf (stderr, "%3d : %5.2f : %5.3f %5.3f : %5.3f %5.3f : %5.3f %5.3f : %5.3f %5.3f : %5.1f %5.1f\n", 81 i, refRadius->data.F32[nOut], 82 binSB->data.F32[i], binSBstdev->data.F32[i], 83 meanSB->data.F32[nOut], meanSBerr, 84 petRatio->data.F32[nOut], petRatioErr->data.F32[nOut], 85 fluxSum->data.F32[nOut], sqrt(fluxSumErr2->data.F32[nOut]), areaSum->data.F32[nOut], areaInner); 78 86 } 79 87 80 88 // anytime we transition below the PETROSIAN_RATIO, calculate the radius and flux 81 89 // we will keep and report the last (largest radius) value 82 if (above && (petRatio->data.F32[nOut] < PETROSIAN_RATIO) ) {90 if (above && (petRatio->data.F32[nOut] < PETROSIAN_RATIO) && (petRatio->data.F32[nOut] > nSigma*petRatioErr->data.F32[nOut])) { 83 91 // interpolate Rvec between i-1 and i to PETROSIAN_RATIO to get flux (Fvec) and radius (rvec) 84 92 if (i == 0) { … … 93 101 } 94 102 103 // anytime we transition below the PETROSIAN_RATIO, calculate the radius and flux 104 // we will keep and report the last (largest radius) value 105 // find the last signficant measurement of the petrosian ratio 106 if (above && (petRatio->data.F32[nOut] < lowestSignificantRatio) && (petRatio->data.F32[nOut] > nSigma*petRatioErr->data.F32[nOut])) { 107 lowestSignificantRadius = nOut; 108 lowestSignificantRatio = petRatio->data.F32[nOut]; 109 } 110 95 111 // reset on transitions up, but do not re-calculate rad_90, flux_90 96 112 if (!above && (petRatio->data.F32[nOut] >= PETROSIAN_RATIO)) { … … 101 117 102 118 if (!anyPetro) { 103 // set default radius: 119 // interpolate Rvec between i-1 and i to PETROSIAN_RATIO to get flux (Fvec) and radius (rvec) 120 if (lowestSignificantRadius == 0) { 121 // assume Fmax @ R = 0.0 122 petRadius = InterpolateValues (1.0, 0.0, petRatio->data.F32[lowestSignificantRadius], refRadius->data.F32[lowestSignificantRadius], PETROSIAN_RATIO); 123 } else { 124 petRadius = InterpolateValues (petRatio->data.F32[lowestSignificantRadius-1], refRadius->data.F32[lowestSignificantRadius-1], petRatio->data.F32[lowestSignificantRadius], refRadius->data.F32[lowestSignificantRadius], PETROSIAN_RATIO); 125 } 104 126 } 105 127 … … 110 132 if (refRadius->data.F32[i] > apRadius) { 111 133 if (i == 0) { 112 psAbort ("does this case make any sense?"); 134 psWarning ("does this case make any sense? (refRadius[0] > apRadius)"); 135 continue; 113 136 } else { 114 137 petFlux = InterpolateValues (refRadius->data.F32[i-1], fluxSum->data.F32[i-1], refRadius->data.F32[i], fluxSum->data.F32[i], apRadius); … … 119 142 120 143 // save petRadius, petFlux 144 // XXX save flags (anyPetro, manyPetro) 121 145 petrosian->petrosianRadius = petRadius; 122 146 petrosian->petrosianFlux = petFlux; -
branches/eam_branches/20090715/psphot/src/psphotPetrosianStudy.c
r25178 r25275 136 136 } 137 137 138 psphotPetrosianProfile (source );138 psphotPetrosianProfile (source, skynoise); 139 139 140 140 psFree (source); -
branches/eam_branches/20090715/psphot/src/psphotPetrosianVisual.c
r25178 r25275 93 93 } 94 94 95 bool psphotPetrosianVisualProfileRadii (psVector *radius, psVector *flux, psVector *radiusBin, psVector *fluxBin, float RadiusRef) {95 bool psphotPetrosianVisualProfileRadii (psVector *radius, psVector *flux, psVector *radiusBin, psVector *fluxBin, float peakFlux, float RadiusRef) { 96 96 97 97 float FluxRef = 500.0; … … 115 115 KapaSetFont (kapa, "courier", 14); 116 116 117 pmVisualLimitsFromVectors (&graphdata, radius, flux); 117 graphdata.ymax = +1.05*peakFlux; 118 graphdata.ymin = -0.05*peakFlux; 119 pmVisualLimitsFromVectors (&graphdata, radius, NULL); 118 120 KapaSetLimits (kapa, &graphdata); 119 121 -
branches/eam_branches/20090715/psphot/src/psphotRadiiFromProfiles.c
r25178 r25275 56 56 } 57 57 } 58 Rbin = 3; 58 59 59 60 psVector *fluxBinned = NULL; … … 117 118 // XXX is there a macro in psLib that does this interpolation? 118 119 if (i == 0) { 119 psAbort ("impossible condition f[0] < Fo"); 120 psWarning ("impossible condition f[0] < Fo"); 121 continue; 120 122 } else { 121 123 Ro = radiusBinned->data.F32[i-1] + (radiusBinned->data.F32[i] - radiusBinned->data.F32[i-1]) * (Fo - fluxBinned->data.F32[i-1]) / (fluxBinned->data.F32[i] - fluxBinned->data.F32[i-1]);
Note:
See TracChangeset
for help on using the changeset viewer.
