nanograv / enterprise

ENTERPRISE (Enhanced Numerical Toolbox Enabling a Robust PulsaR Inference SuitE) is a pulsar timing analysis code, aimed at noise analysis, gravitational-wave searches, and timing model analysis.
https://enterprise.readthedocs.io
MIT License
64 stars 65 forks source link

Uniform log prior takes a long time to compute #307

Closed AaronDJohnson closed 2 years ago

AaronDJohnson commented 2 years ago

Calling pta.get_lnprior() takes almost as long as pta.get_lnlikelihood(). For a model 2A with 130 parameters, it takes ~ 7 ms to compute the log prior with the current scipy.stats.uniform methods and ~9 ms to compute the log likelihood. However, computing these uniform priors via a custom function only takes ~18.4 microseconds.

Can we make uniform priors compute faster within enterprise? This could save almost half the run time for model 2A, and probably some time in the 3A searches too.

paulthebaker commented 2 years ago

The slowdown in scipy.stats.uniform likely comes from the overhead associated with the underlying rv_continuous object. This would mean our other priors which use scipy.stats will have the same overhead and be way slower than expected. Whatever the solution for UniformPrior is we should do the same for NormalPrior. LinearExpPrior already has a homegrown PDF function.