_rock module¶
Rock definition for pyrockfall¶
This module defines the Rock class, representing a rock type or group
to be thrown in rockfall simulations. Each Rock encapsulates material
properties as probability distributions (or deterministic constants) to support
uncertainty quantification during sampling.
Main Features¶
Material properties as distributions: -
massanddensitycan be deterministic or random (SciPy frozen RVsor custom distributions).
Consistent sampling API: -
Rock.ppf()for inverse-CDF sampling from quantiles. -Rock.rvs()for random variate draws.
Notes
Use stats.asDistribution() to convert numeric inputs into deterministic
distributions and to accept frozen SciPy distributions seamlessly.
- class pyrockfall._rock.Rock(name: str = '', mass: Distribution | SupportsToDistribution | Real | np.floating | np.integer | float | int = 0.0, density: Distribution | SupportsToDistribution | Real | np.floating | np.integer | float | int = 0.0, color: Tuple[int, int, int] | None = None)[source]¶
Bases:
objectRepresents a rock type or group in a rockfall simulation.
Each instance stores the probabilistic description of material properties, currently mass and density. Properties may be deterministic (e.g.,
Deterministic) or random (e.g., SciPyrv_frozenor customTruncatedRandomVariable).- Parameters:
name (str, optional) – Name of the rock group. If not provided, names are auto-generated as
"Group <i>".
- mass¶
stats.Distribution object for mass.
- density¶
stats.Distribution object for density.
- property mass: Distribution¶
stats.Distribution for mass (deterministic or random).
- property density: Distribution¶
stats.Distribution for density (deterministic or random).
- property numRandomVariables: int¶
mass and density).
- Type:
- Type:
Number of random variables (currently 2
- ppf(q: ndarray) List[ndarray][source]¶
Evaluate the percent-point function (inverse CDF).
- Parameters:
q (np.ndarray) – Quantiles for each random variable, shape
(2, N). -q[0, :]: quantiles for mass -q[1, :]: quantiles for density- Returns:
[mass_samples, density_samples], each of shape(N,).- Return type:
list[np.ndarray]