_distribution module

class pyrockfall.stats._distribution.DistributionID(*values)[source]

Bases: IntEnum

Enum for supported probability distribution types.

NOTDEFINED = 0
NONE = 1
NORMAL = 2
UNIFORM = 3
TRIANGULAR = 4
BETA = 5
EXPONENTIAL = 6
LOGNORMAL = 7
GAMMA = 8
class pyrockfall.stats._distribution.DistributionParameters(id: int | DistributionID, loc: float, scale: float, min_raw: float, max_raw: float, relative: bool)[source]

Bases: object

static relative(id: int | DistributionID, loc: float, scale: float, rel_min: float, rel_max: float) → DistributionParameters[source]

min/max are interpreted as OFFSETS relative to loc.

static absolute(id: int | DistributionID, loc: float, scale: float, abs_min: float, abs_max: float) → DistributionParameters[source]

min/max are interpreted as absolute values.

property id: int
property loc: float
property mean: float
property scale: float
property std: float
property is_relative: bool
property abs_min: float
property abs_max: float
property rel_min: float
property rel_max: float
property a: float
property b: float
toTxt(relative=True)[source]
pyrockfall.stats._distribution.registerDistribution(id_: DistributionID)[source]

Decorator to register concrete distributions.

class pyrockfall.stats._distribution.Distribution[source]

Bases: ABC

Abstract base class for random variables.

Defines the API for all random variable classes in pyrockfall.

DistID: DistributionID = 0
abstractmethod rvs(size: int = 1, random_state: int | Generator | None = None) → ndarray[source]

Random variates

abstractmethod pdf(x) → ndarray[source]

Probability density function

abstractmethod cdf(x) → ndarray[source]

Cumulative distribution function

sf(x) → ndarray[source]

Survival function (1 - CDF)

abstractmethod ppf(q) → ndarray[source]

Percent point function (inverse of cdf)

isf(q) → ndarray[source]

Inverse survival function (inverse of sf)

abstractmethod expect(func: Callable, lb: float = -inf, ub: float = inf) → float[source]

Expected value of a function of the random variable over [lb, ub]

abstractmethod median() → float[source]

Median of the distribution

abstractmethod mean() → float[source]

Mean of the distribution

abstractmethod var() → float[source]

Variance of the distribution

std() → float[source]

Standard deviation of the distribution

abstractmethod interval(confidence: float = 1.0) → Tuple[float, float][source]

Confidence interval having equal areas around the median

abstractmethod native_params() → dict[str, float][source]

Constructor-ready, family-specific parameters (e.g., {‘mu’:…, ‘sigma’:…}).

abstractmethod generic_params() → DistributionParameters[source]

Family-agnostic summary: loc, scale, rel_min, rel_max