Changeset 25452
- Timestamp:
- Sep 19, 2009, 8:49:41 AM (17 years ago)
- Location:
- branches/eam_branches/20090715
- Files:
-
- 24 edited
- 3 moved
-
ippconfig/mosaic2/camera.config (modified) (1 diff)
-
ippconfig/mosaic2/psphot.config (modified) (2 diffs)
-
psModules/src/objects/pmPSFtry.c (modified) (2 diffs)
-
psModules/src/objects/pmPetrosian.c (moved) (moved from branches/eam_branches/20090715/psphot/src/pmPetrosian.c ) (3 diffs)
-
psModules/src/objects/pmPetrosian.h (moved) (moved from branches/eam_branches/20090715/psphot/src/pmPetrosian.h ) (2 diffs)
-
psModules/src/objects/pmSourceExtendedPars.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceExtendedPars.h (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_CMF_PS1_V2.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_PS1_CAL_0.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_PS1_DEV_1.c (modified) (3 diffs)
-
psphot/src/Makefile.am (modified) (5 diffs)
-
psphot/src/psphot.h (modified) (3 diffs)
-
psphot/src/psphotEllipticalContour.c (modified) (2 diffs)
-
psphot/src/psphotEllipticalProfile.c (modified) (3 diffs)
-
psphot/src/psphotExtendedSourceAnalysis.c (modified) (8 diffs)
-
psphot/src/psphotFitSourcesLinear.c (modified) (1 diff)
-
psphot/src/psphotPetrosian.c (modified) (1 diff)
-
psphot/src/psphotPetrosianAnalysis.c (modified) (1 diff)
-
psphot/src/psphotPetrosianProfile.c (modified) (1 diff)
-
psphot/src/psphotPetrosianRadialBins.c (modified) (2 diffs)
-
psphot/src/psphotPetrosianStats.c (modified) (2 diffs)
-
psphot/src/psphotRadialProfile.c (modified) (2 diffs)
-
psphot/src/psphotRadialProfileByAngles.c (moved) (moved from branches/eam_branches/20090715/psphot/src/psphotRadialProfileByAngle.c ) (4 diffs)
-
psphot/src/psphotRadiiFromProfiles.c (modified) (3 diffs)
-
psphot/src/psphotReadout.c (modified) (1 diff)
-
psphot/src/psphotSourceSize.c (modified) (3 diffs)
-
psphot/src/psphotVisual.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/ippconfig/mosaic2/camera.config
r19019 r25452 90 90 CMF.XSRC STR {CHIP.NAME}.xsrc # use .PSF and .EXT? 91 91 CMF.XFIT STR {CHIP.NAME}.xfit # use .PSF and .EXT? 92 CMF.DETEFF STR {CHIP.NAME}.deteff 92 93 93 94 PSF.HEAD STR {CHIP.NAME}.hdr -
branches/eam_branches/20090715/ippconfig/mosaic2/psphot.config
r25395 r25452 24 24 USE_FOOTPRINTS BOOL TRUE # use new pmFootprint peak packaging 25 25 26 PSF.TREND.MODE STR MAP 27 PSF.TREND.NX S32 1 28 PSF.TREND.NY S32 1 29 26 30 PEAKS_NSIGMA_LIMIT F32 15.0 # peak significance threshold 27 31 MOMENTS_SN_MIN F32 10.0 # min S/N to measure moments 28 32 PSF_SN_LIM F32 20.0 # minimum S/N for stars used for PSF model 29 FULL_FIT_SN_LIM F32 20.030 EXT_MIN_SN F32 20.0 # fit galaxies above this S/N limit33 FULL_FIT_SN_LIM F32 10.0 34 EXT_MIN_SN F32 10.0 # fit galaxies above this S/N limit 31 35 AP_MIN_SN F32 10.0 32 36 … … 42 46 PSPHOT.EXT.NSIGMA.LIMIT F32 3.0 # sources with extNsigma greater that this get tagged as likely extended sources 43 47 PSPHOT.EXT.NSIGMA.MOMENTS F32 2.0 # sources with extNsigma greater that this get tagged as likely extended sources 48 49 EXTENDED_SOURCE_SN_LIM F32 3.0 50 EXTENDED_SOURCE_ANALYSIS BOOL TRUE # perform any of the aperture-like measurements? 51 EXTENDED_SOURCE_PETROSIAN BOOL TRUE -
branches/eam_branches/20090715/psModules/src/objects/pmPSFtry.c
r25352 r25452 443 443 float dSysBright = psVectorSystematicError (bright, brightErr, 0.1); 444 444 fprintf (stderr, "bright systematic error: %f\n", dSysBright); 445 psFree(bright); 446 psFree(brightErr); 445 447 446 448 // XXX test dump of fitted model (dump when tracing?) … … 1178 1180 1179 1181 // free local allocations 1182 psFree (mask); 1183 psFree (chisq); 1184 psFree (stats); 1185 psFree (index); 1186 1180 1187 return (sqrt(S2guess)); 1181 1188 } -
branches/eam_branches/20090715/psModules/src/objects/pmPetrosian.c
r25409 r25452 9 9 */ 10 10 11 # include "p sphotInternal.h"11 # include "pmPetrosian.h" 12 12 13 13 static void pmPetrosianFree(pmPetrosian *petrosian) … … 56 56 } 57 57 58 bool p sphotPetrosianFreeVectors(pmPetrosian *petrosian) {58 bool pmPetrosianFreeVectors(pmPetrosian *petrosian) { 59 59 60 60 psFree(petrosian->radii); … … 100 100 } 101 101 102 bool p sphotPetrosianSortPair (psVector *index, psVector *extra) {102 bool pmPetrosianSortPair (psVector *index, psVector *extra) { 103 103 104 104 // sort the vector set by the radius -
branches/eam_branches/20090715/psModules/src/objects/pmPetrosian.h
r25433 r25452 10 10 #ifndef PM_PETROSIAN_H 11 11 #define PM_PETROSIAN_H 12 13 /// @addtogroup Objects Object Detection / Analysis Functions 14 /// @{ 12 15 13 16 typedef struct { … … 33 36 34 37 pmPetrosian *pmPetrosianAlloc(); 35 bool psphotPetrosianFreeVectors(pmPetrosian *petrosian);36 38 37 bool psphotPetrosianProfile (pmReadout *readout, pmSource *source, float skynoise); 38 bool psphotRadialProfilesByAngles (pmSource *source, pmPetrosian *petro, int Nsec, float Rmax); 39 float psphotRadiusFromProfile (pmSource *source, psVector *radius, psVector *flux, float fluxMin, float fluxMax); 40 bool psphotRadiiFromProfiles (pmSource *source, pmPetrosian *petrosian, float fluxMin, float fluxMax); 41 bool psphotEllipticalProfile (pmSource *source, pmPetrosian *petrosian); 42 bool psphotEllipticalContour (pmSource *source, pmPetrosian *petrosian); 43 bool psphotPetrosianRadialBins (pmSource *source, pmPetrosian *petrosian, float radiusMax, float skynoise); 44 bool psphotPetrosianStats (pmSource *source, pmPetrosian *petrosian); 45 46 bool psphotPetrosianSortPair (psVector *index, psVector *extra); 47 48 49 bool psphotPetrosianVisualProfileByAngle (psVector *radius, psVector *flux); 50 bool psphotPetrosianVisualProfileRadii (psVector *radius, psVector *flux, psVector *radiusBin, psVector *fluxBin, float peakFlux, float RadiusRef); 51 bool psphotPetrosianVisualEllipticalContour (pmPetrosian *petrosian); 52 53 bool psphotPetrosianVisualStats (psVector *radBin, psVector *fluxBin, 54 psVector *refRadius, psVector *meanSB, 55 psVector *petRatio, psVector *petRatioErr, psVector *fluxSum, 56 float petRadius, float ratioForRadius, 57 float petFlux, float radiusForFlux); 39 bool pmPetrosianFreeVectors(pmPetrosian *petrosian); 40 bool pmPetrosianSortPair (psVector *index, psVector *extra); 58 41 59 42 /// @} 60 43 61 62 44 # endif /* PM_PETROSIAN_H */ -
branches/eam_branches/20090715/psModules/src/objects/pmSourceExtendedPars.c
r23487 r25452 17 17 #endif 18 18 19 #include <stdio.h>20 #include <math.h>21 #include <string.h>19 // #include <stdio.h> 20 // #include <math.h> 21 // #include <string.h> 22 22 #include <pslib.h> 23 #include "pmHDU.h" 24 #include "pmFPA.h" 25 #include "pmFPAMaskWeight.h" 26 #include "pmSpan.h" 27 #include "pmFootprint.h" 28 #include "pmPeaks.h" 29 #include "pmMoments.h" 30 #include "pmResiduals.h" 31 #include "pmGrowthCurve.h" 32 #include "pmTrend2D.h" 33 #include "pmPSF.h" 34 #include "pmModel.h" 35 #include "pmSource.h" 36 23 // #include "pmHDU.h" 24 // #include "pmFPA.h" 25 // #include "pmFPAMaskWeight.h" 26 // #include "pmSpan.h" 27 // #include "pmFootprint.h" 28 // #include "pmPeaks.h" 29 // #include "pmMoments.h" 30 // #include "pmResiduals.h" 31 // #include "pmGrowthCurve.h" 32 // #include "pmTrend2D.h" 33 // #include "pmPSF.h" 34 // #include "pmModel.h" 35 // #include "pmSource.h" 36 #include "pmSourceExtendedPars.h" 37 38 // *** pmSourceRadialProfile describes the radial profile of a source in elliptical contours, and 39 // intermediate data used to measure the profile 40 static void pmSourceRadialProfileFree(pmSourceRadialProfile *profile) 41 { 42 if (!profile) { 43 return; 44 } 45 psFree(profile->radii); 46 psFree(profile->fluxes); 47 psFree(profile->theta); 48 psFree(profile->isophotalRadii); 49 50 psFree(profile->radiusElliptical); 51 psFree(profile->fluxElliptical); 52 53 psFree(profile->binSB); 54 psFree(profile->binSBstdev); 55 psFree(profile->binSBerror); 56 57 psFree(profile->radialBins); 58 psFree(profile->area); 59 } 60 61 pmSourceRadialProfile *pmSourceRadialProfileAlloc() 62 { 63 pmSourceRadialProfile *profile = (pmSourceRadialProfile *)psAlloc(sizeof(pmSourceRadialProfile)); 64 psMemSetDeallocator(profile, (psFreeFunc) pmSourceRadialProfileFree); 65 66 profile->radii = NULL; 67 profile->fluxes = NULL; 68 profile->theta = NULL; 69 profile->isophotalRadii = NULL; 70 71 profile->radiusElliptical = NULL; 72 profile->fluxElliptical = NULL; 73 74 profile->binSB = NULL; 75 profile->binSBstdev = NULL; 76 profile->binSBerror = NULL; 77 78 profile->radialBins = NULL; 79 profile->area = NULL; 80 81 return profile; 82 } 83 84 bool psMemCheckSourceRadialProfile(psPtr ptr) 85 { 86 PS_ASSERT_PTR(ptr, false); 87 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceRadialProfileFree); 88 } 89 90 91 // *** pmSourceRadialProfileFreeVectors frees the intermediate data values 92 bool pmSourceRadialProfileFreeVectors(pmSourceRadialProfile *profile) { 93 94 psFree(profile->radii); 95 psFree(profile->fluxes); 96 psFree(profile->theta); 97 psFree(profile->isophotalRadii); 98 99 psFree(profile->radiusElliptical); 100 psFree(profile->fluxElliptical); 101 102 // psFree(profile->binSB); 103 // psFree(profile->binSBstdev); 104 // psFree(profile->binSBerror); 105 106 // psFree(profile->radialBins); 107 psFree(profile->area); 108 109 profile->radii = NULL; 110 profile->fluxes = NULL; 111 profile->theta = NULL; 112 profile->isophotalRadii = NULL; 113 114 profile->radiusElliptical = NULL; 115 profile->fluxElliptical = NULL; 116 117 // profile->binSB = NULL; 118 // profile->binSBstdev = NULL; 119 // profile->binSBerror = NULL; 120 121 // profile->radialBins = NULL; 122 profile->area = NULL; 123 124 return true; 125 } 126 127 // *** pmSourceRadialProfileSortPair is a utility function for sorting a pair of vectors 128 # define COMPARE_INDEX(A,B) (index->data.F32[A] < index->data.F32[B]) 129 # define SWAP_INDEX(TYPE,A,B) { \ 130 float tmp; \ 131 if (A != B) { \ 132 tmp = index->data.F32[A]; \ 133 index->data.F32[A] = index->data.F32[B]; \ 134 index->data.F32[B] = tmp; \ 135 tmp = extra->data.F32[A]; \ 136 extra->data.F32[A] = extra->data.F32[B]; \ 137 extra->data.F32[B] = tmp; \ 138 } \ 139 } 140 141 bool pmSourceRadialProfileSortPair (psVector *index, psVector *extra) { 142 143 // sort the vector set by the radius 144 PSSORT (index->n, COMPARE_INDEX, SWAP_INDEX, NONE); 145 return true; 146 } 147 148 // *** pmSourceExtendedPars describes the possible collection of extended flux measurements for a source 37 149 static void pmSourceExtendedParsFree (pmSourceExtendedPars *pars) { 38 150 if (!pars) return; 39 151 40 152 psFree(pars->profile); 41 psFree(pars->annuli); 42 psFree(pars->isophot); 43 psFree(pars->petrosian); 44 psFree(pars->kron); 153 psFree(pars->petrosian_50); 154 psFree(pars->petrosian_80); 45 155 return; 46 156 } … … 51 161 52 162 pars->profile = NULL; 53 pars->annuli = NULL; 54 pars->isophot = NULL; 55 pars->petrosian = NULL; 56 pars->kron = NULL; 163 pars->petrosian_50 = NULL; 164 pars->petrosian_80 = NULL; 57 165 58 166 return pars; … … 66 174 67 175 68 static void pmSourceRadialProfileFree (pmSourceRadialProfile *profile) { 69 if (!profile) return; 70 71 psFree(profile->radius); 72 psFree(profile->flux); 73 psFree(profile->variance); 176 // *** pmSourceExtendedFlux describes the flux within an elliptical aperture of some kind 177 static void pmSourceExtendedFluxFree (pmSourceExtendedFlux *flux) { 178 if (!flux) return; 74 179 return; 75 180 } 76 181 77 pmSourceRadialProfile *pmSourceRadialProfileAlloc (void) { 78 79 pmSourceRadialProfile *profile = (pmSourceRadialProfile *) psAlloc(sizeof(pmSourceRadialProfile)); 80 psMemSetDeallocator(profile, (psFreeFunc) pmSourceRadialProfileFree); 81 82 profile->radius = NULL; 83 profile->flux = NULL; 84 profile->variance = NULL; 85 86 return profile; 87 } 88 89 bool psMemCheckSourceRadialProfile(psPtr ptr) 182 pmSourceExtendedFlux *pmSourceExtendedFluxAlloc (void) { 183 184 pmSourceExtendedFlux *flux = (pmSourceExtendedFlux *) psAlloc(sizeof(pmSourceExtendedFlux)); 185 psMemSetDeallocator(flux, (psFreeFunc) pmSourceExtendedFluxFree); 186 187 flux->flux = 0.0; 188 flux->fluxErr = 0.0; 189 flux->radius = 0.0; 190 flux->radiusErr = 0.0; 191 192 return flux; 193 } 194 195 196 bool psMemCheckSourceExtendedFlux(psPtr ptr) 90 197 { 91 198 PS_ASSERT_PTR(ptr, false); 92 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceRadialProfileFree); 93 } 94 95 96 static void pmSourceIsophotalValuesFree (pmSourceIsophotalValues *isophot) { 97 if (!isophot) return; 98 return; 99 } 100 101 pmSourceIsophotalValues *pmSourceIsophotalValuesAlloc (void) { 102 103 pmSourceIsophotalValues *isophot = (pmSourceIsophotalValues *) psAlloc(sizeof(pmSourceIsophotalValues)); 104 psMemSetDeallocator(isophot, (psFreeFunc) pmSourceIsophotalValuesFree); 105 106 isophot->mag = 0.0; 107 isophot->magErr = 0.0; 108 isophot->rad = 0.0; 109 isophot->radErr = 0.0; 110 111 return isophot; 112 } 113 114 115 bool psMemCheckSourceIsophotalValues(psPtr ptr) 116 { 117 PS_ASSERT_PTR(ptr, false); 118 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceIsophotalValuesFree); 119 } 120 121 122 static void pmSourcePetrosianValuesFree (pmSourcePetrosianValues *petrosian) { 123 if (!petrosian) return; 124 return; 125 } 126 127 pmSourcePetrosianValues *pmSourcePetrosianValuesAlloc (void) { 128 129 pmSourcePetrosianValues *petrosian = (pmSourcePetrosianValues *) psAlloc(sizeof(pmSourcePetrosianValues)); 130 psMemSetDeallocator(petrosian, (psFreeFunc) pmSourcePetrosianValuesFree); 131 132 petrosian->mag = 0.0; 133 petrosian->magErr = 0.0; 134 petrosian->rad = 0.0; 135 petrosian->radErr = 0.0; 136 137 return petrosian; 138 } 139 140 141 bool psMemCheckSourcePetrosianValues(psPtr ptr) 142 { 143 PS_ASSERT_PTR(ptr, false); 144 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourcePetrosianValuesFree); 145 } 146 147 static void pmSourceKronValuesFree (pmSourceKronValues *kron) { 148 if (!kron) return; 149 return; 150 } 151 152 pmSourceKronValues *pmSourceKronValuesAlloc (void) { 153 154 pmSourceKronValues *kron = (pmSourceKronValues *) psAlloc(sizeof(pmSourceKronValues)); 155 psMemSetDeallocator(kron, (psFreeFunc) pmSourceKronValuesFree); 156 157 kron->mag = 0.0; 158 kron->magErr = 0.0; 159 kron->rad = 0.0; 160 kron->radErr = 0.0; 161 162 return kron; 163 } 164 165 166 bool psMemCheckSourceKronValues(psPtr ptr) 167 { 168 PS_ASSERT_PTR(ptr, false); 169 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceKronValuesFree); 170 } 171 172 173 static void pmSourceAnnuliFree (pmSourceAnnuli *annuli) { 174 if (!annuli) return; 175 176 psFree (annuli->flux); 177 psFree (annuli->fluxErr); 178 psFree (annuli->fluxVar); 179 180 return; 181 } 182 183 pmSourceAnnuli *pmSourceAnnuliAlloc (void) { 184 185 pmSourceAnnuli *annuli = (pmSourceAnnuli *) psAlloc(sizeof(pmSourceAnnuli)); 186 psMemSetDeallocator(annuli, (psFreeFunc) pmSourceAnnuliFree); 187 188 annuli->flux = NULL; 189 annuli->fluxErr = NULL; 190 annuli->fluxVar = NULL; 191 192 return annuli; 193 } 194 195 196 bool psMemCheckSourceAnnuli(psPtr ptr) 197 { 198 PS_ASSERT_PTR(ptr, false); 199 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceAnnuliFree); 200 } 199 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceExtendedFluxFree); 200 } -
branches/eam_branches/20090715/psModules/src/objects/pmSourceExtendedPars.h
r23487 r25452 15 15 16 16 typedef struct { 17 psVector *radius; 18 psVector *flux; 19 psVector *variance; 17 psArray *radii; // radii for raw radial profiles at evenly-spaced angles 18 psArray *fluxes; // fluxes measured at above radii 19 psVector *theta; // angles corresponding to above radial profiles 20 psVector *isophotalRadii; // isophotal radius for the above angles 21 22 psVector *radiusElliptical; // normalized radial coordinates for all relevant pixels 23 psVector *fluxElliptical; // flux for the above radial coordinates 24 25 psVector *binSB; // mean surface brightness within radial bins 26 psVector *binSBstdev; // scatter of mean surface brightness within radial bins 27 psVector *binSBerror; // formal error on mean surface brightness within radial bins 28 29 psVector *radialBins; // radii corresponding to above binnedBlux 30 psVector *area; // differential area of the non-overlapping radial bins 31 32 psEllipseAxes axes; // shape of elliptical contour 20 33 } pmSourceRadialProfile; 21 34 22 35 typedef struct { 23 psVector *flux; 24 psVector *fluxErr; 25 psVector *fluxVar; 26 } pmSourceAnnuli; 27 28 typedef struct { 29 float mag; 30 float magErr; 31 float rad; 32 float radErr; 33 } pmSourceIsophotalValues; 34 35 typedef struct { 36 float mag; 37 float magErr; 38 float rad; 39 float radErr; 40 } pmSourcePetrosianValues; 41 42 typedef struct { 43 float mag; 44 float magErr; 45 float rad; 46 float radErr; 47 } pmSourceKronValues; 36 float flux; 37 float fluxErr; 38 float radius; 39 float radiusErr; 40 } pmSourceExtendedFlux; 48 41 49 42 typedef struct { 50 43 pmSourceRadialProfile *profile; 51 pmSourceAnnuli *annuli; 52 pmSourceIsophotalValues *isophot; 53 pmSourcePetrosianValues *petrosian; 54 pmSourceKronValues *kron; 44 pmSourceExtendedFlux *petrosian_50; 45 pmSourceExtendedFlux *petrosian_80; 55 46 } pmSourceExtendedPars; 56 47 57 pmSourceExtendedPars *pmSourceExtendedParsAlloc(void); 48 // *** pmSourceRadialProfile describes the radial profile of a source in elliptical contours, and 49 // intermediate data used to measure the profile 50 pmSourceRadialProfile *pmSourceRadialProfileAlloc(); 51 bool psMemCheckSourceRadialProfile(psPtr ptr); 52 53 // *** pmSourceRadialProfileFreeVectors frees the intermediate data values 54 bool pmSourceRadialProfileFreeVectors(pmSourceRadialProfile *profile); 55 56 // *** pmSourceExtendedPars describes the possible collection of extended flux measurements for a source 57 pmSourceExtendedPars *pmSourceExtendedParsAlloc (void); 58 58 bool psMemCheckSourceExtendedPars(psPtr ptr); 59 pmSourceRadialProfile *pmSourceRadialProfileAlloc(void); 60 bool psMemCheckSourceRadialProfile(psPtr ptr); 61 pmSourceIsophotalValues *pmSourceIsophotalValuesAlloc(void); 62 bool psMemCheckSourceIsophotalValues(psPtr ptr); 63 pmSourcePetrosianValues *pmSourcePetrosianValuesAlloc(void); 64 bool psMemCheckSourcePetrosianValues(psPtr ptr); 65 pmSourceKronValues *pmSourceKronValuesAlloc(void); 66 bool psMemCheckSourceKronValues(psPtr ptr); 67 pmSourceAnnuli *pmSourceAnnuliAlloc(void); 68 bool psMemCheckSourceAnnuli(psPtr ptr); 59 60 // *** pmSourceExtendedFlux describes the flux within an elliptical aperture of some kind 61 pmSourceExtendedFlux *pmSourceExtendedFluxAlloc(void); 62 bool psMemCheckSourceExtendedFlux(psPtr ptr); 63 64 // *** pmSourceRadialProfileSortPair is a utility function for sorting a pair of vectors 65 bool pmSourceRadialProfileSortPair(psVector *index, psVector *extra); 69 66 70 67 /// @} -
branches/eam_branches/20090715/psModules/src/objects/pmSourceIO_CMF_PS1_V2.c
r24403 r25452 353 353 354 354 // which extended source analyses should we perform? 355 bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN");356 bool doIsophotal = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL");357 bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI");358 bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON");355 // bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN"); 356 // bool doIsophotal = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL"); 357 // bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI"); 358 // bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON"); 359 359 360 360 psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER"); … … 396 396 psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT_SIG", PS_DATA_F32, "Sigma in EXT y coordinate", yErr); 397 397 398 # if (0) 398 399 // Petrosian measurements 399 400 // XXX insert header data: petrosian ref radius, flux ratio … … 476 477 } 477 478 479 # endif 478 480 psArrayAdd (table, 100, row); 479 481 psFree (row); -
branches/eam_branches/20090715/psModules/src/objects/pmSourceIO_PS1_CAL_0.c
r21516 r25452 349 349 350 350 // which extended source analyses should we perform? 351 bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN");352 bool doIsophotal = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL");353 bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI");354 bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON");351 // bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN"); 352 // bool doIsophotal = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL"); 353 // bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI"); 354 // bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON"); 355 355 356 356 psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER"); … … 410 410 psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT_SIG", PS_DATA_F32, "Sigma in EXT y coordinate", yErr); 411 411 412 # if (0) 412 413 // Petrosian measurements 413 414 // XXX insert header data: petrosian ref radius, flux ratio … … 501 502 } 502 503 } 504 # endif 503 505 504 506 psArrayAdd (table, 100, row); -
branches/eam_branches/20090715/psModules/src/objects/pmSourceIO_PS1_DEV_1.c
r21516 r25452 300 300 301 301 // which extended source analyses should we perform? 302 bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN");303 bool doIsophotal = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL");304 bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI");305 bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON");302 // bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN"); 303 // bool doIsophotal = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL"); 304 // bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI"); 305 // bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON"); 306 306 307 307 psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER"); … … 343 343 psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT_SIG", PS_DATA_F32, "Sigma in EXT y coordinate", yErr); 344 344 345 // XXX disable these outputs until we clean up the names 346 # if (0) 345 347 // Petrosian measurements 346 348 // XXX insert header data: petrosian ref radius, flux ratio … … 422 424 } 423 425 } 426 # endif 424 427 425 428 psArrayAdd (table, 100, row); -
branches/eam_branches/20090715/psphot/src/Makefile.am
r25433 r25452 25 25 libpsphot_la_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 26 26 27 bin_PROGRAMS = psphot psphotTest psphotMomentsStudy psphotPetrosianStudy27 bin_PROGRAMS = psphot psphotTest psphotMomentsStudy 28 28 # bin_PROGRAMS = psphotPetrosianStudy 29 29 # bin_PROGRAMS = psphot … … 41 41 psphotMomentsStudy_LDADD = libpsphot.la 42 42 43 psphotPetrosianStudy_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS)44 psphotPetrosianStudy_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS)45 psphotPetrosianStudy_LDADD = libpsphot.la43 # psphotPetrosianStudy_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 44 # psphotPetrosianStudy_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 45 # psphotPetrosianStudy_LDADD = libpsphot.la 46 46 47 47 psphot_SOURCES = \ … … 68 68 psphotMomentsStudy.c 69 69 70 psphotPetrosianStudy_SOURCES = \71 psphotPetrosianStudy.c70 # psphotPetrosianStudy_SOURCES = \ 71 # psphotPetrosianStudy.c 72 72 73 73 libpsphot_la_SOURCES = \ … … 113 113 psphotExtendedSourceAnalysis.c \ 114 114 psphotExtendedSourceFits.c \ 115 psphotRadialProfile.c \116 psphotPetrosian.c \117 psphotIsophotal.c \118 psphotAnnuli.c \119 psphotKron.c \120 115 psphotKernelFromPSF.c \ 121 116 psphotPSFConvModel.c \ … … 138 133 psphotThreadTools.c \ 139 134 psphotAddNoise.c \ 140 psphotPetrosianProfile.c\141 psphotRadialProfileByAngle .c\135 psphotRadialProfile.c \ 136 psphotRadialProfileByAngles.c \ 142 137 psphotRadiiFromProfiles.c \ 143 138 psphotEllipticalContour.c \ 144 139 psphotEllipticalProfile.c \ 140 psphotPetrosian.c \ 145 141 psphotPetrosianRadialBins.c \ 146 psphotPetrosianVisual.c \147 142 psphotPetrosianStats.c \ 148 psphotPetrosianAnalysis.c \149 pmPetrosian.c \150 143 psphotEfficiency.c 144 145 # re-instate these 146 # psphotIsophotal.c \ 147 # psphotAnnuli.c \ 148 # psphotKron.c \ 149 # psphotPetrosianVisual.c \ 150 # 151 152 # test versions 153 # psphotPetrosianProfile.c \ 154 # psphotPetrosianAnalysis.c \ 155 # 151 156 152 157 include_HEADERS = \ 153 158 psphot.h \ 154 pmPetrosian.h \155 159 psphotErrorCodes.h 156 160 -
branches/eam_branches/20090715/psphot/src/psphot.h
r25433 r25452 8 8 #include <psmodules.h> 9 9 #include "psphotErrorCodes.h" 10 #include "pmPetrosian.h"11 10 12 11 #define PSPHOT_RECIPE "PSPHOT" // Name of the recipe to use … … 169 168 psKernel *psphotKernelFromPSF (pmSource *source, int nPix); 170 169 171 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 172 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 173 bool psphotIsophotal (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 174 bool psphotAnnuli (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 175 bool psphotKron (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 170 // functions related to extended source analysis 171 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal); 172 bool psphotRadialProfilesByAngles (pmSource *source, int Nsec, float Rmax); 173 float psphotRadiusFromProfile (pmSource *source, psVector *radius, psVector *flux, float fluxMin, float fluxMax); 174 bool psphotRadiiFromProfiles (pmSource *source, float fluxMin, float fluxMax); 175 bool psphotEllipticalProfile (pmSource *source); 176 bool psphotEllipticalContour (pmSource *source); 176 177 177 178 // psphotVisual functions … … 194 195 bool psphotVisualPlotApResid (psArray *sources); 195 196 bool psphotVisualPlotSourceSize (psMetadata *recipe, psArray *sources); 196 197 bool psphotVisualShowPetrosian (pmSource *source, pmPetrosian *petrosian); 198 bool psphotPetrosianAnalysis (pmReadout *readout, psArray *sources, psMetadata *recipe); 197 bool psphotVisualShowPetrosians (psArray *sources); 198 199 // bool psphotPetrosianAnalysis (pmReadout *readout, psArray *sources, psMetadata *recipe); 200 // bool psphotPetrosianProfile (pmReadout *readout, pmSource *source, float skynoise); 201 202 bool psphotPetrosian (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal); 203 bool psphotPetrosianRadialBins (pmSource *source, float radiusMax, float skynoise); 204 bool psphotPetrosianStats (pmSource *source); 205 206 // XXX old versions, currently disabled 207 // bool psphotIsophotal (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 208 // bool psphotAnnuli (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 209 // bool psphotKron (pmSource *source, psMetadata *recipe, psImageMaskType maskVal); 210 211 // XXX visualization functions related to radial profiles (disabled) 212 // bool psphotPetrosianVisualProfileByAngle (psVector *radius, psVector *flux); 213 // bool psphotPetrosianVisualProfileRadii (psVector *radius, psVector *flux, psVector *radiusBin, psVector *fluxBin, float peakFlux, float RadiusRef); 214 // bool psphotPetrosianVisualEllipticalContour (pmPetrosian *petrosian); 215 // bool psphotPetrosianVisualStats (psVector *radBin, psVector *fluxBin, 216 // psVector *refRadius, psVector *meanSB, 217 // psVector *petRatio, psVector *petRatioErr, psVector *fluxSum, 218 // float petRadius, float ratioForRadius, 219 // float petFlux, float radiusForFlux); 199 220 200 221 bool psphotImageQuality (psMetadata *recipe, psArray *sources); -
branches/eam_branches/20090715/psphot/src/psphotEllipticalContour.c
r25433 r25452 5 5 psF32 psphotEllipticalContourFunc (psVector *deriv, const psVector *params, const psVector *coord); 6 6 7 bool psphotEllipticalContour (pmSource *source, pmPetrosian *petrosian) { 7 bool psphotEllipticalContour (pmSource *source) { 8 9 pmSourceRadialProfile *profile = source->extpars->profile; 8 10 9 11 // use LMM to fit theta vs radius to an ellipse 10 psVector *theta = p etrosian->theta;11 psVector *radius = p etrosian->isophotalRadii;12 psVector *theta = profile->theta; 13 psVector *radius = profile->isophotalRadii; 12 14 13 15 // find Rmin and Rmax for the initial guess … … 83 85 /// XXX rationalize? if epsilon > 1, flip major and minor axes (rotate by 90 degrees) 84 86 if (params->data.F32[PAR_EPSILON] < 1.0) { 85 p etrosian->axes.major = params->data.F32[PAR_RMIN] / params->data.F32[PAR_EPSILON];86 p etrosian->axes.minor = params->data.F32[PAR_RMIN];87 p etrosian->axes.theta = params->data.F32[PAR_PHI];87 profile->axes.major = params->data.F32[PAR_RMIN] / params->data.F32[PAR_EPSILON]; 88 profile->axes.minor = params->data.F32[PAR_RMIN]; 89 profile->axes.theta = params->data.F32[PAR_PHI]; 88 90 } else { 89 p etrosian->axes.major = params->data.F32[PAR_RMIN];90 p etrosian->axes.minor = params->data.F32[PAR_RMIN] / params->data.F32[PAR_EPSILON];91 p etrosian->axes.theta = params->data.F32[PAR_PHI] + 0.5*M_PI;91 profile->axes.major = params->data.F32[PAR_RMIN]; 92 profile->axes.minor = params->data.F32[PAR_RMIN] / params->data.F32[PAR_EPSILON]; 93 profile->axes.theta = params->data.F32[PAR_PHI] + 0.5*M_PI; 92 94 } 93 95 94 96 psTrace ("psphot", 4, "# fitted values:\n"); 95 psTrace ("psphot", 4, "Phi: %f\n", p etrosian->axes.theta*PS_DEG_RAD);96 psTrace ("psphot", 4, "Rmaj: %f\n", p etrosian->axes.major);97 psTrace ("psphot", 4, "Rmin: %f\n", p etrosian->axes.minor);97 psTrace ("psphot", 4, "Phi: %f\n", profile->axes.theta*PS_DEG_RAD); 98 psTrace ("psphot", 4, "Rmaj: %f\n", profile->axes.major); 99 psTrace ("psphot", 4, "Rmin: %f\n", profile->axes.minor); 98 100 99 101 // show the results -
branches/eam_branches/20090715/psphot/src/psphotEllipticalProfile.c
r25433 r25452 1 1 # include "psphotInternal.h" 2 2 3 bool psphotEllipticalProfile (pmSource *source , pmPetrosian *petrosian) {3 bool psphotEllipticalProfile (pmSource *source) { 4 4 5 petrosian->radiusElliptical = psVectorAllocEmpty(100, PS_TYPE_F32); 6 petrosian->fluxElliptical = psVectorAllocEmpty(100, PS_TYPE_F32); 5 pmSourceRadialProfile *profile = source->extpars->profile; 7 6 8 psVector *radius = petrosian->radiusElliptical; 9 psVector *flux = petrosian->fluxElliptical; 7 profile->radiusElliptical = psVectorAllocEmpty(100, PS_TYPE_F32); 8 profile->fluxElliptical = psVectorAllocEmpty(100, PS_TYPE_F32); 9 10 psVector *radius = profile->radiusElliptical; 11 psVector *flux = profile->fluxElliptical; 10 12 11 13 // the psEllipse functions use z = 0.5(x/Sxx)^2 + 0.5(y/Syy)^2 + x y Sxy … … 20 22 psEllipseAxes axes; 21 23 axes.major = M_SQRT1_2; 22 axes.minor = M_SQRT1_2 * (p etrosian->axes.minor / petrosian->axes.major);24 axes.minor = M_SQRT1_2 * (profile->axes.minor / profile->axes.major); 23 25 24 26 // axes.major = 1.0; 25 // axes.minor = p etrosian->axes.minor / petrosian->axes.major;27 // axes.minor = profile->axes.minor / profile->axes.major; 26 28 27 axes.theta = p etrosian->axes.theta;29 axes.theta = profile->axes.theta; 28 30 psEllipseShape shape = psEllipseAxesToShape (axes); 29 31 … … 56 58 // psVector *radiusRaw = psVectorAllocEmpty(100, PS_TYPE_F32); 57 59 // psVector *fluxRaw = psVectorAllocEmpty(100, PS_TYPE_F32); 58 // for (int i = 0; i < p etrosian->radii->n; i++) {59 // psVector *r = p etrosian->radii->data[i];60 // psVector *f = p etrosian->fluxes->data[i];60 // for (int i = 0; i < profile->radii->n; i++) { 61 // psVector *r = profile->radii->data[i]; 62 // psVector *f = profile->fluxes->data[i]; 61 63 // for (int j = 0; j < r->n; j++) { 62 64 // psVectorAppend(radiusRaw, r->data.F32[j]); -
branches/eam_branches/20090715/psphot/src/psphotExtendedSourceAnalysis.c
r21519 r25452 21 21 } 22 22 23 // option to limit analysis to a specific region 24 char *region = psMetadataLookupStr (&status, recipe, "ANALYSIS_REGION"); 25 psRegion AnalysisRegion = psRegionForImage (readout->image, psRegionFromString (region)); 26 if (psRegionIsNaN (AnalysisRegion)) psAbort("analysis region mis-defined"); 23 // XXX require petrosian analysis for non-linear fits? 24 25 // XXX temporary user-supplied systematic sky noise measurement (derive from background model) 26 float skynoise = psMetadataLookupF32 (&status, recipe, "SKY.NOISE"); 27 28 # if (0) 29 // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN 30 // XXX use this to set skynoise 31 pmReadout *backModel = psphotSelectBackground (config, view); 32 pmReadout *backStdev = psphotSelectBackgroundStdev (config, view); 33 # endif 27 34 28 35 // S/N limit to perform full non-linear fits … … 38 45 sources = psArraySort (sources, pmSourceSortBySN); 39 46 40 // XXX some init functions for the extended source recipe options? 47 // option to limit analysis to a specific region 48 char *region = psMetadataLookupStr (&status, recipe, "ANALYSIS_REGION"); 49 psRegion AnalysisRegion = psRegionForImage (readout->image, psRegionFromString (region)); 50 if (psRegionIsNaN (AnalysisRegion)) psAbort("analysis region mis-defined"); 41 51 42 52 // choose the sources of interest … … 49 59 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 50 60 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 61 if (source->mode & PM_SOURCE_MODE_DEFECT) continue; 62 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 63 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue; 51 64 52 65 // limit selection to some SN limit … … 68 81 // if we request any of these measurements, we require the radial profile 69 82 if (doPetrosian || doIsophotal || doAnnuli || doKron) { 70 if (!psphotRadialProfile (source, recipe, maskVal)) {83 if (!psphotRadialProfile (source, recipe, skynoise, maskVal)) { 71 84 // all measurements below require the radial profile; skip them all 72 85 // re-subtract the object, leave local sky … … 79 92 } 80 93 94 // Petrosian Mags 95 if (doPetrosian) { 96 if (!psphotPetrosian (source, recipe, skynoise, maskVal)) { 97 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 98 } else { 99 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 100 Npetro ++; 101 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS; 102 } 103 } 104 105 # if (0) 81 106 // Isophotal Mags 82 107 if (doIsophotal) { … … 89 114 } 90 115 } 91 92 // Petrosian Mags93 if (doPetrosian) {94 if (!psphotPetrosian (source, recipe, maskVal)) {95 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);96 } else {97 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);98 Npetro ++;99 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS;100 }101 }102 103 116 // Kron Mags 104 117 if (doKron) { … … 111 124 } 112 125 } 113 114 // Radial Annuli 115 if (doAnnuli) { 116 if (!psphotAnnuli (source, recipe, maskVal)) { 117 psError(PSPHOT_ERR_UNKNOWN, false, "failure in Annuli analysis"); 118 return false; 119 } 120 psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 121 Nannuli ++; 122 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS; 123 } 126 # endif 124 127 125 128 // re-subtract the object, leave local sky 126 129 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 127 130 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 131 132 if (source->extpars) { 133 pmSourceRadialProfileFreeVectors(source->extpars->profile); 134 } 128 135 } 129 136 … … 133 140 psLogMsg ("psphot", PS_LOG_INFO, " %d annuli\n", Nannuli); 134 141 psLogMsg ("psphot", PS_LOG_INFO, " %d kron\n", Nkron); 142 143 psphotVisualShowResidualImage (readout); 144 145 if (doPetrosian) { 146 psphotVisualShowPetrosians (sources); 147 } 148 135 149 return true; 136 150 } -
branches/eam_branches/20090715/psphot/src/psphotFitSourcesLinear.c
r25433 r25452 76 76 if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) continue; 77 77 } else { 78 if (source->mode & PM_SOURCE_MODE_BLEND) continue;78 // if (source->mode & PM_SOURCE_MODE_BLEND) continue; 79 79 } 80 80 -
branches/eam_branches/20090715/psphot/src/psphotPetrosian.c
r21183 r25452 1 1 # include "psphotInternal.h" 2 2 3 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psImageMaskType maskVal) {3 bool psphotPetrosian (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal) { 4 4 5 bool status; 5 // XXX these need to go into recipe values 6 float Rmax = 200; 6 7 7 assert (source->extpars); 8 assert (source->extpars->profile); 9 assert (source->extpars->profile->radius); 10 assert (source->extpars->profile->flux); 8 psAssert (source->extpars, "need to run psphotRadialProfile first"); 9 psAssert (source->extpars->profile, "need to run psphotRadialProfile first"); 11 10 12 psVector *radius = source->extpars->profile->radius; 13 psVector *flux = source->extpars->profile->flux; 11 // integrate the radial profile for radial bins defined for the petrosian measurement: 12 // SB_i (r_i) where \alpha r_i < r < \beta r_i 13 if (!psphotPetrosianRadialBins (source, Rmax, skynoise)) { 14 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 15 return false; 16 } 17 18 // use the SB_i from above to calculate the petrosian radius and the flux within that radius 19 if (!psphotPetrosianStats (source)) { 20 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 21 return false; 22 } 23 24 psTrace ("psphot", 3, "source at %f,%f: petrosian radius: %f, flux: %f, axis ratio: %f, angle: %f", 25 source->peak->xf, source->peak->yf, 26 source->extpars->petrosian_80->radius, 27 source->extpars->petrosian_80->flux, 28 source->extpars->profile->axes.minor/source->extpars->profile->axes.major, 29 source->extpars->profile->axes.theta*PS_DEG_RAD); 14 30 15 // flux at which to measure isophotal parameters 16 float PETROSIAN_R0 = psMetadataLookupF32 (&status, recipe, "PETROSIAN_R0"); 17 float PETROSIAN_RF = psMetadataLookupF32 (&status, recipe, "PETROSIAN_FLUX_RATIO"); 18 assert (status); 19 20 // first find flux at R0 21 int firstAbove = -1; 22 int lastBelow = -1; 23 for (int i = 0; i < radius->n; i++) { 24 if (radius->data.F32[i] < PETROSIAN_R0) lastBelow = i; 25 if ((firstAbove < 0) && (radius->data.F32[i] > PETROSIAN_R0)) firstAbove = i; 26 } 27 // if we don't go out far enough, we have a problem... 28 if (lastBelow == radius->n - 1) { 29 psTrace ("psphot", 5, "did not go out far enough to reach petrosian reference radius..."); 30 // XXX skip object? raise a flag ? 31 return false; 32 } 33 if (firstAbove < 0) { 34 psTrace ("psphot", 5, "did not go out far enough to bound petrosian reference radius"); 35 // XXX raise a flag ? 36 return false; 37 } 38 39 // average flux in this range 40 float fluxR0 = 0.0; 41 int fluxRn = 0; 42 for (int i = PS_MIN(firstAbove, lastBelow); i <= PS_MAX(firstAbove, lastBelow); i++) { 43 fluxR0 += flux->data.F32[i]; 44 fluxRn ++; 45 } 46 fluxR0 /= (float)(fluxRn); 47 48 // target flux for petrosian radius 49 float fluxRP = fluxR0 * PETROSIAN_RF; 50 51 // find the first bin below the flux level and the last above the level 52 // XXX can this be done faster with bisection? 53 // XXX do I need to worry about crazy outliers? 54 // XXX should i be smoothing or fitting the curve? 55 int firstBelow = -1; 56 int lastAbove = -1; 57 for (int i = 0; i < flux->n; i++) { 58 if (flux->data.F32[i] > fluxRP) lastAbove = i; 59 if ((firstBelow < 0) && (flux->data.F32[i] < fluxRP)) firstBelow = i; 60 } 61 // if we don't go out far enough, we have a problem... 62 if (lastAbove == radius->n - 1) { 63 psTrace ("psphot", 5, "did not go out far enough to reach petrosian radius..."); 64 // XXX skip object? raise a flag ? 65 return false; 66 } 67 if (firstBelow < 0) { 68 psTrace ("psphot", 5, "did not go out far enough to bound petrosian radius"); 69 // XXX raise a flag ? 70 return false; 71 } 72 73 // need to examine pixels in this vicinity 74 float fluxFirst = 0; 75 float fluxLast = 0; 76 for (int i = 0; i <= PS_MAX(firstBelow, lastAbove); i++) { 77 if (i <= firstBelow) { 78 fluxFirst += flux->data.F32[i]; 79 } 80 if (i <= lastAbove) { 81 fluxLast += flux->data.F32[i]; 82 } 83 } 84 float fluxRPSum = 0.5*(fluxLast + fluxFirst); 85 float fluxRPSumErr = 0.5*fabs(fluxLast - fluxFirst); 86 // XXX need to use the weight appropriately here... 87 88 float rad = 0.5*(radius->data.F32[firstBelow] + radius->data.F32[lastAbove]); 89 float radErr = 0.5*fabs(radius->data.F32[firstBelow] - radius->data.F32[lastAbove]); 90 91 if (!source->extpars->petrosian) { 92 source->extpars->petrosian = pmSourcePetrosianValuesAlloc (); 93 } 94 95 // these are uncalibrated: instrumental mags and pixel units 96 source->extpars->petrosian->mag = -2.5*log10(fluxRPSum); 97 source->extpars->petrosian->magErr = fluxRPSumErr / fluxRPSum; 98 99 source->extpars->petrosian->rad = rad; 100 source->extpars->petrosian->radErr = radErr; 101 102 psTrace ("psphot", 5, "Petrosian flux:%f +/- %f @ %f +/- %f for %f, %f\n", 103 source->extpars->petrosian->mag, source->extpars->petrosian->magErr, 104 source->extpars->petrosian->rad, source->extpars->petrosian->radErr, 105 source->peak->xf, source->peak->yf); 106 107 return true; 108 31 return true; 109 32 } -
branches/eam_branches/20090715/psphot/src/psphotPetrosianAnalysis.c
r25433 r25452 66 66 67 67 psphotVisualShowResidualImage (readout); 68 69 // pause and wait for user input:70 // continue, save (provide name), ??71 char key[10];72 fprintf (stdout, "[c]ontinue? ");73 if (!fgets(key, 8, stdin)) {74 psWarning("Unable to read option");75 }76 77 68 return true; 78 69 } -
branches/eam_branches/20090715/psphot/src/psphotPetrosianProfile.c
r25433 r25452 12 12 pmPetrosian *petrosian = pmPetrosianAlloc(); 13 13 14 // XXX these need to go into recipe values 14 15 int Nsec = 24; 15 16 float Rmax = 200; -
branches/eam_branches/20090715/psphot/src/psphotPetrosianRadialBins.c
r25433 r25452 13 13 // track the non-overlapping radius values. 14 14 15 bool psphotPetrosianRadialBins (pmSource *source, pmPetrosian *petrosian, float radiusMax, float skynoise) { 15 // XXX move the resulting elements from profile to extpars->petrosian? 16 bool psphotPetrosianRadialBins (pmSource *source, float radiusMax, float skynoise) { 16 17 17 // XXX for testing, let's just set this to a value18 18 pmSourceRadialProfile *profile = source->extpars->profile; 19 19 20 float skyModelErrorSQ = PS_SQR(skynoise); 20 21 21 psVector *radius = p etrosian->radiusElliptical;22 psVector *flux = p etrosian->fluxElliptical;22 psVector *radius = profile->radiusElliptical; 23 psVector *flux = profile->fluxElliptical; 23 24 24 25 // sort incoming vectors by radius 25 p sphotPetrosianSortPair (radius, flux);26 pmSourceRadialProfileSortPair (radius, flux); 26 27 27 28 int nMax = radiusMax; … … 163 164 164 165 // save the vectors 165 p etrosian->radialBins = binRad;166 p etrosian->area = binArea;167 p etrosian->binSB = binSB;168 p etrosian->binSBstdev = binSBstdev;166 profile->radialBins = binRad; 167 profile->area = binArea; 168 profile->binSB = binSB; 169 profile->binSBstdev = binSBstdev; 169 170 170 171 // psphotPetrosianVisualProfileRadii (radius, flux, binRad, binSB, source->peak->flux, 0.0); -
branches/eam_branches/20090715/psphot/src/psphotPetrosianStats.c
r25433 r25452 8 8 float InterpolateValues (float X0, float Y0, float X1, float Y1, float X); 9 9 10 bool psphotPetrosianStats (pmSource *source, pmPetrosian *petrosian) { 10 bool psphotPetrosianStats (pmSource *source) { 11 12 pmSourceRadialProfile *profile = source->extpars->profile; 11 13 12 14 float petRadius, petFlux; 13 15 14 psVector *binSB = p etrosian->binSB;15 psVector *binSBstdev = p etrosian->binSBstdev;16 psVector *binRad = p etrosian->radialBins;17 psVector *area = p etrosian->area;16 psVector *binSB = profile->binSB; 17 psVector *binSBstdev = profile->binSBstdev; 18 psVector *binRad = profile->radialBins; 19 psVector *area = profile->area; 18 20 19 21 psVector *fluxSum = psVectorAllocEmpty(binSB->n, PS_TYPE_F32); … … 139 141 } 140 142 141 // save petRadius, petFlux 143 if (!source->extpars->petrosian_80) { 144 source->extpars->petrosian_80 = pmSourceExtendedFluxAlloc (); 145 } 146 pmSourceExtendedFlux *petrosian = source->extpars->petrosian_80; 147 142 148 // XXX save flags (anyPetro, manyPetro) 143 petrosian-> petrosianRadius = petRadius;144 petrosian-> petrosianFlux = petFlux;149 petrosian->radius = petRadius; 150 petrosian->flux = petFlux; 145 151 146 psphotPetrosianVisualStats (binRad, binSB, refRadius, meanSB, petRatio, petRatioErr, fluxSum, petRadius, PETROSIAN_RATIO, petFlux, apRadius);152 // psphotPetrosianVisualStats (binRad, binSB, refRadius, meanSB, petRatio, petRatioErr, fluxSum, petRadius, PETROSIAN_RATIO, petFlux, apRadius); 147 153 148 154 psFree(fluxSum); -
branches/eam_branches/20090715/psphot/src/psphotRadialProfile.c
r21366 r25452 1 1 # include "psphotInternal.h" 2 2 3 # define COMPARE_RADIUS(A,B) (radius->data.F32[A] < radius->data.F32[B]) 4 # define SWAP_RADIUS(TYPE,A,B) { \ 5 float tmp; \ 6 if (A != B) { \ 7 tmp = radius->data.F32[A]; \ 8 radius->data.F32[A] = radius->data.F32[B]; \ 9 radius->data.F32[B] = tmp; \ 10 tmp = flux->data.F32[A]; \ 11 flux->data.F32[A] = flux->data.F32[B]; \ 12 flux->data.F32[B] = tmp; \ 13 tmp = variance->data.F32[A]; \ 14 variance->data.F32[A] = variance->data.F32[B]; \ 15 variance->data.F32[B] = tmp; \ 16 } \ 17 } 18 19 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psImageMaskType maskVal) { 3 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal) { 20 4 21 5 // allocate pmSourceExtendedParameters, if not already defined … … 28 12 } 29 13 30 int nPts = source->pixels->numRows * source->pixels->numCols; 31 source->extpars->profile->radius = psVectorAllocEmpty (nPts, PS_TYPE_F32); 32 source->extpars->profile->flux = psVectorAllocEmpty (nPts, PS_TYPE_F32); 33 source->extpars->profile->variance = psVectorAllocEmpty (nPts, PS_TYPE_F32); 14 // XXX these need to go into recipe values 15 int Nsec = 24; 16 float Rmax = 200; 17 float fluxMin = 0.0; 18 float fluxMax = source->peak->flux; 34 19 35 psVector *radius = source->extpars->profile->radius; 36 psVector *flux = source->extpars->profile->flux; 37 psVector *variance = source->extpars->profile->variance; 20 // generate a series of radial profiles at Nsec evenly spaced angles. the profile flux 21 // is measured by interpolation for small radii; for large radii, the pixels in a box 22 // are averaged to increase the S/N 23 if (!psphotRadialProfilesByAngles (source, Nsec, Rmax)) { 24 psError (PS_ERR_UNKNOWN, false, "failed to measure radial profile for petrosian"); 25 return false; 26 } 38 27 39 // XXX use the extended source model here for Xo, Yo? 40 // XXX define a radius scaled to the elliptical contour? 28 // use the radial profiles to determine the radius of a given isophote. this isophote 29 // is used to determine the elliptical shape of the object, so it has a relatively high 30 // value (nominally 50% of the peak) 31 if (!psphotRadiiFromProfiles (source, fluxMin, fluxMax)) { 32 psError (PS_ERR_UNKNOWN, false, "failed to measure isophotal radii from profiles"); 33 return false; 34 } 41 35 42 int n = 0; 43 44 float Xo = 0.0; 45 float Yo = 0.0; 46 47 if (source->modelEXT) { 48 Xo = source->modelEXT->params->data.F32[PM_PAR_XPOS] - source->pixels->col0; 49 Yo = source->modelEXT->params->data.F32[PM_PAR_YPOS] - source->pixels->row0; 50 } else { 51 Xo = source->peak->xf - source->pixels->col0; 52 Yo = source->peak->yf - source->pixels->row0; 36 // convert the isophotal radius vs angle measurements to an elliptical contour 37 if (!psphotEllipticalContour (source)) { 38 psLogMsg ("psphot", 3, "failed to measure elliptical contour"); 39 return false; 53 40 } 54 for (int iy = 0; iy < source->pixels->numRows; iy++) { 55 for (int ix = 0; ix < source->pixels->numCols; ix++) { 56 if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix]) continue; 57 radius->data.F32[n] = hypot (ix - Xo, iy - Yo) ; 58 flux->data.F32[n] = source->pixels->data.F32[iy][ix]; 59 variance->data.F32[n] = source->variance->data.F32[iy][ix]; 60 n++; 61 } 41 42 // generate a single, normalized radial profile following the elliptical contours. 43 // the radius is normalized by the axis ratio so that on the major axis, 1 pixel = 1 pixel 44 if (!psphotEllipticalProfile (source)) { 45 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 46 return false; 62 47 } 63 radius->n = n; 64 variance->n = n; 65 flux->n = n; 66 67 // sort the vector set by the radius 68 PSSORT (radius->n, COMPARE_RADIUS, SWAP_RADIUS, NONE); 69 48 70 49 return true; 71 50 } -
branches/eam_branches/20090715/psphot/src/psphotRadialProfileByAngles.c
r25433 r25452 10 10 psVector *psphotLineValuesBresen (psImage *image, int X1, int Y1, int X2, int Y2, int dW, int swapcoords); 11 11 12 bool psphotRadialProfilesByAngles (pmSource *source, pmPetrosian *petrosian,int Nsec, float Rmax) {12 bool psphotRadialProfilesByAngles (pmSource *source, int Nsec, float Rmax) { 13 13 14 14 // we want to have an even number of sectors so we can do 180 deg symmetrizing … … 16 16 float dtheta = 2.0*M_PI / Nsec; 17 17 18 psFree(petrosian->radii); 19 psFree(petrosian->fluxes); 20 psFree(petrosian->theta); 21 22 petrosian->radii = psArrayAllocEmpty(Nsec); 23 petrosian->fluxes = psArrayAllocEmpty(Nsec); 24 petrosian->theta = psVectorAllocEmpty(Nsec, PS_TYPE_F32); 18 pmSourceRadialProfile *profile = source->extpars->profile; 19 psFree(profile->radii); 20 psFree(profile->fluxes); 21 psFree(profile->theta); 22 23 profile->radii = psArrayAllocEmpty(Nsec); 24 profile->fluxes = psArrayAllocEmpty(Nsec); 25 profile->theta = psVectorAllocEmpty(Nsec, PS_TYPE_F32); 25 26 26 27 … … 72 73 } 73 74 74 psArrayAdd (p etrosian->radii, 100, radius);75 psArrayAdd (p etrosian->fluxes, 100, flux);76 psVectorAppend (p etrosian->theta, theta);75 psArrayAdd (profile->radii, 100, radius); 76 psArrayAdd (profile->fluxes, 100, flux); 77 psVectorAppend (profile->theta, theta); 77 78 78 79 // psphotPetrosianVisualProfileByAngle (radius, flux); … … 84 85 for (int i = 0; i < Nsec / 2; i++) { 85 86 86 psVector *r1 = p etrosian->radii->data[i];87 psVector *r2 = p etrosian->radii->data[i+Nsec/2];88 89 psVector *f1 = p etrosian->fluxes->data[i];90 psVector *f2 = p etrosian->fluxes->data[i+Nsec/2];87 psVector *r1 = profile->radii->data[i]; 88 psVector *r2 = profile->radii->data[i+Nsec/2]; 89 90 psVector *f1 = profile->fluxes->data[i]; 91 psVector *f2 = profile->fluxes->data[i+Nsec/2]; 91 92 92 93 psAssert (r1->n == r2->n, "mis-matched vectors"); -
branches/eam_branches/20090715/psphot/src/psphotRadiiFromProfiles.c
r25433 r25452 1 1 # include "psphotInternal.h" 2 2 3 // Given the Petrosian data (radii, fluxes) determine the radius for each profile at the desisred isophote3 // Given the Radial Profiles (radii, fluxes) determine the radius for each profile at the desired isophote 4 4 5 bool psphotRadiiFromProfiles (pmSource *source, pmPetrosian *petrosian,float fluxMin, float fluxMax) {5 bool psphotRadiiFromProfiles (pmSource *source, float fluxMin, float fluxMax) { 6 6 7 petrosian->isophotalRadii = psVectorAlloc(petrosian->theta->n, PS_TYPE_F32);7 pmSourceRadialProfile *profile = source->extpars->profile; 8 8 9 for (int i = 0; i < petrosian->theta->n; i++) { 10 psVector *radii = petrosian->radii->data[i]; 11 psVector *fluxes = petrosian->fluxes->data[i]; 12 float radius = psphotRadiusFromProfile (source, radii, fluxes, fluxMin, fluxMax); 9 psFree(profile->isophotalRadii); 10 profile->isophotalRadii = psVectorAlloc(profile->theta->n, PS_TYPE_F32); 13 11 14 // psphotPetrosianVisualProfileByAngle (radii, fluxes, radius); 12 for (int i = 0; i < profile->theta->n; i++) { 13 psVector *radii = profile->radii->data[i]; 14 psVector *fluxes = profile->fluxes->data[i]; 15 float radius = psphotRadiusFromProfile (source, radii, fluxes, fluxMin, fluxMax); 15 16 16 // warn on NAN? 17 petrosian->isophotalRadii->data.F32[i] = radius; 18 } 19 return true; 17 // psphotPetrosianVisualProfileByAngle (radii, fluxes, radius); 18 19 // warn on NAN? 20 profile->isophotalRadii->data.F32[i] = radius; 21 } 22 return true; 20 23 } 21 24 … … 79 82 80 83 // sort the flux by the radius 81 p sphotPetrosianSortPair (radius, flux);84 pmSourceRadialProfileSortPair (radius, flux); 82 85 83 86 int nOut = 0; … … 128 131 // XXX is there a macro in psLib that does this interpolation? 129 132 if (i == 0) { 130 ps LogMsg ("psphot", 3, "bogus radial profile for ..., skipping");133 psTrace ("psphot", 4, "bogus radial profile for source at %f, %f, skipping", source->peak->xf, source->peak->yf); 131 134 psFree (fluxBinned); 132 135 psFree (radiusBinned); -
branches/eam_branches/20090715/psphot/src/psphotReadout.c
r25409 r25452 212 212 finish: 213 213 214 psphotPetrosianAnalysis (readout, sources, recipe); 214 // XXX drop this : test dev version 215 // psphotPetrosianAnalysis (readout, sources, recipe); 215 216 216 217 // plot positive sources -
branches/eam_branches/20090715/psphot/src/psphotSourceSize.c
r25433 r25452 334 334 bool isPSF = (fabs(nSigma) < options->nSigmaApResid) && (fabs(Mxx - psfClump->X) < options->nSigmaMoments*psfClump->dX) && (fabs(Myy - psfClump->Y) < options->nSigmaMoments*psfClump->dY); 335 335 if (isPSF) { 336 if (Mxx > 3.0) { 337 fprintf (stderr, "!"); 338 } 336 339 Npsf ++; 337 340 continue; … … 354 357 355 358 // XXX allow the Mxx, Myy to be less than psfClump->X,Y (by some nSigma)? 356 bool isEXT = (nSigma > options->nSigmaApResid) && (Mxx > psfClump->X) && (Myy > psfClump->Y);359 bool isEXT = (nSigma > options->nSigmaApResid) || ((Mxx > psfClump->X) && (Myy > psfClump->Y)); 357 360 if (isEXT) { 358 361 source->mode |= PM_SOURCE_MODE_EXT_LIMIT; … … 361 364 } 362 365 366 fprintf (stderr, "miss %f,%f : %f %f -- %f\n", source->peak->xf, source->peak->yf, Mxx, Myy, nSigma); 363 367 Nmiss ++; 364 368 } -
branches/eam_branches/20090715/psphot/src/psphotVisual.c
r25433 r25452 2094 2094 } 2095 2095 2096 bool psphotVisualShowPetrosian (pmSource *source, pmPetrosian *petrosian) { 2097 2098 KiiOverlay overlay[2]; 2099 2100 if (source == NULL) return true; 2096 bool psphotVisualShowPetrosians (psArray *sources) { 2097 2098 int Noverlay, NOVERLAY; 2099 KiiOverlay *overlay; 2101 2100 2102 2101 // if (!pmVisualIsVisual()) return true; … … 2105 2104 if (kapa == -1) return false; 2106 2105 2107 if (kapa == -1) { 2108 fprintf (stderr, "kapa not opened, skipping\n"); 2109 return false; 2110 } 2111 2112 overlay[0].type = KII_OVERLAY_CIRCLE; 2113 overlay[0].x = source->peak->xf; 2114 overlay[0].y = source->peak->yf; 2115 overlay[0].dx = 2.0*petrosian->petrosianRadius; 2116 overlay[0].dy = 2.0*petrosian->petrosianRadius*petrosian->axes.minor/petrosian->axes.major; 2117 overlay[0].angle = petrosian->axes.theta * PS_DEG_RAD; 2118 overlay[0].text = NULL; 2119 2120 overlay[1].type = KII_OVERLAY_CIRCLE; 2121 overlay[1].x = source->peak->xf; 2122 overlay[1].y = source->peak->yf; 2123 overlay[1].dx = 4.0*petrosian->petrosianRadius; 2124 overlay[1].dy = 4.0*petrosian->petrosianRadius*petrosian->axes.minor/petrosian->axes.major; 2125 overlay[1].angle = petrosian->axes.theta * PS_DEG_RAD; 2126 overlay[1].text = NULL; 2127 2128 KiiLoadOverlay (kapa, overlay, 2, "red"); 2106 Noverlay = 0; 2107 NOVERLAY = 100; 2108 ALLOCATE (overlay, KiiOverlay, NOVERLAY); 2109 2110 for (int i = 0; i < sources->n; i++) { 2111 pmSource *source = sources->data[i]; 2112 2113 if (!source) continue; 2114 if (!source->extpars) continue; 2115 if (!source->extpars->profile) continue; 2116 if (!source->extpars->petrosian_80) continue; 2117 2118 pmSourceRadialProfile *profile = source->extpars->profile; 2119 pmSourceExtendedFlux *petrosian = source->extpars->petrosian_80; 2120 2121 overlay[Noverlay].type = KII_OVERLAY_CIRCLE; 2122 overlay[Noverlay].x = source->peak->xf; 2123 overlay[Noverlay].y = source->peak->yf; 2124 overlay[Noverlay].dx = 2.0*petrosian->radius; 2125 overlay[Noverlay].dy = 2.0*petrosian->radius*profile->axes.minor/profile->axes.major; 2126 overlay[Noverlay].angle = profile->axes.theta * PS_DEG_RAD; 2127 overlay[Noverlay].text = NULL; 2128 Noverlay ++; 2129 CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100); 2130 2131 overlay[Noverlay].type = KII_OVERLAY_CIRCLE; 2132 overlay[Noverlay].x = source->peak->xf; 2133 overlay[Noverlay].y = source->peak->yf; 2134 overlay[Noverlay].dx = 4.0*petrosian->radius; 2135 overlay[Noverlay].dy = 4.0*petrosian->radius*profile->axes.minor/profile->axes.major; 2136 overlay[Noverlay].angle = profile->axes.theta * PS_DEG_RAD; 2137 overlay[Noverlay].text = NULL; 2138 Noverlay ++; 2139 CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100); 2140 } 2141 2142 KiiLoadOverlay (kapa, overlay, Noverlay, "red"); 2143 FREE (overlay); 2144 2145 // pause and wait for user input: 2146 // continue, save (provide name), ?? 2147 char key[10]; 2148 fprintf (stdout, "[c]ontinue? "); 2149 if (!fgets(key, 8, stdin)) { 2150 psWarning("Unable to read option"); 2151 } 2129 2152 2130 2153 return true; … … 2152 2175 2153 2176 # if (0) 2154 // *** make a histogram of the source counts in the x and y directions2155 psHistogram *nX = psHistogramAlloc (graphdata.xmin, graphdata.xmax, 50.0);2156 psHistogram *nY = psHistogramAlloc (graphdata.ymin, graphdata.ymax, 50.0);2157 psVectorHistogram (nX, xFaint, NULL, NULL, 0);2158 psVectorHistogram (nY, yFaint, NULL, NULL, 0);2159 psVector *dX = psVectorAlloc (nX->nums->n, PS_TYPE_F32);2160 psVector *vX = psVectorAlloc (nX->nums->n, PS_TYPE_F32);2161 psVector *dY = psVectorAlloc (nY->nums->n, PS_TYPE_F32);2162 psVector *vY = psVectorAlloc (nY->nums->n, PS_TYPE_F32);2163 for (int i = 0; i < nX->nums->n; i++) {2164 dX->data.F32[i] = nX->nums->data.S32[i];2165 vX->data.F32[i] = 0.5*(nX->bounds->data.F32[i] + nX->bounds->data.F32[i+1]);2166 }2167 for (int i = 0; i < nY->nums->n; i++) {2168 dY->data.F32[i] = nY->nums->data.S32[i];2169 vY->data.F32[i] = 0.5*(nY->bounds->data.F32[i] + nY->bounds->data.F32[i+1]);2170 }2171 2172 graphdata.color = KapaColorByName ("black");2173 graphdata.ptype = 0;2174 graphdata.size = 0.0;2175 graphdata.style = 0;2176 KapaPrepPlot (myKapa, dX->n, &graphdata);2177 KapaPlotVector (myKapa, dX->n, dX->data.F32, "x");2178 KapaPlotVector (myKapa, vX->n, vX->data.F32, "y");2179 2180 psFree (nX);2181 psFree (dX);2182 psFree (vX);2183 2184 psFree (nY);2185 psFree (dY);2186 psFree (vY);2177 // *** make a histogram of the source counts in the x and y directions 2178 psHistogram *nX = psHistogramAlloc (graphdata.xmin, graphdata.xmax, 50.0); 2179 psHistogram *nY = psHistogramAlloc (graphdata.ymin, graphdata.ymax, 50.0); 2180 psVectorHistogram (nX, xFaint, NULL, NULL, 0); 2181 psVectorHistogram (nY, yFaint, NULL, NULL, 0); 2182 psVector *dX = psVectorAlloc (nX->nums->n, PS_TYPE_F32); 2183 psVector *vX = psVectorAlloc (nX->nums->n, PS_TYPE_F32); 2184 psVector *dY = psVectorAlloc (nY->nums->n, PS_TYPE_F32); 2185 psVector *vY = psVectorAlloc (nY->nums->n, PS_TYPE_F32); 2186 for (int i = 0; i < nX->nums->n; i++) { 2187 dX->data.F32[i] = nX->nums->data.S32[i]; 2188 vX->data.F32[i] = 0.5*(nX->bounds->data.F32[i] + nX->bounds->data.F32[i+1]); 2189 } 2190 for (int i = 0; i < nY->nums->n; i++) { 2191 dY->data.F32[i] = nY->nums->data.S32[i]; 2192 vY->data.F32[i] = 0.5*(nY->bounds->data.F32[i] + nY->bounds->data.F32[i+1]); 2193 } 2194 2195 graphdata.color = KapaColorByName ("black"); 2196 graphdata.ptype = 0; 2197 graphdata.size = 0.0; 2198 graphdata.style = 0; 2199 KapaPrepPlot (myKapa, dX->n, &graphdata); 2200 KapaPlotVector (myKapa, dX->n, dX->data.F32, "x"); 2201 KapaPlotVector (myKapa, vX->n, vX->data.F32, "y"); 2202 2203 psFree (nX); 2204 psFree (dX); 2205 psFree (vX); 2206 2207 psFree (nY); 2208 psFree (dY); 2209 psFree (vY); 2187 2210 2188 2211
Note:
See TracChangeset
for help on using the changeset viewer.
