Changeset 15400
- Timestamp:
- Oct 28, 2007, 3:41:13 PM (19 years ago)
- Location:
- branches/eam_branch_20071023/psphot/src
- Files:
-
- 7 edited
-
Makefile.am (modified) (1 diff)
-
psphot.h (modified) (1 diff)
-
psphotAnnuli.c (modified) (2 diffs)
-
psphotIsophotal.c (modified) (4 diffs)
-
psphotMakeResiduals.c (modified) (3 diffs)
-
psphotPetrosian.c (modified) (5 diffs)
-
psphotRadialProfile.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20071023/psphot/src/Makefile.am
r15040 r15400 47 47 psphotModelWithPSF.c \ 48 48 psphotExtendedSources.c \ 49 psphotRadialProfile.c \ 49 50 psphotPetrosian.c \ 50 51 psphotIsophotal.c \ -
branches/eam_branch_20071023/psphot/src/psphot.h
r15040 r15400 116 116 psKernel *psphotKernelFromPSF (pmSource *source, int nPix); 117 117 118 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psMaskType maskVal); 118 119 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal); 119 120 bool psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal); -
branches/eam_branch_20071023/psphot/src/psphotAnnuli.c
r15359 r15400 8 8 assert (source->extpars->profile->flux); 9 9 10 bool status; 11 10 12 psVector *radius = source->extpars->profile->radius; 11 13 psVector *weight = source->extpars->profile->weight; … … 14 16 // XXX how do I define the radii? we can put a vector in the recipe... 15 17 // radialBins defines the bounds or start and stop (we can skip some that way... 16 psVector *radialBinsLower = psMetadataLookup Vector (&status, recipe, RADIAL_ANNULAR_BINS_LOWER);17 psVector *radialBinsUpper = psMetadataLookup Vector (&status, recipe, RADIAL_ANNULAR_BINS_UPPER);18 psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER"); 19 psVector *radialBinsUpper = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER"); 18 20 assert (radialBinsLower->n == radialBinsUpper->n); 19 21 -
branches/eam_branch_20071023/psphot/src/psphotIsophotal.c
r15359 r15400 7 7 assert (source->extpars->profile->radius); 8 8 assert (source->extpars->profile->flux); 9 10 bool status; 9 11 10 12 psVector *radius = source->extpars->profile->radius; … … 19 21 // XXX do I need to worry about crazy outliers? 20 22 // XXX should i be smoothing or fitting the curve? 21 firstBelow = -1;22 lastAbove = -1;23 int firstBelow = -1; 24 int lastAbove = -1; 23 25 for (int i = 0; i < flux->n; i++) { 24 26 if (flux->data.F32[i] > ISOPHOT_FLUX) lastAbove = i; … … 31 33 for (int i = 0; i <= PS_MAX(firstBelow, lastAbove); i++) { 32 34 if (i <= firstBelow) { 33 isophot FluxFirst += flux->data.F32[i];35 isophotalFluxFirst += flux->data.F32[i]; 34 36 } 35 37 if (i <= lastAbove) { 36 isophot FluxLast += flux->data.F32[i];38 isophotalFluxLast += flux->data.F32[i]; 37 39 } 38 40 } 39 float isophotalFlux = 0.5*(isophot FluxLast + isophotFluxFirst);40 float isophotalFluxErr = 0.5*fabs(isophot FluxLast - isophotFluxFirst);41 float isophotalFlux = 0.5*(isophotalFluxLast + isophotalFluxFirst); 42 float isophotalFluxErr = 0.5*fabs(isophotalFluxLast - isophotalFluxFirst); 41 43 42 44 float isophotalRad = 0.5*(radius->data.F32[firstBelow] + radius->data.F32[lastAbove]); … … 57 59 58 60 } 59 60 # if (0)61 // XXX cache the tmpScalar62 psScalar fluxScalar;63 fluxScalar.type.type = PS_TYPE_F32;64 fluxScalar.data.F32 = ISOPHOT_FLUX;65 66 // radius and flux must be sorted by radius67 68 // XXX in general, flux decreases monotonically with radius. however, since exceptions are69 // possible we need to do something to smooth or otherwise handle the flux variations70 71 // get the index of the flux-sorted vector72 psVector *fluxIndex = psVectorSortIndex (flux);73 74 // XXX need to write psVectorIndexBinaryDisect, which operates on a75 76 // use disection to get in the right vicinity77 binS = psVectorIndexBinaryDisect (&result, flux, fluxIndex, fluxScalar, PS_BISECT_FIRST);78 binE = psVectorIndexBinaryDisect (&result, flux, fluxIndex, fluxScalar, PS_BISECT_LAST);79 80 // find the min and max radius bins in this range81 82 // XXX do something to choose a more accurate radial bin83 84 # endif -
branches/eam_branch_20071023/psphot/src/psphotMakeResiduals.c
r15359 r15400 28 28 29 29 float nSigma = psMetadataLookupF32(&status, recipe, "PSF.RESIDUALS.NSIGMA"); 30 PS_ASSERT (status, false); 31 32 float pixelSN = psMetadataLookupF32(&status, recipe, "PSF.RESIDUALS.PIX.SN"); 30 33 PS_ASSERT (status, false); 31 34 … … 195 198 //resid->weight->data.F32[oy][ox] = fluxStats->sampleStdev; 196 199 197 // if value < NRESID_SIGMA*sigma, mask pixel in resid map 198 if (resid->Ro->data.F32[oy][ox] < NRESID_SIGMA*fluxStats->sampleStdev) { 199 resid->mask->data.U8[oy][ox] = RESID_SIG_MASK; 200 if (resid->Ro->data.F32[oy][ox] < pixelSN*fluxStats->sampleStdev) { 201 resid->mask->data.U8[oy][ox] = 1; 200 202 } 201 203 … … 234 236 resid->Ry->data.F32[oy][ox] = B->data.F64[2]; 235 237 236 dRo = sqrt(A->data.F32[0][0]);237 if (resid->Ro->data.F32[oy][ox] < NRESID_SIGMA*dRo) {238 resid->mask->data.U8[oy][ox] = RESID_SIG_MASK;238 float dRo = sqrt(A->data.F32[0][0]); 239 if (resid->Ro->data.F32[oy][ox] < pixelSN*dRo) { 240 resid->mask->data.U8[oy][ox] = 1; 239 241 } 240 242 //resid->weight->data.F32[oy][ox] = XXX; -
branches/eam_branch_20071023/psphot/src/psphotPetrosian.c
r15359 r15400 2 2 3 3 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal) { 4 5 bool status; 4 6 5 7 assert (source->extpars); … … 17 19 18 20 // first find flux at R0 19 firstBelow = -1;20 lastAbove = -1;21 int firstBelow = -1; 22 int lastAbove = -1; 21 23 for (int i = 0; i < radius->n; i++) { 22 24 if (radius->data.F32[i] > PETROSIAN_R0) lastAbove = i; … … 25 27 26 28 // average flux in this range 27 fl uxR0 = 0.0;28 fluxRn = 0;29 float fluxR0 = 0.0; 30 int fluxRn = 0; 29 31 for (int i = PS_MIN(firstBelow, lastAbove); i <= PS_MAX(firstBelow, lastAbove); i++) { 30 32 fluxR0 += flux->data.F32[i]; 31 33 fluxRn ++; 32 34 } 33 fluxR0 = fluxR0 /(float)(fluxRn);35 fluxR0 /= (float)(fluxRn); 34 36 35 37 // target flux for petrosian radius 36 fl uxRP = fluxR0 * PETROSIAN_RF;38 float fluxRP = fluxR0 * PETROSIAN_RF; 37 39 38 40 // find the first bin below the flux level and the last above the level … … 58 60 } 59 61 } 60 float flux = 0.5*(fluxLast + fluxFirst);61 float flux Err = 0.5*fabs(fluxLast - fluxFirst);62 float fluxRPSum = 0.5*(fluxLast + fluxFirst); 63 float fluxRPSumErr = 0.5*fabs(fluxLast - fluxFirst); 62 64 // XXX need to use the weight appropriately here... 63 65 … … 70 72 71 73 // these are uncalibrated: instrumental mags and pixel units 72 source->extpars->petrosian->mag = -2.5*log10(flux );73 source->extpars->petrosian->magErr = flux Err / flux;74 source->extpars->petrosian->mag = -2.5*log10(fluxRPSum); 75 source->extpars->petrosian->magErr = fluxRPSumErr / fluxRPSum; 74 76 75 77 source->extpars->petrosian->rad = rad; -
branches/eam_branch_20071023/psphot/src/psphotRadialProfile.c
r15357 r15400 5 5 // allocate pmSourceExtendedParameters, if not already defined 6 6 if (!source->extpars) { 7 source->extpars = pmSourceExtendedPar ametersAlloc ();7 source->extpars = pmSourceExtendedParsAlloc (); 8 8 } 9 9 10 10 if (!source->extpars->profile) { 11 source->extpars->profile = pmSourceRadialProfile ();11 source->extpars->profile = pmSourceRadialProfileAlloc (); 12 12 } 13 13 … … 19 19 psVector *radius = source->extpars->profile->radius; 20 20 psVector *flux = source->extpars->profile->flux; 21 psVector *weight = source->extpars->profile-> radius;21 psVector *weight = source->extpars->profile->weight; 22 22 23 23 // XXX use the extended source model here for Xo, Yo? … … 40 40 flux->n = n; 41 41 42 SortVectorsByRadius (radius, flux, weight); 42 // XXX need to sort here 43 // SortVectorsByRadius (radius, flux, weight); 43 44 44 45 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
