pyrevs.sampler.sampler

Top-level sampler object.

Classes

RareEventSampler

The top-level interface for rare event sampling.

Functions

parse_cl_args(→ argparse.Namespace)

Parse provided list or default CL argv.

load_config(→ pyrevs.core.Config)

Load a TOML file into a Config object.

build_system_config(...)

Build the fully resolved SystemConfig.

build_database(→ pyrevs.database.Database)

Build the database.

build_sampler(→ RareEventSampler)

Instantiate the top-level sampler.

Module Contents

parse_cl_args(a_args: list[str] | None = None) argparse.Namespace[source]

Parse provided list or default CL argv.

Parameters:

a_args – optional list of options

load_config(path: pathlib.Path) pyrevs.core.Config[source]

Load a TOML file into a Config object.

Parameters:

path – Path to TOML file

Returns:

Config instance wrapping the TOML data

Raises:

FileNotFoundError – if file does not exist

build_system_config(cfg: pyrevs.core.Config) pyrevs.sampler.system_config.SystemConfig[source]

Build the fully resolved SystemConfig.

This applies: - defaults - nested dataclass construction - strategy selection logic

Parameters:

cfg – Raw Config object

Returns:

Fully instantiated SystemConfig

build_database(fmodel_t: Any, cfg: pyrevs.core.Config, sys_cfg: pyrevs.sampler.system_config.SystemConfig, overwrite: bool) pyrevs.database.Database[source]

Build the database.

build_sampler(fmodel_t: Any, a_args: list[str] | None = None) RareEventSampler[source]

Instantiate the top-level sampler.

Parameters:
  • fmodel_t – Forward model type

  • a_args – optional list of options

Returns:

Ready-to-run RareEventSampler

class RareEventSampler(fmodel_t: Any, runtime_cfg: pyrevs.core.RuntimeConfig, strategy: pyrevs.strategies.base.BaseSamplingStrategy, database: pyrevs.database.Database)[source]

The top-level interface for rare event sampling.

This class provides a user-facing entry point to perform rare event sampling using a specified BaseSamplingStrategy. It is responsible for:

  • Parsing configuration from a TOML input file

  • Initializing logging

  • Instanciating the proper sampling strategy

  • Managing global runtime parameters (e.g., walltime)

  • Setting up the database

  • Running the sampling strategy

Variables:
  • _config (Config) – Configuration parameters parsed from the input file

  • _strategy (BaseSamplingStrategy) – The sampling strategy

The configuration file is also passed to the logging and strategy setup routine.

run() None[source]

Execute the rare event sampling procedure.

This method starts the sampling process by delegating execution to the configured BaseSamplingStrategy.

Notes

This method is typically the main entry point after initialization. At this point, it does not return a value; results are expected to be stored in the database or written to disk by the strategy. Future extensions will allow to perform several runs (possibly in parallel)

property database: pyrevs.database.Database[source]

Access the sampling database.