Models class¶
Overview¶
┌───────────────────────────────────────────────┐
│ import aubellhop as bh │
├───────────────────────────────────────────────┤
│ bh.Models │
│ • Registry of BellhopSimulator instances │
│ │
│ bh.Models.new(name="...") │
│ → create new model │
│ │
│ bh.Models.supported() │
│ → list all models │
└───────────────────────────────────────────────┘
Models class¶
The ‘Model Registry’ for aubellhop to allow multiple BellhopSimulators to be run.
This model defines the class and then initialises it. As this is a utility class, the initialised class operates as a global container of methods and the _models register of BellhopSimulator models.
See file bellhop.py for the class definition of BellhopSimulator.
- class aubellhop.models.Models(*args: Any, **kwargs: Any)[source]¶
Registry for BellhopSimulator models.
This is a Utility Class which consists of only class methods and a global registry of defined models.
- classmethod new(name: str, **kwargs: Any) BellhopSimulator[source]¶
Instantiate a new Bellhop model and add it to the registry.
- Parameters:
name (str) – The (unique) name of the BellhopSimulator model
kwargs (Any) – Arguments to pass onto the BellhopSimulator constructor
- Returns:
The defined model which was just added to the registry.
- Return type:
BellhopSimulator
- classmethod supported(env: Environment | None = None, task: str | None = None, dim: int | None = None) list[str][source]¶
List available models by name, maybe narrowed by env, task, and/or dimension.
- classmethod get(name: str) BellhopSimulator[source]¶
Get a model by name.
- Parameters:
name (str) – The name of the BellhopSimulator model
- Returns:
The first model in the registry which matches the specified name.
- Return type:
BellhopSimulator
- classmethod select(env: Environment, task: str, model: str | None = None, debug: bool = False) BellhopSimulator[source]¶
Finds a model to use, or if a model is requested validate it.
- Parameters:
env (dict) – The environment dictionary
task (str) – The task to be computed
model (str, optional) – Specified model to use
debug (bool, default=False) – Whether to print diagnostics
- Returns:
The first model in the list which satisfies the input parameters.
- Return type:
BellhopSimulator