diff options
Diffstat (limited to 'src/fit.c')
-rw-r--r-- | src/fit.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -5248,17 +5248,18 @@ int fit_event2(event *ev, double *xopt, double *fmin, int *id, size_t n, double size_t npeaks; size_t *result; size_t nvertices; + int status; /* Create the minimizer object. */ opt = nlopt_create(NLOPT_LN_BOBYQA, 4+3*n); nlopt_set_min_objective(opt,nlopt_nll2,&fpars); /* Guess the position and t0 of the event using the QUAD fitter. */ - quad(ev,pos,&t0,10000); + status = quad(ev,pos,&t0,10000); - if (t0 < 0 || t0 > GTVALID || NORM(pos) > PSUP_RADIUS) { - /* If the QUAD fitter returns something outside the PSUP or with an - * invalid time we just assume it's at the center. */ + if (status || t0 < 0 || t0 > GTVALID || NORM(pos) > PSUP_RADIUS) { + /* If the QUAD fitter fails or returns something outside the PSUP or + * with an invalid time we just assume it's at the center. */ fprintf(stderr, "quad returned pos = %.2f, %.2f, %.2f t0 = %.2f. Assuming vertex is at the center!\n", pos[0], pos[1], pos[2], t0); pos[0] = 0.0; |