From edae55dac7b4167a33661075bdb9824b390a56da Mon Sep 17 00:00:00 2001 From: tlatorre Date: Mon, 5 Aug 2019 14:05:26 -0500 Subject: update sno_charge to prevent nan when charge is negative This commit updates the charge spectrum initialization to convolve the charge distribution over a wider range to make sure that we have a nonzero probability of observing charges all the way down to qlo. The reason for this is that previously for some negative charges the probability of observing that charge was zero, which was causing the likelihood to return nan. --- src/sno_charge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sno_charge.c b/src/sno_charge.c index f36bfb5..f0d38ec 100644 --- a/src/sno_charge.c +++ b/src/sno_charge.c @@ -431,7 +431,7 @@ void init_charge(void) for (j = 0; j < nq; j++) { params[0] = x[j]; params[1] = i; - gsl_integration_cquad(&F, fmax(0.0,x[j]-QSMEAR_ADC*10/MEAN_HIPT), x[j]+QSMEAR_ADC*10/MEAN_HIPT, 0, 1e-4, w, &result, &error, &nevals); + gsl_integration_cquad(&F, fmax(0.0,x[j]-QSMEAR_ADC*100/MEAN_HIPT), x[j]+QSMEAR_ADC*100/MEAN_HIPT, 0, 1e-4, w, &result, &error, &nevals); /* Store the smeared charge PDF in a temporary array since we need * to keep the original PDF for the next iteration of the loop. */ y[j] = result; -- cgit