- Timestamp:
- Oct 28, 2007, 3:41:13 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.
