validate_distribution#
- abtem.distributions.validate_distribution(distribution)[source]#
- Parameters:
distribution (BaseDistribution or Iterable or Number) – The input distribution to be validated.
- Returns:
The validated distribution. If the input distribution is already a valid distribution, it is returned as is. If the input distribution is a single number, it is returned unchanged. If the input distribution is an ndarray with shape (0,), its single element is returned. If the input distribution is a tuple, list, or ndarray, it is converted to an ndarray and wrapped into a DistributionFromValues object where each value has equal weight. Otherwise, a ValueError is raised.
- Return type:
BaseDistribution or Number
- Raises:
ValueError – If the input distribution is not a valid distribution or .