Skip to content

Registry

Top-level waveform registry.

A single, family-agnostic entry point for constructing waveforms by name. Each Waveform subclass registers itself with register. Users then construct any model through waveform without importing the implementing module:

import ripplegw
wf = ripplegw.waveform("IMRPhenomXAS", f_ref=20.0)
ripplegw.list_waveforms(domain="FD")

Adding a family means adding a self-registering module — never editing this file.

Functions:

Name Description
get_waveform_metadata

Return a copy of the descriptive metadata for a registered waveform.

list_waveforms

List registered waveform names, optionally filtered by metadata.

register

Class decorator that adds a Waveform subclass to the registry.

waveform

Construct a registered waveform by name.

Attributes:

Name Type Description
WAVEFORM_REGISTRY dict[str, type[Waveform]]

Global name -> Waveform subclass registry, populated at import by

WAVEFORM_REGISTRY: dict[str, type[Waveform]] = {} module-attribute ¤

Global name -> Waveform subclass registry, populated at import by register.

get_waveform_metadata(name: str) -> dict[str, Any] ¤

Return a copy of the descriptive metadata for a registered waveform.

Parameters:

Name Type Description Default
name str

A registered model name.

required

Returns:

Type Description
dict[str, Any]

The model's metadata, e.g. {"domain": "FD", ...}.

Raises:

Type Description
ValueError

If name is not registered.

list_waveforms(**filters) -> list[str] ¤

List registered waveform names, optionally filtered by metadata.

Parameters:

Name Type Description Default
**filters

Constraints on waveform_metadata, e.g. domain="FD" or is_precessing=True. A model matches only if its metadata defines every requested key with the requested value. Unknown/typo'd keys simply match nothing; use get_waveform_metadata to inspect available keys.

{}

Returns:

Type Description
list[str]

Sorted matching names.

register(name: Optional[str] = None, *, override: bool = False, **metadata) ¤

Class decorator that adds a Waveform subclass to the registry.

Keyword arguments are stored on the class as waveform_metadata; that is what list_waveforms filters on.

Parameters:

Name Type Description Default
name Optional[str]

Registry key users pass to waveform(). Defaults to the class name.

None
override bool

Allow replacing a name that is already registered.

False
**metadata

Descriptive tags, e.g. is_tidal=True.

{}

Returns:

Type Description

The decorator, which returns the class unchanged.

Raises:

Type Description
ValueError

If name is already registered and override is False.

TypeError

If the decorated class is not a Waveform subclass.

waveform(name: str, /, **config) -> Waveform ¤

Construct a registered waveform by name.

Parameters:

Name Type Description Default
name str

A registered model name (see list_waveforms).

required
**config

Constructor configuration forwarded to the model (e.g. f_ref=20.0 for CBC models).

{}

Returns:

Type Description
Waveform

A configured instance, callable as wf(axis, params).

Raises:

Type Description
ValueError

If name is not registered.