_analysis module

Analysis module for pyrockfall

This module defines the Analysis class — an orchestration layer that coordinates sampling, physics kernels, and interaction with the slope/geometry backend in a vectorised manner for both 2D and 3D simulations.

Design Philosophy

  • Classes (e.g., Seeder, Rock, Material, SlopeModel) are used for configuration.

  • Before simulation, all classes are sampled into NumPy arrays (and a sampled slope batch), after which the Analysis methods operate as pure, argument-in / value-out kernels to preserve vectorisation and enable easy testing/parallelism.

  • Intersection queries are delegated to the sampled slope object (e.g., SlopeBatch), which provides batched, broadcastable kernels.

Contents

  • Analysis: Public API comprising validation, sampling, frame transforms, impact and sliding mechanics, free-fall integration, metrics, and high-level preprocessing/processing/postprocessing orchestration.

Notes

This file contains signatures and docstrings only (no implementations) to clarify the public API and expected array shapes. Implementations should be vectorised and side-effect free (no mutation of self), except where a method explicitly writes into an external container (e.g., Trajectories).

class pyrockfall._analysis.Sampling(*values)[source]

Bases: Enum

Enumeration of stochastic sampling methods.

LatinHypercube

Use Latin Hypercube Sampling.

MonteCarlo

Use simple Monte Carlo sampling.

LatinHypercube = 1
MonteCarlo = 2
class pyrockfall._analysis.AnalysisRocksThrown(*values)[source]

Bases: Enum

Enumeration of rock-throwing strategies in simulation.

DistributedFromNumberOfRocks

Rocks distributed globally among all seeders.

IndividuallyPerSeeder

Each seeder throws its specified number of rocks.

DistributedFromNumberOfRocks = 1
IndividuallyPerSeeder = 2
class pyrockfall._analysis.SampleMaps(rockSamples: 'Dict[Rock, List[int]]', seederSamples: 'Dict[Seeder, List[int]]', numSamples: 'int')[source]

Bases: object

rockSamples: Dict[Rock, List[int]]
seederSamples: Dict[Seeder, List[int]]
numSamples: int
class pyrockfall._analysis.Analysis(copy: Analysis | None = None)[source]

Bases: object

Refactored Analysis class that avoids adding new instance attributes at runtime. - All configuration stays on self. - Every method receives exactly the arrays/values it needs and returns outputs explicitly. - The main loop threads the necessary arrays between steps.

seeders: List[Seeder]
property slope: Slope
property hasVegetation: bool
property vegetation: Vegetation
property maps: SampleMaps
preprocess()[source]
process(*state_tuple)[source]
postprocess(rock_params: ndarray) → None[source]
run() → None[source]