obs_factory
Factory class for generating observables
- class MDMC.trajectory_analysis.observables.obs_factory.ObservableFactory[source]
Provides a factory for creating an
Observable. Any module within the observables submodule can be created with a string of the class name, as long as it is a subclass ofObservable.- classmethod create_observable(name: str) Observable[source]
Creates an
Observableobject from a module nameThe
Observableobject must be registered with theObservableFactory- Parameters:
name (str) – The name of the module with which the
Observableis registered- Returns:
An
Observableobject- Return type:
- classmethod get_observable(name: str) Type[Observable][source]
Gets an
Observableclass from a registry name- Parameters:
name (str) – The name of the module with which the
Observableis registered- Returns:
A subclass of
Observable- Return type:
cls
- classmethod register(names: str | Iterable) Callable[source]
A class level decorator for registering Observable classes
The names of the modules with which the Observable is registered should be the parameter passed to the decorator.
- Parameters:
names (str) – The names of the modules with which the Observable is registered
Example
To register the
SQwclass withObservableFactory:@ObservableFactory.register('SQw') class SQw(Observable):