GeoStat-Framework / GSTools

GSTools - A geostatistical toolbox: random fields, variogram estimation, covariance models, kriging and much more
https://geostat-framework.org
GNU Lesser General Public License v3.0
544 stars 71 forks source link

[Enh] speed up sampling with emcee #344

Closed MuellerSeb closed 4 months ago

MuellerSeb commented 5 months ago

The EnsembleSampler of emcee has an option vectorize, to state, that the log probability function accepts vectors: https://emcee.readthedocs.io/en/v3.1.4/user/sampler/?highlight=vectorize

Since this is the case for our implementations in the covariance model class, we should use it.

I could speed up the setup of a SRF class by factor 5 to 6:

import timeit
import gstools as gs
m = gs.Matern(dim=3)
%timeit gs.SRF(m)

For models without an analytical spectral density, this is significant:

import timeit
import gstools as gs
m = gs.Stable(dim=3)
%timeit gs.SRF(m)