Waveform
gwmock_signal.waveform
¶
Waveform generation and backend abstractions.
LALSimulationBackend
¶
Bases: WaveformBackend
Time-domain waveform backend implemented with LALSimulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ref
|
float | None
|
Reference frequency in Hz. Defaults to |
None
|
ringdown_fraction
|
float
|
Fraction of the analysis segment reserved after
coalescence. Must be in |
DEFAULT_RINGDOWN_FRACTION
|
segment_duration
|
float | None
|
Optional fixed analysis-segment length in seconds. When
|
None
|
Source code in src/gwmock_signal/waveform/backends/lal.py
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
__init__(*, f_ref=None, ringdown_fraction=conditioning.DEFAULT_RINGDOWN_FRACTION, segment_duration=None)
¶
Validate the placement configuration shared with the ripple backend.
Source code in src/gwmock_signal/waveform/backends/lal.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
available_approximants()
¶
Return every LAL approximant this backend can generate.
generate_td_waveform produces FD-native approximants via
SimInspiralChooseFDWaveform and time-domain approximants via
SimInspiralFD, so the advertised set is the union of both. Iterating
over approximant indices yields each name once, in a stable order.
Source code in src/gwmock_signal/waveform/backends/lal.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
¶
Generate plus/cross polarizations, conditioned from frequency to time domain.
Source code in src/gwmock_signal/waveform/backends/lal.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
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 73 74 | |
__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 73 74 | |
RippleBackend
¶
Bases: WaveformBackend
Time-domain waveform backend implemented with ripple (JAX).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f_ref
|
float | None
|
Reference frequency in Hz. Defaults to |
None
|
ringdown_fraction
|
float
|
Fraction of the analysis segment reserved after
coalescence. Must be in |
_DEFAULT_RINGDOWN_FRACTION
|
segment_duration
|
float | None
|
Optional fixed analysis-segment length in seconds. When
|
None
|
Source code in src/gwmock_signal/waveform/backends/ripple.py
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | |
segment_duration
property
¶
The fixed analysis-segment length in seconds, or None if auto-sized.
__init__(*, f_ref=None, ringdown_fraction=_DEFAULT_RINGDOWN_FRACTION, segment_duration=None)
¶
Require ripple/JAX only when this backend is instantiated.
Source code in src/gwmock_signal/waveform/backends/ripple.py
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 | |
available_approximants()
¶
Return the ripple approximants supported by this backend.
Source code in src/gwmock_signal/waveform/backends/ripple.py
145 146 147 | |
coalescence_placement(n_samples, sampling_frequency)
¶
Return (merger_index, epoch) for placing coalescence in a segment.
merger_index is the sample at which coalescence sits after the
time-domain roll (near the segment end, leaving a small ringdown pad), and
epoch is the time of the first sample relative to coalescence (negative),
so a caller places coalescence at epoch + tc. Shared by the time-domain
backend and the batched device path so both use the same convention.
Source code in src/gwmock_signal/waveform/backends/ripple.py
508 509 510 511 512 513 514 515 516 517 518 | |
generate_fd_polarizations(approximant, *, sampling_frequency, minimum_frequency, **params)
¶
Generate ripple's frequency-domain plus/cross polarizations (on-device).
This is the building block the on-device (GPU) projection path consumes: the
polarizations stay as JAX arrays and are not conditioned to the time domain.
generate_td_waveform calls this and then inverse-FFTs the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
A supported ripple approximant name. |
required |
sampling_frequency
|
float
|
Sample rate in Hz; sets the Nyquist frequency. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz; bins below it are zeroed. |
required |
**params
|
object
|
CBC source parameters (gwmock-pop canonical names or aliases). |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
FrequencyDomainPolarizations
|
class: |
Source code in src/gwmock_signal/waveform/backends/ripple.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
generate_fd_polarizations_batch(approximant, *, sampling_frequency, minimum_frequency, parameters)
¶
Generate ripple FD polarizations for a batch of events on one shared grid.
Evaluates ripple under jax.vmap over the catalogue, so all events share a
single frequency grid. Because vmap needs a fixed shape, the grid is sized
(worst case) for the longest inspiral in the batch — the smallest chirp mass,
via the same post-Newtonian estimate as the per-event path — unless a fixed
segment_duration was set on the backend. This is the on-device entry point
for catalogue-scale (GPU) generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
approximant
|
str
|
A supported ripple approximant name. |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz; bins below it are zeroed. |
required |
parameters
|
Mapping[str, object]
|
Mapping of canonical gwmock-pop parameter names (no aliases)
to 1-D arrays of equal length |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
FrequencyDomainPolarizations
|
class: |
FrequencyDomainPolarizations
|
|
Source code in src/gwmock_signal/waveform/backends/ripple.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
generate_td_waveform(approximant, tc, sampling_frequency, minimum_frequency, **params)
¶
Generate plus/cross polarizations from ripple, conditioned to time domain.
Source code in src/gwmock_signal/waveform/backends/ripple.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
segment_duration_for(chirp_mass_solar, minimum_frequency, sampling_frequency)
¶
Worst-case segment duration (seconds) the batch path uses for this chirp mass.
Source code in src/gwmock_signal/waveform/backends/ripple.py
166 167 168 169 170 | |
with_segment_duration(segment_duration)
¶
Return a copy of this backend pinned to a fixed segment_duration.
Same f_ref and ringdown_fraction; useful for forcing one shared grid
across several batched calls (e.g. count-chunked catalogue generation).
Source code in src/gwmock_signal/waveform/backends/ripple.py
154 155 156 157 158 159 160 161 162 163 164 | |
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.