Changeset 17335
- Timestamp:
- Apr 6, 2008, 10:11:39 AM (18 years ago)
- Location:
- branches/eam_branch_20080324/psphot/src
- Files:
-
- 5 edited
-
psphotAnnuli.c (modified) (2 diffs)
-
psphotIsophotal.c (modified) (4 diffs)
-
psphotKron.c (modified) (1 diff)
-
psphotPetrosian.c (modified) (5 diffs)
-
psphotRadialProfile.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080324/psphot/src/psphotAnnuli.c
r15562 r17335 1 # include "psphot .h"1 # include "psphotInternal.h" 2 2 3 3 bool psphotAnnuli (pmSource *source, psMetadata *recipe, psMaskType maskVal) { … … 55 55 source->extpars->annuli->fluxVar = fluxSquare; 56 56 57 psFree (pixelCount); 58 57 59 return true; 58 60 } -
branches/eam_branch_20080324/psphot/src/psphotIsophotal.c
r15562 r17335 1 # include "psphot.h" 1 # include "psphotInternal.h" 2 3 static float ISOPHOT_FLUX = NAN; 2 4 3 5 bool psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal) { … … 14 16 15 17 // flux at which to measure isophotal parameters 16 // XXX cache this? 17 float ISOPHOT_FLUX = psMetadataLookupF32 (&status, recipe, "ISOPHOTAL_FLUX"); 18 if (!isfinite(ISOPHOT_FLUX)) { 19 // XXX ISOPHOTAL_FLUX should be specified in mags, need the zero point to get counts/sec 20 ISOPHOT_FLUX = psMetadataLookupF32 (&status, recipe, "ISOPHOTAL_FLUX"); 21 assert (status); 22 } 18 23 19 24 // find the first bin below the flux level and the last above the level 20 // XXX can this be done faster with disection?25 // XXX can this be done faster with bisection? 21 26 // XXX do I need to worry about crazy outliers? 22 27 // XXX should i be smoothing or fitting the curve? … … 27 32 if ((firstBelow < 0) && (flux->data.F32[i] < ISOPHOT_FLUX)) firstBelow = i; 28 33 } 29 34 // if we don't go out far enough, we have a problem... 35 if (lastAbove == flux->n - 1) { 36 psTrace ("psphot", 5, "did not go out far enough to reach isophotal magnitude"); 37 // XXX raise a flag ? 38 return false; 39 } 40 if (firstBelow < 0) { 41 psTrace ("psphot", 5, "did not go out far enough to bound isophotal magnitude: error unmeasured"); 42 // XXX raise a flag ? 43 lastAbove = firstBelow; 44 return false; 45 } 46 30 47 // need to examine pixels in this vicinity 31 48 float isophotalFluxFirst = 0; … … 56 73 source->extpars->isophot->radErr = isophotalRadErr; 57 74 75 psTrace ("psphot", 5, "Isophot flux:%f +/- %f @ %f +/- %f for %f, %f\n", 76 source->extpars->isophot->mag, source->extpars->isophot->magErr, 77 source->extpars->isophot->rad, source->extpars->isophot->radErr, 78 source->peak->xf, source->peak->yf); 79 58 80 return true; 59 81 -
branches/eam_branch_20080324/psphot/src/psphotKron.c
r13983 r17335 1 # include "psphot .h"1 # include "psphotInternal.h" 2 2 3 3 bool psphotKron (pmSource *source, psMetadata *recipe, psMaskType maskVal) { -
branches/eam_branch_20080324/psphot/src/psphotPetrosian.c
r15800 r17335 1 # include "psphot.h" 1 # include "psphotInternal.h" 2 3 static float PETROSIAN_R0 = NAN; 4 static float PETROSIAN_RF = NAN; 2 5 3 6 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal) { … … 14 17 15 18 // flux at which to measure isophotal parameters 16 // XXX cache this? 17 float PETROSIAN_R0 = psMetadataLookupF32 (&status, recipe, "PETROSIAN_R0"); 18 float PETROSIAN_RF = psMetadataLookupF32 (&status, recipe, "PETROSIAN_FLUX_RATIO"); 19 if (!isfinite(PETROSIAN_R0)) { 20 PETROSIAN_R0 = psMetadataLookupF32 (&status, recipe, "PETROSIAN_R0"); 21 PETROSIAN_RF = psMetadataLookupF32 (&status, recipe, "PETROSIAN_FLUX_RATIO"); 22 assert (status); 23 } 19 24 20 25 // first find flux at R0 21 int first Below= -1;22 int last Above= -1;26 int firstAbove = -1; 27 int lastBelow = -1; 23 28 for (int i = 0; i < radius->n; i++) { 24 if (radius->data.F32[i] > PETROSIAN_R0) lastAbove = i; 25 if ((firstBelow < 0) && (flux->data.F32[i] < PETROSIAN_R0)) firstBelow = i; 29 if (radius->data.F32[i] < PETROSIAN_R0) lastBelow = i; 30 if ((firstAbove < 0) && (radius->data.F32[i] > PETROSIAN_R0)) firstAbove = i; 31 } 32 // if we don't go out far enough, we have a problem... 33 if (lastBelow == radius->n - 1) { 34 psTrace ("psphot", 5, "did not go out far enough to reach petrosian reference radius..."); 35 // XXX skip object? raise a flag ? 36 return false; 37 } 38 if (firstAbove < 0) { 39 psTrace ("psphot", 5, "did not go out far enough to bound petrosian reference radius"); 40 // XXX raise a flag ? 41 return false; 26 42 } 27 43 … … 29 45 float fluxR0 = 0.0; 30 46 int fluxRn = 0; 31 for (int i = PS_MIN(first Below, lastAbove); i <= PS_MAX(firstBelow, lastAbove); i++) {47 for (int i = PS_MIN(firstAbove, lastBelow); i <= PS_MAX(firstAbove, lastBelow); i++) { 32 48 fluxR0 += flux->data.F32[i]; 33 49 fluxRn ++; … … 42 58 // XXX do I need to worry about crazy outliers? 43 59 // XXX should i be smoothing or fitting the curve? 44 firstBelow = -1;45 lastAbove = -1;60 int firstBelow = -1; 61 int lastAbove = -1; 46 62 for (int i = 0; i < flux->n; i++) { 47 63 if (flux->data.F32[i] > fluxRP) lastAbove = i; 48 64 if ((firstBelow < 0) && (flux->data.F32[i] < fluxRP)) firstBelow = i; 65 } 66 // if we don't go out far enough, we have a problem... 67 if (lastAbove == radius->n - 1) { 68 psTrace ("psphot", 5, "did not go out far enough to reach petrosian radius..."); 69 // XXX skip object? raise a flag ? 70 return false; 71 } 72 if (firstBelow < 0) { 73 psTrace ("psphot", 5, "did not go out far enough to bound petrosian radius"); 74 // XXX raise a flag ? 75 return false; 49 76 } 50 77 … … 78 105 source->extpars->petrosian->radErr = radErr; 79 106 107 psTrace ("psphot", 5, "Petrosian flux:%f +/- %f @ %f +/- %f for %f, %f\n", 108 source->extpars->petrosian->mag, source->extpars->petrosian->magErr, 109 source->extpars->petrosian->rad, source->extpars->petrosian->radErr, 110 source->peak->xf, source->peak->yf); 111 80 112 return true; 81 113 -
branches/eam_branch_20080324/psphot/src/psphotRadialProfile.c
r15819 r17335 41 41 42 42 int n = 0; 43 float Xo = source->modelEXT->params->data.F32[PM_PAR_XPOS] - source->pixels->col0; 44 float Yo = source->modelEXT->params->data.F32[PM_PAR_YPOS] - source->pixels->row0; 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; 53 } 45 54 for (int iy = 0; iy < source->pixels->numRows; iy++) { 46 55 for (int ix = 0; ix < source->pixels->numCols; ix++) {
Note:
See TracChangeset
for help on using the changeset viewer.
