- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/psModules
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psModules merged eligible /branches/eam_branches/stackphot.20100406/psModules 27623-27653 /branches/pap_delete/psModules 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/simtest_nebulous_branches/psModules/src/objects/pmSourceExtendedPars.c
r23487 r27840 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 // pmSourceRadialFlux carries the raw radial flux information, including angular bins 39 static void pmSourceRadialFluxFree(pmSourceRadialFlux *flux) 40 { 41 if (!flux) return; 42 psFree(flux->radii); 43 psFree(flux->fluxes); 44 psFree(flux->theta); 45 psFree(flux->isophotalRadii); 46 } 47 48 pmSourceRadialFlux *pmSourceRadialFluxAlloc() 49 { 50 pmSourceRadialFlux *flux = (pmSourceRadialFlux *)psAlloc(sizeof(pmSourceRadialFlux)); 51 psMemSetDeallocator(flux, (psFreeFunc) pmSourceRadialFluxFree); 52 53 flux->radii = NULL; 54 flux->fluxes = NULL; 55 flux->theta = NULL; 56 flux->isophotalRadii = NULL; 57 58 return flux; 59 } 60 61 bool psMemCheckSourceRadialFlux(psPtr ptr) 62 { 63 PS_ASSERT_PTR(ptr, false); 64 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceRadialFluxFree); 65 } 66 67 // pmSourceEllipticalFlux carries the elliptical renormalized radial flux info 68 static void pmSourceEllipticalFluxFree(pmSourceEllipticalFlux *flux) 69 { 70 if (!flux) return; 71 psFree(flux->radiusElliptical); 72 psFree(flux->fluxElliptical); 73 } 74 75 pmSourceEllipticalFlux *pmSourceEllipticalFluxAlloc() 76 { 77 pmSourceEllipticalFlux *flux = (pmSourceEllipticalFlux *)psAlloc(sizeof(pmSourceEllipticalFlux)); 78 psMemSetDeallocator(flux, (psFreeFunc) pmSourceEllipticalFluxFree); 79 80 flux->radiusElliptical = NULL; 81 flux->fluxElliptical = NULL; 82 83 return flux; 84 } 85 86 bool psMemCheckSourceEllipticalFlux(psPtr ptr) 87 { 88 PS_ASSERT_PTR(ptr, false); 89 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceEllipticalFluxFree); 90 } 91 92 // pmSourceRadialProfile defines flux information in radial bins 93 static void pmSourceRadialProfileFree(pmSourceRadialProfile *profile) 94 { 95 if (!profile) return; 96 psFree(profile->binSB); 97 psFree(profile->binSBstdev); 98 psFree(profile->binSBerror); 99 psFree(profile->binSum); 100 psFree(profile->binFill); 101 psFree(profile->radialBins); 102 psFree(profile->area); 103 } 104 105 pmSourceRadialProfile *pmSourceRadialProfileAlloc() 106 { 107 pmSourceRadialProfile *profile = (pmSourceRadialProfile *)psAlloc(sizeof(pmSourceRadialProfile)); 108 psMemSetDeallocator(profile, (psFreeFunc) pmSourceRadialProfileFree); 109 110 profile->binSB = NULL; 111 profile->binSBstdev = NULL; 112 profile->binSBerror = NULL; 113 profile->binSum = NULL; 114 profile->binFill = NULL; 115 profile->radialBins = NULL; 116 profile->area = NULL; 117 return profile; 118 } 119 120 bool psMemCheckSourceRadialProfile(psPtr ptr) 121 { 122 PS_ASSERT_PTR(ptr, false); 123 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceRadialProfileFree); 124 } 125 126 # if (0) 127 // pmSourceRadialProfileFreeVectors frees the intermediate data values 128 bool pmSourceRadialProfileFreeVectors(pmSourceRadialProfile *profile) { 129 130 psFree(profile->radii); 131 psFree(profile->fluxes); 132 psFree(profile->theta); 133 psFree(profile->isophotalRadii); 134 135 psFree(profile->radiusElliptical); 136 psFree(profile->fluxElliptical); 137 138 // psFree(profile->binSB); 139 // psFree(profile->binSBstdev); 140 // psFree(profile->binSBerror); 141 142 // psFree(profile->radialBins); 143 psFree(profile->area); 144 145 profile->radii = NULL; 146 profile->fluxes = NULL; 147 profile->theta = NULL; 148 profile->isophotalRadii = NULL; 149 150 profile->radiusElliptical = NULL; 151 profile->fluxElliptical = NULL; 152 153 // profile->binSB = NULL; 154 // profile->binSBstdev = NULL; 155 // profile->binSBerror = NULL; 156 157 // profile->radialBins = NULL; 158 profile->area = NULL; 159 160 return true; 161 } 162 # endif 163 164 // *** pmSourceRadialProfileSortPair is a utility function for sorting a pair of vectors 165 # define COMPARE_INDEX(A,B) (index->data.F32[A] < index->data.F32[B]) 166 # define SWAP_INDEX(TYPE,A,B) { \ 167 float tmp; \ 168 if (A != B) { \ 169 tmp = index->data.F32[A]; \ 170 index->data.F32[A] = index->data.F32[B]; \ 171 index->data.F32[B] = tmp; \ 172 tmp = extra->data.F32[A]; \ 173 extra->data.F32[A] = extra->data.F32[B]; \ 174 extra->data.F32[B] = tmp; \ 175 } \ 176 } 177 178 bool pmSourceRadialProfileSortPair (psVector *index, psVector *extra) { 179 180 // sort the vector set by the radius 181 PSSORT (index->n, COMPARE_INDEX, SWAP_INDEX, NONE); 182 return true; 183 } 184 185 // *** pmSourceExtendedPars describes the possible collection of extended flux measurements for a source 37 186 static void pmSourceExtendedParsFree (pmSourceExtendedPars *pars) { 38 187 if (!pars) return; 39 188 40 psFree(pars->profile); 41 psFree(pars->annuli); 42 psFree(pars->isophot); 43 psFree(pars->petrosian); 44 psFree(pars->kron); 189 psFree(pars->radFlux); 190 psFree(pars->ellipticalFlux); 191 psFree(pars->radProfile); 192 psFree(pars->petProfile); 45 193 return; 46 194 } … … 50 198 psMemSetDeallocator(pars, (psFreeFunc) pmSourceExtendedParsFree); 51 199 52 pars->profile = NULL; 53 pars->annuli = NULL; 54 pars->isophot = NULL; 55 pars->petrosian = NULL; 56 pars->kron = NULL; 57 200 pars->radFlux = NULL; 201 pars->ellipticalFlux = NULL; 202 pars->radProfile = NULL; 203 pars->petProfile = NULL; 204 205 pars->petrosianFlux = NAN; 206 pars->petrosianFluxErr = NAN; 207 pars->petrosianRadius = NAN; 208 pars->petrosianRadiusErr = NAN; 209 pars->petrosianR90 = NAN; 210 pars->petrosianR90Err = NAN; 211 pars->petrosianR50 = NAN; 212 pars->petrosianR50Err = NAN; 58 213 return pars; 59 214 } … … 66 221 67 222 68 static void pmSourceRadialProfileFree (pmSourceRadialProfile *profile) { 69 if (!profile) return; 70 71 psFree(profile->radius); 72 psFree(profile->flux); 73 psFree(profile->variance); 223 // *** pmSourceExtendedFlux describes the flux within an elliptical aperture of some kind 224 static void pmSourceExtendedFluxFree (pmSourceExtendedFlux *flux) { 225 if (!flux) return; 74 226 return; 75 227 } 76 228 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) 90 { 91 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 } 229 pmSourceExtendedFlux *pmSourceExtendedFluxAlloc (void) { 230 231 pmSourceExtendedFlux *flux = (pmSourceExtendedFlux *) psAlloc(sizeof(pmSourceExtendedFlux)); 232 psMemSetDeallocator(flux, (psFreeFunc) pmSourceExtendedFluxFree); 233 234 flux->flux = 0.0; 235 flux->fluxErr = 0.0; 236 flux->radius = 0.0; 237 flux->radiusErr = 0.0; 238 239 return flux; 240 } 241 242 243 bool psMemCheckSourceExtendedFlux(psPtr ptr) 244 { 245 PS_ASSERT_PTR(ptr, false); 246 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceExtendedFluxFree); 247 }
Note:
See TracChangeset
for help on using the changeset viewer.
