- Timestamp:
- Sep 17, 2009, 2:26:32 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotPetrosianProfile.c
r25275 r25433 7 7 // structure to something the pmRadialProfile 8 8 9 bool psphotPetrosianProfile (pm Source *source, float skynoise) {9 bool psphotPetrosianProfile (pmReadout *readout, pmSource *source, float skynoise) { 10 10 11 // container to hold results from the radial profile analysis12 pmPetrosian *petrosian = pmPetrosianAlloc();11 // container to hold results from the radial profile analysis 12 pmPetrosian *petrosian = pmPetrosianAlloc(); 13 13 14 int Nsec = 24;15 float Rmax = 200;16 float fluxMin = 0.0;17 float fluxMax = source->peak->flux;14 int Nsec = 24; 15 float Rmax = 200; 16 float fluxMin = 0.0; 17 float fluxMax = source->peak->flux; 18 18 19 // generate a series of radial profiles at Nsec evenly spaced angles. the profile flux 20 // is measured by interpolation for small radii; for large radii, the pixels in a box 21 // are averaged to increase the S/N (XXX not yet done) 22 if (!psphotRadialProfilesByAngles (petrosian, source, Nsec, Rmax)) { 23 psError (PS_ERR_UNKNOWN, false, "failed to measure radial profile for petrosian"); 24 return false; 25 } 19 // generate a series of radial profiles at Nsec evenly spaced angles. the profile flux 20 // is measured by interpolation for small radii; for large radii, the pixels in a box 21 // are averaged to increase the S/N (XXX not yet done) 22 if (!psphotRadialProfilesByAngles (source, petrosian, Nsec, Rmax)) { 23 psError (PS_ERR_UNKNOWN, false, "failed to measure radial profile for petrosian"); 24 psFree (petrosian); 25 return false; 26 } 26 27 27 // use the radial profiles to determine the radius of a given isophote. this isophote 28 // is used to determine the elliptical shape of the object, so it has a relatively high 29 // value (nominally 50% of the peak) 30 if (!psphotRadiiFromProfiles (petrosian, fluxMin, fluxMax)) { 31 psError (PS_ERR_UNKNOWN, false, "failed to measure isophotal radii from profiles"); 32 return false; 33 } 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, petrosian, fluxMin, fluxMax)) { 32 psError (PS_ERR_UNKNOWN, false, "failed to measure isophotal radii from profiles"); 33 psFree (petrosian); 34 return false; 35 } 34 36 35 // convert the isophotal radius vs angle measurements to an elliptical contour 36 if (!psphotEllipticalContour (petrosian)) { 37 psError (PS_ERR_UNKNOWN, false, "failed to measure elliptical contour"); 38 return false; 39 } 37 // convert the isophotal radius vs angle measurements to an elliptical contour 38 if (!psphotEllipticalContour (source, petrosian)) { 39 psLogMsg ("psphot", 3, "failed to measure elliptical contour"); 40 psFree (petrosian); 41 return false; 42 } 40 43 41 // generate a single, normalized radial profile following the elliptical contours. 42 // the radius is normalized by the axis ratio so that on the major axis, 1 pixel = 1 pixel 43 if (!psphotEllipticalProfile (source, petrosian)) { 44 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 45 return false; 46 } 44 // generate a single, normalized radial profile following the elliptical contours. 45 // the radius is normalized by the axis ratio so that on the major axis, 1 pixel = 1 pixel 46 if (!psphotEllipticalProfile (source, petrosian)) { 47 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 48 psFree (petrosian); 49 return false; 50 } 47 51 48 // integrate the radial profile for radial bins defined for the petrosian measurement: 49 // SB_i (r_i) where \alpha r_i < r < \beta r_i 50 if (!psphotPetrosianRadialBins (source, petrosian, Rmax, skynoise)) { 51 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 52 return false; 53 } 52 // integrate the radial profile for radial bins defined for the petrosian measurement: 53 // SB_i (r_i) where \alpha r_i < r < \beta r_i 54 if (!psphotPetrosianRadialBins (source, petrosian, Rmax, skynoise)) { 55 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 56 psFree (petrosian); 57 return false; 58 } 54 59 55 // use the SB_i from above to calculate the petrosian radius and the flux within that radius 56 if (!psphotPetrosianStats (petrosian)) { 57 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 58 return false; 59 } 60 // use the SB_i from above to calculate the petrosian radius and the flux within that radius 61 if (!psphotPetrosianStats (source, petrosian)) { 62 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 63 psFree (petrosian); 64 return false; 65 } 60 66 61 // XXX this will only work in the psphot context, not the psphotPetrosianStudy... 62 // XXX add the petrosian to the pmSource structure... 63 psphotVisualShowPetrosian (source, petrosian); 67 // XXX this will only work in the psphot context, not the psphotPetrosianStudy... 68 // XXX add the petrosian to the pmSource structure... 69 // psphotVisualShowResidualImage (readout); 70 psphotVisualShowPetrosian (source, petrosian); 64 71 65 psphotPetrosianFreeVectors(petrosian);72 psphotPetrosianFreeVectors(petrosian); 66 73 67 fprintf (stdout, "\n petrosian radius: %f\n flux: %f\n axis ratio: %f\n angle: %f\n",68 petrosian->petrosianRadius, petrosian->petrosianFlux, petrosian->axes.minor/petrosian->axes.major, PS_DEG_RAD*petrosian->axes.theta);74 psTrace ("psphot", 3, "source at %f,%f: petrosian radius: %f, flux: %f, axis ratio: %f, angle: %f", 75 source->peak->xf, source->peak->yf, petrosian->petrosianRadius, petrosian->petrosianFlux, petrosian->axes.minor/petrosian->axes.major, PS_DEG_RAD*petrosian->axes.theta); 69 76 70 return true; 77 psFree (petrosian); 78 return true; 71 79 }
Note:
See TracChangeset
for help on using the changeset viewer.
