Burst
gwmock_signal.burst
¶
Unmodelled gravitational-wave bursts: ad hoc families, file waveforms and test injection sets.
BurstSimulator
¶
Bases: TransientSimulator
Burst injections: the ad hoc LVK families and numerical waveforms read from file.
Each event names its morphology in burst_model, so one simulator serves a mixed injection
set. The event keys follow the per-event record of established burst injection pipelines --
peak time, distance, sky position, polarization angle, inclination, model -- under this
package's canonical names:
======================== ====================================================================
burst_model "sine_gaussian", "gaussian", "white_noise_burst", or a
name given in waveform_files
peak_time GPS time of the waveform's centre at the geocentre, s
coa_time optional placement time for segmented output, s; see below
right_ascension rad
declination rad
polarization_angle rad
hrss ad hoc families: sqrt(int (h_+^2 + h_x^2) dt) at the Earth
distance file waveforms: source distance, Mpc
inclination rad; ad hoc families that take it, and file waveforms whose
inclination_dependence is not "none"
======================== ====================================================================
plus the family's own shape parameters, listed on each function in
:mod:gwmock_signal.burst.waveforms. Keys a model does not use are ignored, so an event may
carry labels such as which injection set it belongs to.
A file waveform is scaled by its reference_distance / distance and by the inclination
factors of its :class:WaveformFile.
Two times, two meanings. peak_time is the burst's physical reference, and it alone
positions the waveform. coa_time is the key a caller writing segmented data places every
transient by; it carries no physics for a burst and never moves or changes the waveform.
:meth:pre_coalescence_duration and :meth:post_coalescence_duration measure from it -- from
peak_time when it is absent -- so coa_time - pre and coa_time + post are where the
output starts and ends. coa_time = peak_time is the simple choice; the start of the
polarization buffer, or any other instant inside the output, is equally valid and gives the
same strain. A coa_time that is not a finite number, or that lies outside the output -- before
its first sample or after its end, padding included -- cannot place the event, and is refused
with the same ValueError by the two queries, :meth:generate_polarizations and
:meth:simulate, so a caller that ignores a failed query still cannot inject a cropped burst.
Projecting on the device. With projection_backend="jax" the projection compiles a kernel
per length of series, and a burst injection set comes in thousands of lengths (6,947 among one
stream's 53,248 bursts at 8192 Hz). Each burst is therefore projected at a fixed length -- its
polarizations padded with zeros to the next length of a ladder with two per octave, and the result
cut back -- so that stream compiles 16 kernels per pair of arm lengths in the network, and reuses each; see
:func:~gwmock_signal.projection.network.device_length. The strain is bit-identical to an unpadded
projection with the finite arms off, and differs by rounding with them on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform_files
|
Mapping[str, WaveformFile] | None
|
Model name -> :class: |
None
|
ephemeris
|
SolarSystemEphemeris | None
|
The Earth and Sun tables for the solar-system delays; the LALPulsar DE405 tables by default. |
None
|
projection_backend
|
str
|
Which implementation evaluates the |
'numpy'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a file model reuses an ad hoc family's name, a value is not a
:class: |
Source code in src/gwmock_signal/burst/simulator.py
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 | |
burst_models
property
¶
Return every burst_model this instance can generate.
required_params
property
¶
Return the keys every burst event must carry.
__init__(*, waveform_files=None, ephemeris=None, projection_backend='numpy')
¶
Initialise with the optional numerical waveform files, the solar-system tables and the projection backend.
Source code in src/gwmock_signal/burst/simulator.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
generate_polarizations(params, sampling_frequency, minimum_frequency)
¶
Return (h_plus, h_cross) for one burst event, centred on its peak_time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Mapping[str, Any]
|
One burst event; see the class docstring. |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Unused. A burst's band is set by its own parameters, and cutting it here would change the hrss the event records. |
required |
Returns:
| Type | Description |
|---|---|
tuple[TimeSeries, TimeSeries]
|
Tuple of |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/gwmock_signal/burst/simulator.py
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 | |
polarizations_tapered(params, sampling_frequency)
¶
Whether the polarizations generated for params at sampling_frequency fall smoothly to zero at both ends.
If so, the projection and the injection oversample them exactly and place them accurately up to
Nyquist. False unless a subclass knows better; see
:meth:~gwmock_signal.waveform.backends.base.WaveformBackend.tapers_polarizations.
Source code in src/gwmock_signal/simulator.py
211 212 213 214 215 216 217 218 | |
post_coalescence_duration(params, sampling_frequency, minimum_frequency)
¶
Return how long after the placement time this simulator's output runs, in seconds.
The complement of :meth:pre_coalescence_duration, measured the same way from the same
buffer and remembered with it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Mapping[str, Any]
|
One burst event, as :meth: |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Unused; accepted so the call matches the compact-binary simulator's. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Seconds from the placement time to one sample past the last sample :meth: |
float
|
returns, including the projection's padding after the polarizations; never negative. |
Raises:
| Type | Description |
|---|---|
ValueError
|
As :meth: |
Source code in src/gwmock_signal/burst/simulator.py
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 | |
pre_coalescence_duration(params, sampling_frequency, minimum_frequency)
¶
Return how long before the placement time this simulator's output starts, in seconds.
The burst counterpart of :meth:CBCSimulator.pre_coalescence_duration
<gwmock_signal.simulator.CBCSimulator.pre_coalescence_duration>, with the same call, so a
caller placing transients into segmented data can ask either simulator alike. For a burst
"coalescence" is the placement time: coa_time when the event gives one, else
peak_time. A burst's buffer is centred on its peak, so a peak just past a segment
boundary has content belonging to the segment before -- up to 5.6 s of it for a
Q = 100 sine-Gaussian at 30 Hz -- and the caller needs this answer to claim it there.
Measured, not modelled. The answer is read off the polarization buffer
:meth:generate_polarizations returns for this very event and sample rate, so it is exact
by construction for every family, including the numerical ones, and cannot drift from the
generator: no copy of LALSimulation's buffer-sizing rules is kept here. The cost is one
generation of the polarizations -- no projection -- per distinct event. At 8192 Hz that was
measured at about 7 ms for a draft white-noise burst, 2.8 ms for the longest buffer (a
91,265-sample Q = 100 sine-Gaussian at 30 Hz) and under 0.3 ms for every other draft
family, small beside the projection :meth:simulate then pays. The extent is remembered
for the last few events, so the start and end queries and repeats for the same event share
one generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Mapping[str, Any]
|
One burst event, as :meth: |
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Unused, as in :meth: |
required |
Returns:
| Type | Description |
|---|---|
float
|
Seconds from the first sample :meth: |
float
|
including the padding the projection adds before the polarizations (see |
float
|
func: |
float
|
buffer is always known, and never negative. |
Raises:
| Type | Description |
|---|---|
ValueError
|
As :meth: |
Source code in src/gwmock_signal/burst/simulator.py
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 | |
register_waveform_model(name, factory)
¶
Register a one-shot waveform generator under name for this instance.
Re-registering the same name with an equal factory is a no-op. Reusing
the name for a different factory raises ValueError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Waveform model name used later as |
required |
factory
|
RegisteredWaveformFactory
|
Callable returning either |
required |
Source code in src/gwmock_signal/simulator.py
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 | |
simulate(params, detector_names, background=None, *, sampling_frequency, minimum_frequency, effects=None, interpolate_if_offset=True, earth_rotation=None, finite_arm_length=None, output_grid=None)
¶
Run the full injection pipeline and return a DetectorStrainStack.
Calls _validate_params and generate_polarizations, projects the polarizations
onto the network and injects them into the background, as
project_polarizations_to_network and inject_strain do, then assembles the
result into a DetectorStrainStack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Mapping[str, Any]
|
Source parameters; must contain all |
required |
detector_names
|
Sequence[str | CustomDetector]
|
IFO codes (e.g. |
required |
background
|
Mapping[str, TimeSeries | TimeSeries] | None
|
Optional mapping of detector name to background
|
None
|
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
minimum_frequency
|
float
|
Low-frequency cutoff in Hz. |
required |
effects
|
ProjectionEffects | None
|
Which physical effects the projection includes; see
:class: |
None
|
interpolate_if_offset
|
bool
|
If |
True
|
earth_rotation
|
bool | None
|
Deprecated; |
None
|
finite_arm_length
|
bool | None
|
Deprecated; |
None
|
output_grid
|
SamplingGrid | None
|
A lattice for the projected strain, such as the segment it will be added to;
see :func: |
None
|
Returns:
| Type | Description |
|---|---|
DetectorStrainStack
|
|
DetectorStrainStack
|
detector in |
Note
Which implementation projects is read from :attr:projection_backend, not taken
here: it is a property of how the simulator was set up, and the two implementations
agree to ~1e-10 of peak, so it is not a per-call decision about the answer.
Source code in src/gwmock_signal/simulator.py
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 | |
timing_reference(params)
¶
Return peak_time, the burst's physical reference, where its solar-system delay is absorbed.
Source code in src/gwmock_signal/burst/simulator.py
329 330 331 | |
WaveformFile
dataclass
¶
A numerical burst waveform on disk and how to place it.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str | Path
|
Text file of |
reference_distance |
float
|
Distance, in Mpc, at which the file's strains are given. |
inclination_dependence |
InclinationDependence
|
How the strain varies with the event's
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/gwmock_signal/burst/simulator.py
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 | |
__post_init__()
¶
Refuse a distance or an inclination dependence the simulator could not apply.
Source code in src/gwmock_signal/burst/simulator.py
224 225 226 227 228 229 230 231 232 | |
draw_burst_injection_set(*, start_time, end_time, interval, hrss_range, rng, families=DRAFT_BURST_FAMILIES, sine_gaussian_frequency_range=(30.0, 1800.0))
¶
Return one burst event every interval seconds in [start_time, end_time).
Events sit at start_time + (k + 1/2) * interval, so none straddles either end. Each event
takes a family chosen uniformly from families, then draws whatever the family does not fix:
- sky position isotropic, polarization angle uniform in
[0, pi); hrsslog-uniform in hrss_range;inclinationuniform incos(iota)for sine-Gaussians and white-noise bursts;frequencylog-uniform in sine_gaussian_frequency_range for sine-Gaussians;seedfor white-noise bursts, so each event's noise realisation is reproducible.
Nothing is drawn for a family whose burst_model names a numerical waveform file, so such a
family must fix its own distance (and inclination, when its file's response depends on
it); a family without a distance is refused here rather than when the event is simulated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_time
|
float
|
GPS start of the span, s. |
required |
end_time
|
float
|
GPS end of the span, s. |
required |
interval
|
float
|
Seconds between consecutive events; the fixed test-set rate is |
required |
hrss_range
|
tuple[float, float]
|
|
required |
rng
|
Generator
|
Source of randomness; pass a seeded generator for a reproducible set. |
required |
families
|
Sequence[Mapping[str, Any]]
|
Family templates, each a mapping with |
DRAFT_BURST_FAMILIES
|
sine_gaussian_frequency_range
|
tuple[float, float]
|
|
(30.0, 1800.0)
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
One event mapping per injection, in time order, each ready for |
list[dict[str, Any]]
|
meth: |
list[dict[str, Any]]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the span or interval is not positive, a range is not positive, or
families is empty, has an entry without |
Source code in src/gwmock_signal/burst/injection_set.py
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 | |
gwmock_signal.burst.waveforms
¶
Burst polarizations: the ad hoc families and numerical waveforms read from file.
The ad hoc families -- sine-Gaussian, Gaussian and band-limited white-noise burst -- are generated by LALSimulation's own burst routines, the ones the LIGO-Virgo-KAGRA burst injections use, so this module encodes no second opinion about their shapes. It adds three things LALSimulation leaves to its caller:
- Placement. LALSimulation centres every burst on
t = 0; it is moved topeak_time. - Inclination. The sine-Gaussian and white-noise generators take a polarisation-ellipse
eccentricity. A source with inclination
iotahash_x / h_+ = 2 cos(iota) / (1 + cos^2 iota), which is eccentricitye = sin^2(iota) / (1 + cos^2 iota); the sign ofcos(iota)(the handedness, whichecannot carry) is applied to the cross polarization. - Discrete hrss. Every family is scaled so that its samples carry the requested
hrss = sqrt(sum (h_+^2 + h_x^2) dt). For a well-sampled sine-Gaussian or Gaussian this changes nothing measurable (about 1e-16); it corrects a pulse the samples do not resolve (a 0.1 ms Gaussian at 8192 Hz by 1.3e-3) and the white-noise burst, which LALSimulation normalises byint hdot^2 dt.
Every parameter is checked against its documented domain -- finite, positive where it must be, below the Nyquist frequency, a white-noise burst not more compact than its time-bandwidth limit -- before LAL is resolved, so an invalid argument is reported the same way whether or not lalsuite is installed. Limits that belong to LALSimulation's numerics rather than to a parameter's meaning, such as the range of the GPS epoch it places a very long burst at, are left to LALSimulation to report.
gaussian(params, sampling_frequency)
¶
Return a linearly polarized Gaussian pulse centred on peak_time.
The cross polarization is identically zero, as in LALSimulation and the LVK injection sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Mapping[str, Any]
|
|
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
Returns:
| Type | Description |
|---|---|
tuple[TimeSeries, TimeSeries]
|
|
Source code in src/gwmock_signal/burst/waveforms.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
read_waveform_file(path)
¶
Read a numerical burst waveform: three whitespace-separated columns t h_+ h_x.
t is in seconds relative to the waveform's reference instant (placed at peak_time), and
must be uniformly sampled; the strains are at the file's reference_distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Text file to read. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the file does not have three columns, has fewer than two rows, holds a non-finite value, or is not uniformly sampled in increasing time. |
Source code in src/gwmock_signal/burst/waveforms.py
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 | |
sine_gaussian(params, sampling_frequency)
¶
Return an elliptically polarized sine-Gaussian centred on peak_time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Mapping[str, Any]
|
|
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
Returns:
| Type | Description |
|---|---|
tuple[TimeSeries, TimeSeries]
|
|
Source code in src/gwmock_signal/burst/waveforms.py
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 | |
white_noise_burst(params, sampling_frequency)
¶
Return a band- and time-limited white-noise burst centred on peak_time.
The band is set by its lower edge and width. LALSimulation
shapes both the band and the time envelope smoothly rather than with hard edges, so the content
is concentrated in, not confined to, [low_frequency, low_frequency + bandwidth].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Mapping[str, Any]
|
|
required |
sampling_frequency
|
float
|
Sample rate in Hz. |
required |
Returns:
| Type | Description |
|---|---|
tuple[TimeSeries, TimeSeries]
|
|
Source code in src/gwmock_signal/burst/waveforms.py
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 | |
BurstSimulator is a TransientSimulator: each burst is
generated, projected onto the network and injected like any other transient. It
is registered under the source_type "burst".
For the injection specification and usage examples, see the User guide — Burst injections.