API Reference



Abstract class for Matrix and Vector.


Allows for delayed method calls

Ensemble([raw, bg, bg_ratio, path])

Generates perturbated matrices to estimate uncertainty

EnsembleNormalizer(*, extractor[, …])

Normalizes NLD nad γSF extracted from the ensemble

Extractor([ensemble, trapezoid, path])

Extracts nld and γSF from an Ensemble or a Matrix


First generation method from Guttormsen et al. (NIM 1987).

Matrix([values, Eg, Ex, std, path, shape, state])

Stores 2d array with energy axes (a matrix).

Model(name[, _Model__isfrozen])

Dataclass for Model

NormalizationParameters(name[, …])

Storage for normalization parameters + some convenience functions

NormalizerGSF(*[, normalizer_nld, nld, …])

Normalize γSF to a given` <Γγ> (Gg)

NormalizerNLD(*[, nld, discrete, path, …])

Normalizes NLD to empirical data

NormalizerSimultan(*[, gsf, nld, …])

Simultaneous normalization of nld and gsf.


Interpolates response read from file for current setup

ResultsNormalized(name[, _Model__isfrozen, …])

Class to store the results of the Oslo Method

SpinFunctions(Ex, J, model, pars)

Calculates spin distributions, spin cuts (…)

Unfolder([num_iter, response])

Performs Guttormsen unfolding

Vector([values, E, path, std, units])

Stores 1d array with energy axes (a vector)

ZerosMatrix([shape, Ex, Eg, std, state])

Return new Matrix of given shape, filled with zeros.


div0(a, b)

division function designed to ignore / 0, i.e. div0([-1, 0, 1], 0 ) -> [0, 0, 0].


Load example raw data.

fill_negative_gauss(array, Eg, window_size)

Fill negative channels with positive counts from weighted neighbor chnls.

fill_negative_max(array, window_size)

Fill negative channels with positive counts from neighboring channels.


Function which smooths an array of counts by a Gaussian of full-width-half-maximum FWHM. Preserves number of counts. :param array_in: Array of inbound counts to be smoothed :type array_in: array, double :param E_array: Array with energy calibration of array_in, in mid-bin calibration :type E_array: array, number :param fwhm: The full-width-half-maximums. Need to be same size as array_in :type fwhm: array, double :param truncate: The window width of the Gaussian that is used to smoothe, in units of sigma. Defaults to 3. :type truncate: double, optional.

gauss_smoothing_matrix_1D(matrix_in, …[, …])

Smooth a matrix with a Gaussian


Returns a normalized Gaussian supported on Emids.


Finds the index of the closest element in the array


List examples

load_levels_discrete(path, energy)

Load discrete levels without smoothing

load_levels_smooth(path, energy[, resolution])

Load discrete levels with smoothing

nld_T_product(double[, double[, double[, …)

Computes first generation matrix from nld and gSF


Normalize each row to unity

rebin_1D(ndarray counts, ndarray mids_in, …)

Rebin an array of counts from binning mids_in to binning mids_out

rebin_2D(ndarray counts, ndarray mids_in, …)

Rebin a matrix of counts from binning mids_in to binning mids_out


Maps axis to 0, 1 or 2 according to which axis is specified



More beautiful way of excluding imported classes/variables.