- Timestamp:
- Sep 17, 2009, 2:26:32 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotEllipticalContour.c
r25178 r25433 1 1 # include "psphotInternal.h" 2 3 // XXX consistency : theta in radians here and in calling functions4 2 5 3 // model parameters … … 7 5 psF32 psphotEllipticalContourFunc (psVector *deriv, const psVector *params, const psVector *coord); 8 6 9 bool psphotEllipticalContour (pm Petrosian *petrosian) {7 bool psphotEllipticalContour (pmSource *source, pmPetrosian *petrosian) { 10 8 11 9 // use LMM to fit theta vs radius to an ellipse … … 19 17 // arrays to hold the data to be fitted 20 18 // we fit x and y vs theta in separate passes. 21 psArray *x = psArrayAlloc (2*radius->n);22 psVector *y = psVectorAlloc (2*radius->n, PS_TYPE_F32);23 psVector *yErr = psVectorAlloc (2*radius->n, PS_TYPE_F32);19 psArray *x = psArrayAllocEmpty(2*radius->n); 20 psVector *y = psVectorAllocEmpty(2*radius->n, PS_TYPE_F32); 21 psVector *yErr = psVectorAllocEmpty(2*radius->n, PS_TYPE_F32); 24 22 25 23 int n = 0; 26 24 for (int i = 0; i < radius->n; i++) { 25 if (!isfinite(radius->data.F32[i])) continue; 27 26 28 27 psVector *coord = NULL; … … 50 49 Rmax = MAX (Rmax, radius->data.F32[i]); 51 50 } 52 assert (x->n == n); 53 assert (y->n == n); 51 x->n = n; 52 y->n = n; 53 yErr->n = n; 54 55 if (n < 4) { 56 psFree (x); 57 psFree (y); 58 psFree (yErr); 59 return false; 60 } 54 61 55 62 psVector *params = psVectorAlloc (3, PS_TYPE_F32); … … 61 68 62 69 // XXX for now, no parameter masks, skip checkLimits 70 // XXX might help to add a limit to the angle or re-parameterize the ellipse in terms of Rxx, Ryy, Rxy 63 71 // constraint->checkLimits = psastroModelBoresiteLimits; 64 72 … … 84 92 } 85 93 86 fprintf (stderr, "# fitted values:\n");87 fprintf (stderr, "Po: %f\n", params->data.F32[PAR_PHI]*PS_DEG_RAD);88 fprintf (stderr, "Ep: %f\n", params->data.F32[PAR_EPSILON]);89 fprintf (stderr, "Rm: %f\n", params->data.F32[PAR_RMIN]);90 94 psTrace ("psphot", 4, "# fitted values:\n"); 95 psTrace ("psphot", 4, "Phi: %f\n", petrosian->axes.theta*PS_DEG_RAD); 96 psTrace ("psphot", 4, "Rmaj: %f\n", petrosian->axes.major); 97 psTrace ("psphot", 4, "Rmin: %f\n", petrosian->axes.minor); 98 91 99 // show the results 92 psphotPetrosianVisualEllipticalContour (petrosian);100 // psphotPetrosianVisualEllipticalContour (petrosian); 93 101 94 102 psFree (x); 95 103 psFree (y); 96 104 psFree (yErr); 105 psFree (params); 106 psFree (covar); 107 psFree (myMin); 108 psFree (constraint); 97 109 98 110 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
