Functions and classes

Here you can find the documentation on the functions and classes of the hep_spt package.

Functions

adbin_hist(arr[, nbins, range, weights, …])

Create an adaptive binned histogram in N dimensions.

adbin_hist1d(arr[, nbins, range, weights, …])

Create an adaptive binned histogram in one dimension.

adbin_hist1d_edges(arr[, nbins, range, …])

Create adaptive binned edges to make a histogram from the given data.

adbin_hist2d_rectangles(bins, smp[, range, …])

Create a list of rectangles from a list of bins.

available_styles()

Get a list with the names of the available styles.

bit_length(arg)

Get the length of the binary representation of the given value(s).

calc_poisson_fu(m[, cl])

Return the lower and upper frequentist uncertainties for a poisson distribution with mean “m”.

calc_poisson_llu(m[, cl])

Calculate poisson uncertainties based on the logarithm of likelihood.

cfe(edges)

Calculate the centers of a set of bins given their edges.

clopper_pearson_int(k, N[, cl])

Return the frequentist Clopper-Pearson interval of having “k” events in “N”.

clopper_pearson_unc(k, N[, cl])

Return the frequentist Clopper-Pearson uncertainties of having “k” events in “N”.

cls_hypo(func, *args, **kwargs)

Create an instance of CLsHypo given a probability density(mass) function, as an object of type scipy.stats.rv_discrete or scipy.stats.rv_continuous.

cls_ts(alt, null)

Create an instance of CLsTS from the alternative an null hypotheses.

corr_hist2d(matrix, titles[, frmt, vmin, …])

Plot a correlation matrix in the given axes.

errorbar_hist(arr[, bins, range, weights, …])

Calculate the values needed to create an error bar histogram.

gauss_unc(s[, cl])

Calculate the gaussian uncertainty for a given confidence level.

gcd(a, b, *args)

Calculate the greatest common divisor of a set of numbers.

ibinary_repr(arg)

Get the binary representation of the given value(s).

is_power_2(arg)

Determine whether the input number(s) is a power of 2 or not.

ks_2samp(a, b[, wa, wb])

Compute the Kolmogorov-Smirnov statistic on 2 samples.

lcm(a, b, *args)

Calculate the least common multiple of a set of numbers.

modified_format(kwargs)

Modify the matplotlib format in this context.

next_power_2(arg)

Calculate the next number(s) greater than that(those) given and being a power(s) of 2.

opt_fig_div(naxes)

Get the optimal figure division for a given number of axes, where all the axes have the same dimensions.

path_to_styles()

Retrieve the path to the directory containing the styles.

poisson_fu(m)

Return the poisson frequentist uncertainty at one standard deviation of confidence level.

poisson_llu(m)

Return the poisson uncertainty at one standard deviation of confidence level.

profile(x, y[, bins, range, weights, std_type])

Calculate the profile from a 2D data sample.

pull(vals, err, ref[, ref_err])

Get the pull with the associated errors for a given set of values and a reference.

residual(vals, err, ref[, ref_err])

Calculate the residual with its errors, for a set of values with respect to a reference.

rv_random_sample(func[, size])

Create a random sample from the given rv_frozen object.

samples_cycler(smps, *args, **kwargs)

Generate a cycler.Cycler object were the labels are defined by “smps”, and the other parameters are left to the user.

set_style(*args)

Set the style for matplotlib to one within this project.

stat_values(arr[, axis, weights])

Calculate mean and variance and standard deviations of the sample and the mean from the given array.

sw2_unc(arr[, bins, range, weights])

Calculate the errors using the sum of squares of weights.

text_in_rectangles(recs, txt[, cax])

Write text inside matplotlib.patches.Rectangle instances.

wald_int(k, N[, cl])

Calculate the symmetric Wald interval of having “k” elements in “N”.

wald_unc(k, N[, cl])

Calculate the symmetric Wald uncertainty of having “k” elements in “N”.

wald_weighted_int(k, N[, cl])

Calculate the symmetric Wald interval for a weighted sample, where “k” is the array of weights in the survival sample and “N” in the main sample.

wald_weighted_unc(k, N[, cl])

Calculate the symmetric Wald uncertainty for a weighted sample, where “k” is the array of weights in the survival sample and “N” in the main sample.

weights_by_edges(values, edges, weights)

Assign a weight to the values in an input array using a set of edges.

wilson_int(k, N[, cl])

Calculate the Wilson interval of having “k” elements in “N”.

wilson_unc(k, N[, cl])

Calculate the Wilson uncertainties of having “k” elements in “N”.

Classes

AdBin(arr[, range, weights])

Represent a n-dimensional adaptive bin.

CLsHypo(pf)

Represent an hypothesis to be used in the CLs method.

CLsHypo_continuous(pdf)

Represent an hypothesis which works on a continuous domain.

CLsHypo_discrete(pmf)

Represent an hypothesis which works on a discrete domain.

CLsTS(alt, null)

Base class to represent the test-statistics function to work with the CLs method.

CLsTS_continuous(alt, null)

Base class to represent the test-statistics function to work with the CLs method using hypothesis working on a continuous domain.

CLsTS_discrete(alt, null)

Base class to represent the test-statistics function to work with the CLs method using hypothesis working on a discrete domain.

FlatDistTransform(points[, values, kind])

Build the class from a given set of values following a certain distribution (the use of weights is allowed), or x and y values of a PDF.

Class Inheritance Diagram

Inheritance diagram of hep_spt.adbin.AdBin, hep_spt.cls.CLsHypo, hep_spt.cls.CLsHypo_continuous, hep_spt.cls.CLsHypo_discrete, hep_spt.cls.CLsTS, hep_spt.cls.CLsTS_continuous, hep_spt.cls.CLsTS_discrete, hep_spt.stats.core.FlatDistTransform