DistributionFromValues#

class abtem.distributions.DistributionFromValues(values, weights=None, ensemble_mean=False)[source]#

Bases: BaseDistribution

Distribution defined by user-defined values and weights.

Parameters:
  • values (np.ndarray) – The values of the distribution.

  • weights (np.ndarray, optional) – The values of the weights. If None, all weights are set to 1.

  • ensemble_mean (bool, optional) – If True, the mean of an ensemble of measurements defined by the distribution is calculated, otherwise the full ensemble is kept.

__init__(values, weights=None, ensemble_mean=False)[source]#

Methods

__init__(values[, weights, ensemble_mean])

combine(other)

Combine distribution with another distribution to produce a higher-dimensional distribution.

copy()

Make a copy.

divide([chunks, lazy])

Divide the distribution into chunks.

Attributes

dimensions

The number of dimensions in the distribution.

ensemble_mean

Calculate the mean of the ensemble.

shape

The shape of the distribution parameters.

values

Scalar values representing the distribution.

weights

Weight of each of distribution value.

combine(other)[source]#

Combine distribution with another distribution to produce a higher-dimensional distribution.

Parameters:

other (DistributionFromValues) – The distribution to combine this distribution with.

Returns:

combined_distribution – Higher-dimensional combined distribution.

Return type:

MultidimensionalDistribution

copy()#

Make a copy.

Return type:

Self

property dimensions: int#

The number of dimensions in the distribution.

divide(chunks=1, lazy=True)[source]#

Divide the distribution into chunks.

Return type:

Union[ndarray, Array]

property ensemble_mean: bool#

Calculate the mean of the ensemble.

property shape: tuple[int]#

The shape of the distribution parameters.

property values: ndarray#

Scalar values representing the distribution.

property weights: ndarray#

Weight of each of distribution value.