Waveform
gwmock_signal.waveform
¶
Waveform generation and backend abstractions.
LALSimulationBackend
¶
Bases: WaveformBackend
Time-domain waveform backend implemented with LALSimulation.
Source code in src/gwmock_signal/waveform/backends/lal.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
available_approximants()
¶
Return all implemented LAL time-domain approximants.
Source code in src/gwmock_signal/waveform/backends/lal.py
31 32 33 34 35 36 37 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
¶
Generate plus/cross polarizations with SimInspiralChooseTDWaveform.
Source code in src/gwmock_signal/waveform/backends/lal.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
PyCBCBackend
¶
Bases: WaveformBackend
Time-domain waveform backend implemented with PyCBC.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
__init__()
¶
Require PyCBC only when this backend is instantiated.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
30 31 32 33 34 35 | |
available_approximants()
¶
Return all PyCBC time-domain approximants.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
37 38 39 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
¶
Generate plus/cross polarizations through pycbc_waveform_wrapper.
Source code in src/gwmock_signal/waveform/backends/pycbc.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
WaveformBackend
¶
Bases: ABC
Abstract interface for time-domain waveform generators.
Source code in src/gwmock_signal/waveform/backends/base.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
available_approximants()
abstractmethod
¶
Return supported time-domain approximant names.
Source code in src/gwmock_signal/waveform/backends/base.py
47 48 49 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
abstractmethod
¶
Generate plus and cross GWpy time series.
Source code in src/gwmock_signal/waveform/backends/base.py
51 52 53 54 55 56 57 58 59 60 | |
WaveformFactory
¶
Registry and dispatcher for time-domain waveform generators.
On construction, every name returned by the configured backend is registered
and mapped to that backend's generate_td_waveform implementation.
You may register additional names pointing at custom callables. See package docs for examples.
Source code in src/gwmock_signal/waveform/factory.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
__init__(backend=None)
¶
Build the registry of built-in backend approximants.
Note
Enumerating approximants can be slow; reuse one factory instance in tight loops instead of creating many factories.
Source code in src/gwmock_signal/waveform/factory.py
38 39 40 41 42 43 44 45 46 47 48 | |
generate(waveform_model, parameters, **extra_params)
¶
Generate polarizations by calling the registered model with merged parameters.
The callable is invoked with waveform_model, then entries from parameters,
then extra_params (later keys override earlier ones).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform_model
|
str
|
Name of the registered model to run. |
required |
parameters
|
dict[str, Any]
|
Injection parameters (e.g. |
required |
**extra_params
|
Any
|
Additional fixed settings (e.g. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, TimeSeries]
|
Dict whose keys are the strings |
dict[str, TimeSeries]
|
GWpy |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If the underlying generator is called with invalid arguments. |
Source code in src/gwmock_signal/waveform/factory.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
get_model(name)
¶
Look up the generator function registered for name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Registered model name (built-in approximant or custom). |
required |
Returns:
| Type | Description |
|---|---|
Callable[..., dict[str, TimeSeries]]
|
The callable registered for this name. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/gwmock_signal/waveform/factory.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
list_models()
¶
Return every registered waveform model name, in dict iteration order.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of keys (backend approximants plus any custom registrations). |
Source code in src/gwmock_signal/waveform/factory.py
128 129 130 131 132 133 134 | |
register_model(name, factory_func)
¶
Register or overwrite a waveform model under name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Key used with |
required |
factory_func
|
Callable[..., Any] | str
|
Callable that accepts merged waveform kwargs (including
|
required |
Raises:
| Type | Description |
|---|---|
ImportError
|
If a string path does not refer to an importable module. |
AttributeError
|
If the imported module has no such callable attribute. |
ValueError
|
If factory_func string is neither 'module.path:callable' nor 'package.module.callable'. |
TypeError
|
Registered model is not callable. |
Source code in src/gwmock_signal/waveform/factory.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
__getattr__(name)
¶
Resolve optional waveform helpers lazily.
Source code in src/gwmock_signal/waveform/__init__.py
24 25 26 27 28 29 30 | |
For usage examples, see the User guide — Waveform examples.