Histogram

[1]:
import smpl
from smpl import plot
from smpl import stat
from smpl import functions as f
import numpy as np
np.random.seed(1337)
print(smpl.__version__)

0.0.145.8+dirty

Data will be binned for histogram like treatment if bins is set.

[28]:
x= np.random.randn(1000000)
# Default uncertainty of bins is poisson distributed in y direction and none for x
plot.fit(x,f.gauss,bins=20,label="data",binunc=stat.no_dist,init=True)
plot.fit(x,f.gauss,bins=20,label="data",init=True)
plot.fit(x,f.gauss,bins=20,label="data",fmt="hist",init=True)
plot.fit(x,f.gauss,bins=20,label="data",sigmas=1,fmt="step",init=True)
[28]:
[-0.0004888939285280101+/-0.0009500644370575443,
 185436.2352450125+/-213.2219863857544,
 1.0092870039127373+/-0.0006732722210998675,
 -0.8237436147228498+/-2.0184112993509595]
../../../_images/example_plot_histogram_plot_histogram_3_1.png
../../../_images/example_plot_histogram_plot_histogram_3_2.png
../../../_images/example_plot_histogram_plot_histogram_3_3.png
../../../_images/example_plot_histogram_plot_histogram_3_4.png
[30]:
x= np.random.randn(100000)
plot.fit(stat.normalize(x),stat.normalize(x**3),f.gauss,bins=50,lpos=-1,binunc=stat.no_dist,init=False)
[30]:
[[0.4977090790855503+/-0.0003070464464950067,
  7440.639157941011+/-19.767401890089637,
  0.10696591230822808+/-0.00036948945991354206,
  4.993422223678342+/-10.041245874568924],
 [0.49087390034153305+/-0.00016067474528052965,
  79084.00931057706+/-623.2222542815749,
  0.009053544202024916+/-0.00010215607237191762,
  144.77469218369598+/-59.199886580652375]]
../../../_images/example_plot_histogram_plot_histogram_4_1.png
[ ]: