gwkokab.models.wrappers¶
Registry mapping parameter names to the models that produce them.
ModelRegistry is a small decorator-based lookup: a model registers itself
against the parameter name (or tuple of names) it is a distribution over, and calling
the registry with that name builds the model. This lets a family’s --add-* CLI flags
select models by parameter name without a hard-coded dispatch table.
Classes¶
Decorator class to register models and their parameters. |
Module Contents¶
- class gwkokab.models.wrappers.ModelRegistry¶
Bases:
objectDecorator class to register models and their parameters.
A model is registered against the parameter name, or tuple of names, it is a distribution over; calling the registry with that key constructs the model.
Examples
registry = ModelRegistry() @registry.register("redshift") def redshift_model(parameter): ... model = registry("redshift")
- register(parameter, model=None)¶
Register a model with the parameter(s) it yields.
Usable directly or as a decorator: omitting
modelreturns a decorator that registers the function it is applied to.- Parameters:
- Returns:
The registered model, or a decorator when
modelisNone.- Return type:
Callable
- Raises:
ValueError – If
parameteris neither a string nor a tuple of strings.