Projection
gwmock_signal.projection
¶
Projection of GW polarizations onto detector networks.
ProjectionEffects
dataclass
¶
The physical effects projection includes. All are on by default; each can be turned off alone.
Compact binaries, bursts and continuous waves are projected by the same code, so a given set of
effects means the same thing for each. :meth:long_wavelength turns them all off: a point detector at
its vertex, a geocentre at rest and a J2000 direction, the convention of Bilby's and PyCBC's default
projection.
Attributes:
| Name | Type | Description |
|---|---|---|
earth_rotation |
bool
|
The antenna pattern and the geocentre-to-detector delay follow the Earth's rotation sample by sample. Off, both are held at the midpoint of the span, which suits only a signal of seconds. |
finite_arm_length |
bool
|
Each arm responds to the strain averaged along the light's round trip to its
end mirror and back rather than to the strain at the vertex; see
:mod: |
source_precession |
bool
|
The source direction is rotated from J2000 into the mean equator and equinox of date before the Earth's orientation is applied, as LALPulsar's barycentring does. Off, a J2000 direction is used with sidereal time of date, as LAL, Bilby and PyCBC do for transients; the two differ by up to 1.8e-4 s of geocentre-to-detector delay and about 0.4 degrees of right ascension in 2030. |
roemer_delay |
bool
|
The travel time between the geocentre and the solar-system barycentre, from the
Earth's orbit; see :mod: |
einstein_delay |
bool
|
The relativistic time dilation of the Earth's clock, TDB minus TT. |
shapiro_delay |
bool
|
The Sun's gravitational delay. |
For a transient the three solar-system delays enter only through how they change across the signal: their value and rate at the signal's reference time (a compact binary's coalescence, a burst's peak) are absorbed, so that time keeps its meaning at the geocentre and the detector-frame masses theirs. For a continuous wave, whose parameters are defined at the barycentre, they enter in full.
Source code in src/gwmock_signal/projection/effects.py
21 22 23 24 25 26 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 | |
solar_system
property
¶
Whether any of the three solar-system delays is included.
long_wavelength(*, earth_rotation=False)
classmethod
¶
Return every effect off: a point detector at its vertex, a geocentre at rest, J2000 directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
earth_rotation
|
bool
|
Keep the Earth's rotation on, for a signal long enough to need it. |
False
|
Source code in src/gwmock_signal/projection/effects.py
60 61 62 63 64 65 66 67 68 69 | |
SolarSystemEphemeris
dataclass
¶
The Earth and Sun tables the solar-system delay is computed from.
Attributes:
| Name | Type | Description |
|---|---|---|
earth |
str
|
Path or standard name of the Earth table. |
sun |
str
|
Path or standard name of the Sun table. |
Source code in src/gwmock_signal/projection/solar_system.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
tables()
¶
Return the two tables, reading (and if need be downloading) each once per process.
Source code in src/gwmock_signal/projection/solar_system.py
353 354 355 | |
project_polarizations_to_network(polarizations, detector_names, *, right_ascension, declination, polarization_angle, effects=None, reference_time=None, ephemeris=None, backend='numpy', sinc_taps=DEFAULT_SINC_TAPS, kaiser_beta=DEFAULT_KAISER_BETA, tapered=False, earth_rotation=None, precess_source_direction=None, finite_arm_length=None, output_grid=None)
¶
Project tensor plus/cross strains onto detectors using detector geometry.
Built-in and custom detector codes are resolved through the LAL cached
detector registry. For earth_rotation=False, the constant
geocenter->detector delay is applied via an exact frequency-domain phase
shift (h(t-tau) <-> H(f)*exp(-2*pi*i*f*tau)), which is lossless at all
frequencies. For earth_rotation=True, the polarizations are resampled at the
time-dependent delayed times with the Kaiser-windowed sinc kernel in
:mod:gwmock_signal.projection.resampling, gathered from a zero-padded copy so kernel
taps reaching past either end read zero rather than repeating the endpoint.
Each detector series is longer than the input, and starts earlier. Delaying the signal
by the geocentre-to-detector light-travel time -- up to Earth's radius over the speed of
light, about 21 ms -- moves part of it past the end, or before the start, of the
polarization buffer. The polarizations are therefore zero-padded by
:func:~gwmock_signal.projection.resampling.edge_padding samples at each end before they
are projected, and every returned series covers that padded span: it starts that many
samples before the input and has twice that many more samples, on the input's own sample
lattice -- or, with output_grid, the same span on that lattice, starting up to one sample
earlier. The padding is sized for the largest delay any ground-based detector can have, plus
the resampling kernel's half-width, so it is the same for every detector, sky position and
backend: all returned series share one start time and length. Inside the input's span the
samples are what a same-length projection gives, up to rounding; outside it they hold the
delayed signal that a same-length projection would have dropped (earth_rotation=True) or
wrapped round to the other end of the buffer (earth_rotation=False). A caller that needs
the input's span exactly can crop to it, at the cost of that content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polarizations
|
Mapping[str, TimeSeries | TimeSeries]
|
Mapping containing |
required |
detector_names
|
Sequence[DetectorSpec]
|
Sequence of IFO codes (e.g. |
required |
right_ascension
|
float
|
Source right ascension in radians. |
required |
declination
|
float
|
Source declination in radians. |
required |
polarization_angle
|
float
|
Polarization angle psi in radians (tensor modes). |
required |
effects
|
ProjectionEffects | None
|
Which physical effects to include; see
:class: |
None
|
reference_time
|
float | None
|
GPS time at which a transient's solar-system delay is absorbed: its value and
rate there are taken out, so that time keeps its meaning at the geocentre. The coalescence
time of a compact binary, the peak time of a burst. |
None
|
ephemeris
|
SolarSystemEphemeris | None
|
The Earth and Sun tables for the solar-system delays; the LALPulsar DE405 tables by default, downloaded and cached on first use. |
None
|
backend
|
str
|
Which implementation evaluates the |
'numpy'
|
sinc_taps
|
int
|
Taps in the band-limited resampling kernel used by the
|
DEFAULT_SINC_TAPS
|
kaiser_beta
|
float
|
Kaiser window shape parameter for that kernel. |
DEFAULT_KAISER_BETA
|
tapered
|
bool
|
Whether the polarizations are a whole signal that falls smoothly to zero at both
ends, such as a generated compact-binary waveform. If so, the |
False
|
earth_rotation
|
bool | None
|
Deprecated; |
None
|
precess_source_direction
|
bool | None
|
Deprecated; |
None
|
finite_arm_length
|
bool | None
|
Deprecated; |
None
|
output_grid
|
SamplingGrid | None
|
A lattice to put the returned series on, at the inputs' sample rate, such as
the segment the strain will be added to. Each series then starts at the lattice sample
preceding the padded input's start, up to one sample earlier, and its samples are the
detector strain at those lattice times: the sub-sample offset joins the delay in the one
resampling the projection makes. Adding the result to a series on the same lattice is
then an integer-offset add. Placing a series that is off the lattice needs a second
resampling instead, of strain that need not be band-limited at its ends, and
resampling a finished buffer cannot reproduce what the band-limited interpolant of the
polarizations puts past them. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, TimeSeries]
|
Mapping from each detector name to the projected strain as a |
dict[str, TimeSeries]
|
class: |
dict[str, TimeSeries]
|
sample lattice, or on |
dict[str, TimeSeries]
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If keys are missing, time grids disagree, a detector name is not
recognized, |
Source code in src/gwmock_signal/projection/network.py
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
validate_projection_backend(value, *, parameter='backend')
¶
Return value if it names a projection implementation, else raise.
Shared so the name is checked identically wherever it is accepted -- this function, and the simulators that take it at construction time and only reach the projection later. Checking it in each place separately is how one of them ends up accepting a name the projection does not.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The candidate backend name. |
required |
parameter
|
str
|
What to call it in the error message, since callers spell the argument
differently ( |
'backend'
|
Returns:
| Type | Description |
|---|---|
str
|
value unchanged. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If value is not one of :data: |
Source code in src/gwmock_signal/projection/network.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
gwmock_signal.projection.solar_system
¶
The delay between the geocentre and the solar-system barycentre, for every source.
A wave reaches the geocentre at a different time than it reaches the solar-system barycentre (SSB), by
an amount that changes as the Earth moves. Written as the SSB time of a wavefront that passes the
geocentre at t, t_SSB = t + D(t), the delay D has three parts, each switchable through
:class:~gwmock_signal.projection.effects.ProjectionEffects:
- Roemer:
n . r(t) / c, the geocentre's positionrrelative to the SSB along the directionnto the source (J2000). Up to 500 s, changing by up to 1e-4 s per second. - Einstein: TDB minus TT, the relativistic time dilation of a clock on Earth, 1.7 ms over a year.
- Shapiro: the Sun's gravitational delay,
-2 G M / c^3 ln(1 + cos)in effect, enteringDwith a minus sign; up to ~1e-4 s for a source near the Sun.
This is LALPulsar's XLALBarycenterEarth and XLALBarycenter in their TIMECORRECTION_ORIGINAL
time system, without the site term, which projection adds from the detector geometry, and agrees with
lalpulsar.Barycenter at the geocentre to 1e-13 s: the Earth's position from the JPL DE405 tables
LALPulsar ships (second-order Taylor expansion about the nearest entry, 7200 s apart, which misses the
Earth's jerk by up to 5e-8 s between entries, as LALPulsar does), the
Einstein delay from the 40 largest terms of TEMPO's series, and the Shapiro delay including a ray that
passes through the Sun. The arithmetic follows the JAX port of those functions in ripplegw
(ripplegw.waveforms.cw.earth and barycenter, MIT licence), which the continuous-wave
simulator used before this module existed.
The tables are read from earth00-40-DE405.dat.gz and sun00-40-DE405.dat.gz by default, which
cover GPS 630720013 to 1893024018 (2000 to 2040). A file not found locally is downloaded once from the
LALSuite repository and cached; on a machine without network access, place the files in the cache
(:func:cache_directory) or pass their paths.
DelayModel
dataclass
¶
The delay over a span of geocentre times, ready to evaluate at every sample on the host or device.
The Roemer and Shapiro parts are evaluated exactly as LALPulsar evaluates them, by Taylor expansion
about the nearest table entry, from the few entries the span needs; the Einstein part, a smooth
series whose fastest term has a 30-day period, from cubic-Hermite interpolation of its value and rate
on a grid :data:EINSTEIN_GRID_SECONDS apart. Interpolating the Roemer part instead would smooth over
the steps LALPulsar's expansion takes between entries, up to 5e-8 s, and disagree with it by that.
Times are passed relative to :attr:epoch, so a device in any precision never handles the GPS epoch.
Attributes:
| Name | Type | Description |
|---|---|---|
epoch |
float
|
GPS time the times passed to :meth: |
source |
ndarray
|
Unit vector towards the source, J2000. |
components |
tuple[bool, bool, bool]
|
|
earth |
tuple[float, float, ndarray, ndarray, ndarray]
|
Earth-table entries covering the span: |
sun |
tuple[float, float, ndarray, ndarray, ndarray]
|
The same for the Sun. |
einstein_grid |
tuple[float, float, ndarray, ndarray]
|
|
Source code in src/gwmock_signal/projection/solar_system.py
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 | |
arrays()
¶
Return the model as a flat tuple of arrays, for :func:evaluate_arrays on a device.
Source code in src/gwmock_signal/projection/solar_system.py
523 524 525 526 527 528 529 | |
build(start, end, right_ascension, declination, ephemeris, *, roemer=True, einstein=True, shapiro=True)
classmethod
¶
Return the model for geocentre GPS times in [start, end], measured from start.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the span reaches outside the tables. |
Source code in src/gwmock_signal/projection/solar_system.py
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 | |
evaluate(since_epoch, *, xp=np)
¶
Return the delay D at geocentre times since_epoch seconds after :attr:epoch.
Source code in src/gwmock_signal/projection/solar_system.py
531 532 533 | |
EphemerisTable
dataclass
¶
One body's tabulated position, velocity and acceleration relative to the SSB.
Attributes:
| Name | Type | Description |
|---|---|---|
gps0 |
float
|
GPS time of the first entry, seconds. |
spacing |
float
|
Seconds between entries. |
position |
ndarray
|
Light-seconds, shape |
velocity |
ndarray
|
In units of |
acceleration |
ndarray
|
Per second, shape |
source |
str
|
Where the table was read from. |
Source code in src/gwmock_signal/projection/solar_system.py
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 | |
gps_end
property
¶
GPS time of the last entry.
state(gps)
¶
Return position and velocity at gps, Taylor-expanded about the nearest entry as LALPulsar does.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a time lies outside the table, where LALPulsar refuses too. |
Source code in src/gwmock_signal/projection/solar_system.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
SolarSystemEphemeris
dataclass
¶
The Earth and Sun tables the solar-system delay is computed from.
Attributes:
| Name | Type | Description |
|---|---|---|
earth |
str
|
Path or standard name of the Earth table. |
sun |
str
|
Path or standard name of the Sun table. |
Source code in src/gwmock_signal/projection/solar_system.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
tables()
¶
Return the two tables, reading (and if need be downloading) each once per process.
Source code in src/gwmock_signal/projection/solar_system.py
353 354 355 | |
cache_directory()
¶
Return where downloaded tables are kept.
$GWMOCK_SIGNAL_CACHE_DIR/ephemeris if that variable is set; otherwise
$XDG_CACHE_HOME/gwmock-signal/ephemeris (~/.cache when unset), or
~/Library/Caches/gwmock-signal/ephemeris on macOS.
Source code in src/gwmock_signal/projection/solar_system.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
delay(gps, right_ascension, declination, ephemeris, *, roemer=True, einstein=True, shapiro=True)
¶
Return the delay D with t_SSB = t + D at geocentre times gps, and its rate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gps
|
ndarray
|
GPS times at the geocentre. |
required |
right_ascension
|
float
|
J2000 right ascension of the source, radians. |
required |
declination
|
float
|
J2000 declination, radians. |
required |
ephemeris
|
SolarSystemEphemeris
|
The Earth and Sun tables. |
required |
roemer
|
bool
|
Include the Roemer delay. |
True
|
einstein
|
bool
|
Include the Einstein delay. |
True
|
shapiro
|
bool
|
Include the Shapiro delay, which enters with a minus sign. |
True
|
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
|
Source code in src/gwmock_signal/projection/solar_system.py
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 | |
evaluate_arrays(arrays, components, since_epoch, *, xp)
¶
Return the delay of :meth:DelayModel.arrays at since_epoch, in the namespace xp.
components is (roemer, einstein, shapiro); on a device it is static, the arrays traced.
Source code in src/gwmock_signal/projection/solar_system.py
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
read_table(name_or_path)
cached
¶
Read a LALPulsar ephemeris table, once per process.
The file holds a header gps0 spacing count, then count rows of gps x y z vx vy vz ax ay az.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
See :func: |
ValueError
|
If a table looked up by a recorded name is not the recorded one (see
:func: |
Source code in src/gwmock_signal/projection/solar_system.py
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 | |
resolve_table(name_or_path)
¶
Return a local path for a table, downloading a standard one into the cache if it is not there.
A bare standard name, such as earth00-40-DE405.dat.gz, is looked up in the working directory, then
in :func:cache_directory, and downloaded there from :data:LALSUITE_EPHEMERIS_URL if absent; nothing
else is downloaded. Wherever it is found, a table looked up by a name with a recorded SHA-256
(:data:RECORDED_SHA256, the two default tables compressed or not) must have that content. A path
with a directory, such as tables/earth00-40-DE405.dat.gz or "./earth00-40-DE405.dat.gz" given
as a string, is the caller's own table and is used as it is. (:class:~pathlib.Path drops a leading
./, so give that form as a string.)
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist and is not a standard name, the cache cannot be written, or the download failed. |
ValueError
|
If a table looked up by a recorded name does not have the recorded content. |
Source code in src/gwmock_signal/projection/solar_system.py
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 | |
source_direction(right_ascension, declination)
¶
Return the unit vector towards a source at J2000 right ascension and declination.
Source code in src/gwmock_signal/projection/solar_system.py
390 391 392 393 394 395 396 397 398 | |
For usage examples, see the User guide — Detector projection examples.