Package: uhammer
uhammeroffers a convenience layer foremcee.Features:uhammeroffers a simplified API.requires no code changes between running on multiple cores or with MPI.fixes some issues with the MPI Pool from emcee / schwimmbad.prints diagnostic messages when allocated nodes / cores do not fit well to specified
number of walkers or other parallelization related settings.can capture worker specific output to separate files.implements persisting of sampler state and supports continuation of sampling at a later time.can show an animated progress bar.Example usageTo useuhammeryou need:an instance ofParametersfor declaring the
parameters you want to sample from.a function, e.g. namedlnprob, which takes a parameters object and possible
extra arguments. This function returns the logarithic value of the computed
posterior probability.finally you callsamplefor running the sampler.importtimeimportnumpyasnpfromuhammerimportParameters,samplesigma=.5defgen_data():a0=.5b0=.5c0=1x=np.linspace(-2,2,100)y_measured=a0+b0*x+c0*x**2+sigma*np.random.randn(*x.shape)returnx,y_measuredp=Parameters()p.add("a",(0,1))p.add("b",(0,1))p.add("c",(0,2))deflnprob(p,x,y_measured):time.sleep(.0002)y=p.a+p.b*x+p.c*x**2diff=(y-y_measured)/sigmareturn-np.dot(diff.T,diff)/2n_samples=15000n_walkers_per_param=200samples,lnprobs=sample(lnprob,p,args=gen_data(),n_walkers_per_param=n_walkers_per_param,n_samples=n_samples,show_progress=True,show_output=False,)print()print(samples[5000:].mean(axis=0))$pythonexamples/sample_line_fit.pyuhammer: perform 25 steps of emcee sampler
✗ passed: 00:00:11.2 left: 00:00:00.0 - [∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣]

[0.52389808 0.53415134 1.01585175]CreditsThis package was created withCookiecutterand theuweschmitt/cookiecutter-pypackageproject template.History0.4.0 (2019-07-03)Ignore start values for parameters. Did not play well with the emcee algorithm.0.3.2 (2019-05-24)Less chatty and simpler progress report on euler. The existing progressbar
cluttered the lsf output files. Now we report in min time intervals of
at least 30 seconds.0.3.1 (2019-05-22)removedmpipoolfrom installation dependencies, else installation always needs
a working MPI setup. Stillmpirpoolis needed when run in parallel MPI mode.0.3.0 (2019-05-22)sample functions now return two arrays: the samples and the related log probabilitiesParameters.addnow has an optional argument for providing a starting value.load_samplesfunction allows extracting samples from a persisted sampler file.Replacedcapture_outputargument ofsampleandcontinue_samplingby two
argumentsshow_outputandoutput_prefix.Fixed bug in output recording incontinue_samplingfunction.Usempipoollibrariy now + added test formpibased parallel sampling.0.2.13 (2019-05-15)fix persisting pickler error in parallel mode0.2.12 (2019-05-02)minor tweaks for mpifix for emcee 3 dev version0.2.11 (2019-04-30)shutdown mpi pool in case a worker throws an exception, before
this fix mpirun would hang.fix handling of capture output file names when running with mpi0.2.10 (2019-04-19)fix race condition when removing marker filedeactivate unnecessary warnings about missing mpi4py0.2.9 (2019-04-16)Don’t show progressbar when run on euler nodeWorks with Python 3.70.2.8 (2019-04-12)Fix to work with dev version of emcee 30.2.7 (2019-03-20)Fix issue with capuring output in parallel modeStop progress bar in case of unhandled exception0.2.6 (2019-03-20)Fix dependencies for Python 3.7 in setup.py0.2.5 (2019-03-20)Fix package lookup in requirements_dev.txtFix error in error handling when output redirection fails.0.2.4 (2018-10-29)fix ordering of sampler output rows.0.2.3 (2018-10-24)check OMP_NUM_THREADS to warn of possible  over subscription.better pickling support for posterior function.0.2.2 (2018-10-11)Fix detection if uhammer runs on full node on euler.Dont show statusbar if direct write to fid 1 is not possible.Supress some unappropriate error messages from MPI, even if
uhammer is not run using mpirun.Fix ip check to detect if uhammer runs on euler.0.2.1 (2018-09-28)Fix of regression due to implementation of Python 2 support.0.2.0 (2018-09-28)Introduced Python 2 support.0.1.0 (2018-08-23)Initial version.