kaira.modulations.ModulationRegistry

Inheritance diagram for ModulationRegistry
- class kaira.modulations.ModulationRegistry[source]
Bases:
objectA registry for modulations in Kaira.
This class provides a centralized registry for all modulators and demodulators, making it easier to instantiate them by name with appropriate parameters.
Methods
Create a modulation instance by name.
Create a demodulator instance by name.
Create a modulator instance by name.
Get a modulation class by name.
Get a demodulator class by name.
Get a modulator class by name.
List all available demodulators in the registry.
List all available modulations in the registry.
List all available modulators in the registry.
Register a modulation class in the registry.
Decorator to register a demodulator class in the registry.
Decorator to register a modulator class in the registry.
- classmethod register(name: str, modulation_class: Type[BaseModulator] | Type[BaseDemodulator], mode: Literal['modulator', 'demodulator']) None[source]
Register a modulation class in the registry.
- Parameters:
name (str) – The name to register the modulation under.
modulation_class (Union[Type[BaseModulator], Type[BaseDemodulator]]) – The modulation class to register.
mode (Literal["modulator", "demodulator"]) – Whether the class is a modulator or demodulator.
- classmethod register_modulator(name: str | None = None) Callable[source]
Decorator to register a modulator class in the registry.
- Parameters:
name (Optional[str], optional) – The name to register the modulator under. If None, the class name will be used (converted to lowercase).
- Returns:
A decorator function that registers the modulator class.
- Return type:
callable
- classmethod register_demodulator(name: str | None = None) Callable[source]
Decorator to register a demodulator class in the registry.
- Parameters:
name (Optional[str], optional) – The name to register the demodulator under. If None, the class name will be used (converted to lowercase).
- Returns:
A decorator function that registers the demodulator class.
- Return type:
callable
- classmethod get_modulator(name: str) Type[BaseModulator][source]
Get a modulator class by name.
- Parameters:
name (str) – The name of the modulator to get.
- Returns:
The modulator class.
- Return type:
Type[BaseModulator]
- Raises:
KeyError – If the modulator is not registered.
- classmethod get_demodulator(name: str) Type[BaseDemodulator][source]
Get a demodulator class by name.
- Parameters:
name (str) – The name of the demodulator to get.
- Returns:
The demodulator class.
- Return type:
Type[BaseDemodulator]
- Raises:
KeyError – If the demodulator is not registered.
- classmethod get(name: str, mode: Literal['modulator', 'demodulator'] = 'modulator') Type[BaseModulator] | Type[BaseDemodulator][source]
Get a modulation class by name.
- Parameters:
name (str) – The name of the modulation to get.
mode (Literal["modulator", "demodulator"]) – Whether to get a modulator or demodulator.
- Returns:
The modulation class.
- Return type:
Union[Type[BaseModulator], Type[BaseDemodulator]]
- Raises:
KeyError – If the modulation is not registered.
- classmethod create_modulator(name: str, **kwargs) BaseModulator[source]
Create a modulator instance by name.
- Parameters:
name (str) – The name of the modulator to create.
**kwargs – Additional arguments to pass to the modulator constructor.
- Returns:
The instantiated modulator.
- Return type:
- classmethod create_demodulator(name: str, **kwargs) BaseDemodulator[source]
Create a demodulator instance by name.
- Parameters:
name (str) – The name of the demodulator to create.
**kwargs – Additional arguments to pass to the demodulator constructor.
- Returns:
The instantiated demodulator.
- Return type:
- classmethod create(name: str, mode: Literal['modulator', 'demodulator'] = 'modulator', **kwargs) BaseModulator | BaseDemodulator[source]
Create a modulation instance by name.
- Parameters:
name (str) – The name of the modulation to create.
mode (Literal["modulator", "demodulator"]) – Whether to create a modulator or demodulator.
**kwargs – Additional arguments to pass to the modulation constructor.
- Returns:
The instantiated modulation.
- Return type:
Union[BaseModulator, BaseDemodulator]
- classmethod list_modulators() list[source]
List all available modulators in the registry.
- Returns:
A list of modulator names.
- Return type:
- classmethod list_demodulators() list[source]
List all available demodulators in the registry.
- Returns:
A list of demodulator names.
- Return type:
- classmethod list_modulations() dict[source]
List all available modulations in the registry.
- Returns:
A dictionary containing modulator and demodulator names.
- Return type:
- __init__()