- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
extsrc/gpcsw/gpcsrc/fits/burntool/trailfit.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/extsrc/gpcsw/gpcsrc/fits/burntool/trailfit.c
r23924 r27840 30 30 31 31 if(box->func != BURN_PWR && box->func != BURN_EXP) { 32 fprintf(stderr, "error: unimplemented fit function %d\n", box->func); 32 fprintf(stderr, "error: unimplemented fit function %d (err %d)\n", 33 box->func, box->fiterr); 33 34 return(-1); 34 35 } … … 137 138 box->xfit = (int *)calloc(xe-xs+1, sizeof(int)); 138 139 box->yfit = (int *)calloc(xe-xs+1, sizeof(int)); 140 if(box->zero == NULL || box->xfit == NULL || box->yfit == NULL) { 141 fprintf(stderr, "\rerror: failed to alloc box memory\n"); 142 exit(-679); 143 } 139 144 /* Some defaults */ 140 145 box->slope = 0.0; … … 226 231 /* FIXME: sanity check fits */ 227 232 if(slope >= FIT_MAX_SLOPE || slope < FIT_MIN_SLOPE) { 233 box->slope = slope; 234 box->nfit = 0; 228 235 box->fiterr = FIT_SLOPE_ERROR; 236 /* Check whether it's a significant trail (but with pos slope) or just noise */ 237 linearrms(nfit, ybuf+y1, zbuf+y1, slope, zero, &trial); 238 /* 100203 JT: bad idea: appears to be a bug in read/writing ABS(nfit) */ 239 // if(trial > 2*rms) box->nfit = -box->nfit; 240 if(trial > 2*rms) box->func = BURN_POSSLOPE; 229 241 return(-1); 230 242 } … … 266 278 /* FIXME: what's a really good criterion for negligible fit? */ 267 279 /* 100 pixels up fit is zsum or ~zsum/e */ 268 if(zsum > NEGLIGIBLE_TRAIL*rms) { 280 // if(zsum > NEGLIGIBLE_TRAIL*rms) { 281 if(zsum > NEGLIGIBLE_TRAIL*rms || 282 /* 100113: but also evaluate at the end of the fit for stubby trails */ 283 zbuf[y2]*zsum > NEGLIGIBLE_TRAIL*rms) { 269 284 270 285 /* Ascertain the starting point of where the fit is good */ … … 283 298 } 284 299 /* Update fit ranges */ 285 box->sxfit = box->xfit[0]; 286 box->exfit = box->xfit[box->nfit-1]; 287 300 if(box->nfit > 0) { 301 box->sxfit = box->xfit[0]; 302 box->exfit = box->xfit[box->nfit-1]; 303 } else { 304 box->sxfit = xs; 305 box->exfit = xs - 1; 306 box->fiterr = FIT_ALL_GONE; 307 } 308 // if(box->nfit <= 0) fprintf(stderr, "WHOA, got nfit = 0\n"); 288 309 return(0); 289 310 }
Note:
See TracChangeset
for help on using the changeset viewer.
