--
You received this message because you are subscribed to the Google Groups "lmfit-py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmfit-py+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lmfit-py/dcc01c48-8e78-4111-819d-d460bf904396n%40googlegroups.com.
Hi Zondo,
I agree with Jeremy’s suggestions.
If runtime is a concern, then you really need to first convert loops to numpy ufuncs. This is not really about lmfit or even emcee. You need to speed up your `KP_radio_data` function, ideally getting rid of the double loop over array indices and replacing your `integra` with an integration function. Like,
asseth=np.zeros(thm+1)
for j in range(0, thm+1):
asseth[j]=0.+(m.pi/2.)*j/thm
could be
asseth = m.pi/(2*thm) * np.arange(thm+1)
That’s the simplest case. There are several more to look at.
I cannot recommend coercing data to float32. That will almost certainly make the analysis worse and might actually be slower. I would also recommend against using so many constants with different scales in your code. And (especially if you do feel that you are somehow obligated to use float32), I would try to work in units so that the numerical values you are passing out of your function are more on the magnitude scale of 1e-7 to 1.e+7. When you start going far outside these ranges, floating point precisions become strained when comparing small differences.
--Matt
median of posterior probability distribution -------------------------------------------- [[Variables]] k0: 10.0098822 +/- 0.01490645 (0.15%) (init = 10.00896) t: 8.75023394 +/- 0.00561892 (0.06%) (init = 8.749972) bmu: 37.1058780 +/- 0.05500376 (0.15%) (init = 37.1072) [[Correlations]] (unreported correlations are < 0.100) C(k0, t) = +0.9399 C(k0, bmu) = -0.8924 C(t, bmu) = -0.8477 Maximum Likelihood Estimation from emcee ------------------------------------------------- Parameter MLE Value Median Value Uncertainty k0 10.00904 10.00988 0.01491 t 8.74996 8.75023 0.00562 bmu 37.10723 37.10588 0.05500 Error estimates from emcee: ------------------------------------------------------ Parameter -2sigma -1sigma median +1sigma +2sigma k0 -0.0387 -0.0120 10.0099 0.0178 0.0579 t -0.0223 -0.0030 8.7502 0.0083 0.0371 bmu -0.1646 -0.0568 37.1059 0.0532 0.1221
--