sxs 2024.0.9__py3-none-any.whl → 2024.0.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sxs/__version__.py +1 -1
- sxs/handlers.py +3 -169
- sxs/simulations/simulation.py +211 -9
- sxs/waveforms/format_handlers/lvc.py +8 -7
- sxs/waveforms/format_handlers/nrar.py +10 -0
- {sxs-2024.0.9.dist-info → sxs-2024.0.10.dist-info}/METADATA +1 -1
- {sxs-2024.0.9.dist-info → sxs-2024.0.10.dist-info}/RECORD +9 -9
- {sxs-2024.0.9.dist-info → sxs-2024.0.10.dist-info}/WHEEL +0 -0
- {sxs-2024.0.9.dist-info → sxs-2024.0.10.dist-info}/licenses/LICENSE +0 -0
sxs/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2024.0.
|
|
1
|
+
__version__ = "2024.0.10"
|
sxs/handlers.py
CHANGED
|
@@ -398,175 +398,9 @@ def load_lvc(
|
|
|
398
398
|
):
|
|
399
399
|
r"""Load an SXS waveform in LVC convention.
|
|
400
400
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
defined at a reference time `t_ref` or reference frequency
|
|
405
|
-
`f_ref`.
|
|
406
|
-
|
|
407
|
-
Parameters
|
|
408
|
-
==========
|
|
409
|
-
sxs_id : str
|
|
410
|
-
The SXS ID of the simulation to use — e.g., "SXS:BBH:1234".
|
|
411
|
-
t_ref : float, optional
|
|
412
|
-
The reference time at which the waveform frame is specified.
|
|
413
|
-
This is measured in units of M, and defined relative to the
|
|
414
|
-
epoch time (see below). Either `t_ref` or `f_ref` must be
|
|
415
|
-
specified. If `t_ref` is given, it is used to compute
|
|
416
|
-
`f_ref`.
|
|
417
|
-
f_ref : float, optional
|
|
418
|
-
The reference frequency, in units of cycles/M, at which the
|
|
419
|
-
waveform frame is specified. Either `t_ref` or `f_ref` must
|
|
420
|
-
be specified. If `f_ref` is given, it is used to compute
|
|
421
|
-
`t_ref`.
|
|
422
|
-
dt : float, optional
|
|
423
|
-
The time step, in units of M, to which to interpolate the
|
|
424
|
-
waveform.
|
|
425
|
-
f_low : float, optional
|
|
426
|
-
The lower frequency bound, in units of cycles/M, for the
|
|
427
|
-
waveform.
|
|
428
|
-
ell_max : int, optional
|
|
429
|
-
The maximum ell to include in the waveform.
|
|
430
|
-
phi_ref : float, optional
|
|
431
|
-
The binary's phase in the coprecessing frame, measured at
|
|
432
|
-
`t_ref`. Should be between 0 and $2\pi$.
|
|
433
|
-
inclination : float, optional
|
|
434
|
-
Angle between the binary's angular momentum and the line of
|
|
435
|
-
sight of the observer, measured at `t_ref`. Should be between
|
|
436
|
-
0 and $\pi$.
|
|
437
|
-
ell_max_epoch : int, optional
|
|
438
|
-
The maximum ell to include in the epoch time calculation,
|
|
439
|
-
which sets t=0 at the maximum of the L^2 norm, calculated by
|
|
440
|
-
including all modes up to and including this ell value.
|
|
441
|
-
|
|
442
|
-
Returns
|
|
443
|
-
=======
|
|
444
|
-
times : float array
|
|
445
|
-
Uniformly spaced 1D array of times, in units of M, at which
|
|
446
|
-
the waveform and dynamics quantities are returned. Aligned
|
|
447
|
-
such that peak of waveform modes with ell=2 is at t=0.
|
|
448
|
-
hlm_dict : dict [optional]
|
|
449
|
-
Dictionary of waveform modes in the inertial frame that
|
|
450
|
-
coincides with the waveform-defined coprecessing frame at
|
|
451
|
-
`f_ref`. Each mode in the dictionary is a 1D array of
|
|
452
|
-
complex-valued floats with values corresponding to each time
|
|
453
|
-
node. Keys:[(ell,m)] for all ell<=ell_max and -ell<=m<=+ell.
|
|
454
|
-
This is returned only if the input values of `phi_ref` and
|
|
455
|
-
`inclination` are both None.
|
|
456
|
-
hp, hc : float arrays [optional]
|
|
457
|
-
1D-arrays of real-valued GW polarizations evaluated in the
|
|
458
|
-
frame of the observer at each time node. Polarizations are
|
|
459
|
-
computed using all modes up to ell=ell_max, with one value at
|
|
460
|
-
each time node. These are returned only if either of the
|
|
461
|
-
input values of `phi_ref` and `inclination` is not None.
|
|
462
|
-
dynamics_dict : dict
|
|
463
|
-
Dictionary of real-valued arrays of dynamics quantities:
|
|
464
|
-
* "t_ref": The reference time at which the waveform frame
|
|
465
|
-
is specified.
|
|
466
|
-
* "f_ref": The waveform's frequency at `t_ref`.
|
|
467
|
-
* "t_low": The earliest time in the waveform.
|
|
468
|
-
* "f_low": The waveform's frequency at `t_low`.
|
|
469
|
-
* "chi1_ref": Cartesian spin components for the more
|
|
470
|
-
massive object, evaluated at `t_ref` in the
|
|
471
|
-
waveform-defined inertial frame.
|
|
472
|
-
* "chi2_ref": Cartesian spin components for the less
|
|
473
|
-
massive object, evaluated at `t_ref` in the
|
|
474
|
-
waveform-defined inertial frame.
|
|
475
|
-
* "frame_quat": Quaternions describing the instantaneous
|
|
476
|
-
transformation from the inertial frame to the corotating
|
|
477
|
-
frame at each time node as described in arXiv:1905.09300
|
|
478
|
-
and using conventions in Appendix B of arXiv:1110.2965.
|
|
479
|
-
Array of shape (len(times),4) with four quaternion
|
|
480
|
-
components at each time node. The first element at each
|
|
481
|
-
time node is the scalar part.
|
|
482
|
-
* "frame_omega": Angular velocity vector of the corotating
|
|
483
|
-
frame at each time node. Array of shape (len(times),3)
|
|
484
|
-
with three components at each time node.
|
|
485
|
-
* "times_spins": The times, in units of M, at which `chi`
|
|
486
|
-
and `chi2` are returned. Note that these are coordinate
|
|
487
|
-
times deep within the dynamic region of the simulation,
|
|
488
|
-
and so cannot be precisely related to the times in the
|
|
489
|
-
asymptotic waveform.
|
|
490
|
-
* "chi1": Cartesian spin components for the more massive
|
|
491
|
-
object, evaluated in the waveform-defined inertial
|
|
492
|
-
frame. Array of shape (len(times_spins),3) which
|
|
493
|
-
contains the Cartesian spin components
|
|
494
|
-
\{chi_{1x},chi_{1y},chi_{1z}\} at each time node.
|
|
495
|
-
* "chi2": Cartesian spin components for the less massive
|
|
496
|
-
object, evaluated in the waveform-defined inertial
|
|
497
|
-
frame. Array of shape (len(times_spins),3) which
|
|
498
|
-
contains the Cartesian spin components
|
|
499
|
-
\{chi_{2x},chi_{2y},chi_{2z}\} at each time node.
|
|
500
|
-
* "times_remnant": The times, in units of M, at which
|
|
501
|
-
`chi_remnant` and `mass_remnant` are returned. Note
|
|
502
|
-
that these are coordinate times deep within the dynamic
|
|
503
|
-
region of the simulation, and so cannot be precisely
|
|
504
|
-
related to the times in the asymptotic waveform.
|
|
505
|
-
* "chi_remnant": Cartesian spin components for the remnant
|
|
506
|
-
black hole, evaluated in the waveform-defined inertial
|
|
507
|
-
frame. Array of shape (len(times_remnant),3) which
|
|
508
|
-
contains the Cartesian spin components
|
|
509
|
-
\{chi_{rx},chi_{ry},chi_{rz}\}.
|
|
510
|
-
* "mass_remnant": The Christodoulou mass of the remnant
|
|
511
|
-
black hole as a function of time. Array of shape
|
|
512
|
-
(len(times_remnant),).
|
|
513
|
-
|
|
514
|
-
See also
|
|
515
|
-
========
|
|
516
|
-
sxs.load : General-purpose function to load SXS data in native
|
|
517
|
-
format
|
|
518
|
-
sxs.waveforms.to_lvc_conventions : Inner function that does all
|
|
519
|
-
the work for this function
|
|
520
|
-
|
|
521
|
-
Conventions
|
|
522
|
-
===========
|
|
523
|
-
We assume geometric units for time (units of M) and frequency
|
|
524
|
-
(units of cycles/M), with total mass M equal to 1.
|
|
525
|
-
|
|
526
|
-
Epoch time is defined by the peak of the $L^2$ norm of the modes:
|
|
527
|
-
|
|
528
|
-
$$t_e = \argmax_t \sum_\ell \sum_m |h_{\ell,m}(t)|^2,$$
|
|
529
|
-
|
|
530
|
-
where the sum over $\ell$ ranges from 2 to `ell_max_epoch`. All
|
|
531
|
-
time axes are then adjusted so that $t_e = 0$.
|
|
532
|
-
|
|
533
|
-
Frequencies are measured from the waveform, rather than orbital
|
|
534
|
-
trajectories, in terms of the angular-velocity vector given by
|
|
535
|
-
equation (7) of arXiv:1302.2919. The frequency is defined as the
|
|
536
|
-
magnitude of this vector divided by $2\pi$.
|
|
537
|
-
|
|
538
|
-
Waveforms, spins, dynamics, times, inclination angle and GW
|
|
539
|
-
reference phase are all defined in the inertial frame that
|
|
540
|
-
coincides with the "waveform-defined frame" at the reference time.
|
|
541
|
-
This frame is chosen so that the $z$ axis is aligned with the
|
|
542
|
-
dominant principal axis of the matrix given by equation (2a) of
|
|
543
|
-
arXiv:1109.5224, except that the strain is used in place of
|
|
544
|
-
$\psi_4$. That axis is only determined up to a sign, so we choose
|
|
545
|
-
the positive $z$ axis to be more parallel than antiparallel to the
|
|
546
|
-
angular velocity. Rotation about the $z$ axis is chosen to
|
|
547
|
-
approximate the condition that the more massive black hole is
|
|
548
|
-
located on the positive $x$ axis at the reference time, but can be
|
|
549
|
-
written solely in terms of the waveform modes:
|
|
550
|
-
|
|
551
|
-
* $\Im{h_{2,2} + \bar{h}_{2,-2}} = 0$
|
|
552
|
-
* $\Re{h_{2,2} + \bar{h}_{2,-2}} < 0$
|
|
553
|
-
* $\Im{h_{2,1} + \bar{h}_{2,-1}} < 0$
|
|
554
|
-
|
|
555
|
-
The first two conditions are necessary for cases of symmetric
|
|
556
|
-
systems in which $h_{2,\pm 1}=0$; the last condition breaks the
|
|
557
|
-
degeneracy of the first two under rotation about the $z$ axis by
|
|
558
|
-
$\pi$. For configurations that are symmetric under that rotation,
|
|
559
|
-
$h_{2,1}$ will be zero, so this condition will be impossible to
|
|
560
|
-
apply, but the symmetry of the system will mean that there is no
|
|
561
|
-
difference in the result.
|
|
562
|
-
|
|
563
|
-
Quaternion conventions are described in Appendix B of
|
|
564
|
-
arXiv:1110.2965. In particular, we use the convention that
|
|
565
|
-
|
|
566
|
-
Q = q_0 + vec(q) = (q_0, q_1, q_2, q_3)
|
|
567
|
-
|
|
568
|
-
where q_0 is the scalar part.
|
|
569
|
-
|
|
401
|
+
This is a deprecated function that is a thin wrapper around the
|
|
402
|
+
method `sxs.WaveformModes.to_lvk`. It is recommended that you use
|
|
403
|
+
that method directly.
|
|
570
404
|
"""
|
|
571
405
|
lev = kwargs.pop("lev", "Lev") # If number is unspecified, load chooses highest
|
|
572
406
|
waveform_name = kwargs.pop("waveform_name", "Strain_N2.h5")
|
sxs/simulations/simulation.py
CHANGED
|
@@ -334,14 +334,22 @@ class SimulationBase:
|
|
|
334
334
|
from .. import load
|
|
335
335
|
sxs_id_path = Path(self.sxs_id)
|
|
336
336
|
horizons_path = self.horizons_path
|
|
337
|
-
|
|
337
|
+
if horizons_path in self.files:
|
|
338
|
+
horizons_location = self.files.get(horizons_path)["link"]
|
|
339
|
+
else:
|
|
340
|
+
# Some simulations used the SXS ID as a prefix in file paths
|
|
341
|
+
# within the Zenodo upload in version 1.x of the catalog.
|
|
342
|
+
if (extended_location := f"{self.sxs_id_stem}/{horizons_path}") in self.files:
|
|
343
|
+
horizons_location = self.files.get(extended_location)["link"]
|
|
344
|
+
else:
|
|
345
|
+
raise ValueError(
|
|
346
|
+
f"File '{horizons_path}' not found in simulation files for {self.location}"
|
|
347
|
+
)
|
|
338
348
|
horizons_truepath = Path(sxs_path_to_system_path(sxs_id_path / horizons_path))
|
|
339
349
|
return load(horizons_location, truepath=horizons_truepath)
|
|
340
350
|
|
|
341
351
|
@property
|
|
342
352
|
def horizons(self):
|
|
343
|
-
if self.horizons_path not in self.files:
|
|
344
|
-
raise ValueError(f"Horizons data is not available for simulation {self.sxs_id}")
|
|
345
353
|
if not hasattr(self, "_horizons"):
|
|
346
354
|
self._horizons = self.load_horizons()
|
|
347
355
|
return self._horizons
|
|
@@ -405,6 +413,181 @@ class SimulationBase:
|
|
|
405
413
|
raise AttributeError(f"Psi0 is not available for version {self.version} of the data")
|
|
406
414
|
Psi0 = psi0
|
|
407
415
|
|
|
416
|
+
def to_lvk(self, **kwargs):
|
|
417
|
+
r"""Convert an SXS simulation to LVK convention.
|
|
418
|
+
|
|
419
|
+
Returns an SXS waveform (modes or polarizations) and dynamics
|
|
420
|
+
(including angular velocities, frame quaternions, and spins) in
|
|
421
|
+
the inertial frame that coincides with the waveform-defined frame
|
|
422
|
+
defined at a reference time `t_ref` or reference frequency
|
|
423
|
+
`f_ref`.
|
|
424
|
+
|
|
425
|
+
Parameters
|
|
426
|
+
==========
|
|
427
|
+
t_ref : float, optional
|
|
428
|
+
The reference time at which the waveform frame is specified.
|
|
429
|
+
This is measured in units of M, and defined relative to the
|
|
430
|
+
epoch time (see below). Either `t_ref` or `f_ref` must be
|
|
431
|
+
specified. If `t_ref` is given, it is used to compute
|
|
432
|
+
`f_ref`.
|
|
433
|
+
f_ref : float, optional
|
|
434
|
+
The reference frequency, in units of cycles/M, at which the
|
|
435
|
+
waveform frame is specified. Either `t_ref` or `f_ref` must
|
|
436
|
+
be specified. If `f_ref` is given, it is used to compute
|
|
437
|
+
`t_ref`.
|
|
438
|
+
dt : float, optional
|
|
439
|
+
The time step, in units of M, to which to interpolate the
|
|
440
|
+
waveform.
|
|
441
|
+
f_low : float, optional
|
|
442
|
+
The lower frequency bound, in units of cycles/M, for the
|
|
443
|
+
waveform.
|
|
444
|
+
ell_max : int, optional
|
|
445
|
+
The maximum ell to include in the waveform.
|
|
446
|
+
phi_ref : float, optional
|
|
447
|
+
The binary's phase in the coprecessing frame, measured at
|
|
448
|
+
`t_ref`. Should be between 0 and $2\pi$.
|
|
449
|
+
inclination : float, optional
|
|
450
|
+
Angle between the binary's angular momentum and the line of
|
|
451
|
+
sight of the observer, measured at `t_ref`. Should be between
|
|
452
|
+
0 and $\pi$.
|
|
453
|
+
ell_max_epoch : int, optional
|
|
454
|
+
The maximum ell to include in the epoch time calculation,
|
|
455
|
+
which sets t=0 at the maximum of the L^2 norm, calculated by
|
|
456
|
+
including all modes up to and including this ell value.
|
|
457
|
+
|
|
458
|
+
Returns
|
|
459
|
+
=======
|
|
460
|
+
times : float array
|
|
461
|
+
Uniformly spaced 1D array of times, in units of M, at which
|
|
462
|
+
the waveform and dynamics quantities are returned. Aligned
|
|
463
|
+
such that peak of waveform modes with ell=2 is at t=0.
|
|
464
|
+
hlm_dict : dict [optional]
|
|
465
|
+
Dictionary of waveform modes in the inertial frame that
|
|
466
|
+
coincides with the waveform-defined coprecessing frame at
|
|
467
|
+
`f_ref`. Each mode in the dictionary is a 1D array of
|
|
468
|
+
complex-valued floats with values corresponding to each time
|
|
469
|
+
node. Keys:[(ell,m)] for all ell<=ell_max and -ell<=m<=+ell.
|
|
470
|
+
This is returned only if the input values of `phi_ref` and
|
|
471
|
+
`inclination` are both None.
|
|
472
|
+
hp, hc : float arrays [optional]
|
|
473
|
+
1D-arrays of real-valued GW polarizations evaluated in the
|
|
474
|
+
frame of the observer at each time node. Polarizations are
|
|
475
|
+
computed using all modes up to ell=ell_max, with one value at
|
|
476
|
+
each time node. These are returned only if either of the
|
|
477
|
+
input values of `phi_ref` and `inclination` is not None.
|
|
478
|
+
dynamics_dict : dict
|
|
479
|
+
Dictionary of real-valued arrays of dynamics quantities:
|
|
480
|
+
* "t_ref": The reference time at which the waveform frame
|
|
481
|
+
is specified.
|
|
482
|
+
* "f_ref": The waveform's frequency at `t_ref`.
|
|
483
|
+
* "t_low": The earliest time in the waveform.
|
|
484
|
+
* "f_low": The waveform's frequency at `t_low`.
|
|
485
|
+
* "chi1_ref": Cartesian spin components for the more
|
|
486
|
+
massive object, evaluated at `t_ref` in the
|
|
487
|
+
waveform-defined inertial frame.
|
|
488
|
+
* "chi2_ref": Cartesian spin components for the less
|
|
489
|
+
massive object, evaluated at `t_ref` in the
|
|
490
|
+
waveform-defined inertial frame.
|
|
491
|
+
* "frame_quat": Quaternions describing the instantaneous
|
|
492
|
+
transformation from the inertial frame to the corotating
|
|
493
|
+
frame at each time node as described in arXiv:1905.09300
|
|
494
|
+
and using conventions in Appendix B of arXiv:1110.2965.
|
|
495
|
+
Array of shape (len(times),4) with four quaternion
|
|
496
|
+
components at each time node. The first element at each
|
|
497
|
+
time node is the scalar part.
|
|
498
|
+
* "frame_omega": Angular velocity vector of the corotating
|
|
499
|
+
frame at each time node. Array of shape (len(times),3)
|
|
500
|
+
with three components at each time node.
|
|
501
|
+
* "times_spins": The times, in units of M, at which `chi`
|
|
502
|
+
and `chi2` are returned. Note that these are coordinate
|
|
503
|
+
times deep within the dynamic region of the simulation,
|
|
504
|
+
and so cannot be precisely related to the times in the
|
|
505
|
+
asymptotic waveform.
|
|
506
|
+
* "chi1": Cartesian spin components for the more massive
|
|
507
|
+
object, evaluated in the waveform-defined inertial
|
|
508
|
+
frame. Array of shape (len(times_spins),3) which
|
|
509
|
+
contains the Cartesian spin components
|
|
510
|
+
\{chi_{1x},chi_{1y},chi_{1z}\} at each time node.
|
|
511
|
+
* "chi2": Cartesian spin components for the less massive
|
|
512
|
+
object, evaluated in the waveform-defined inertial
|
|
513
|
+
frame. Array of shape (len(times_spins),3) which
|
|
514
|
+
contains the Cartesian spin components
|
|
515
|
+
\{chi_{2x},chi_{2y},chi_{2z}\} at each time node.
|
|
516
|
+
* "times_remnant": The times, in units of M, at which
|
|
517
|
+
`chi_remnant` and `mass_remnant` are returned. Note
|
|
518
|
+
that these are coordinate times deep within the dynamic
|
|
519
|
+
region of the simulation, and so cannot be precisely
|
|
520
|
+
related to the times in the asymptotic waveform.
|
|
521
|
+
* "chi_remnant": Cartesian spin components for the remnant
|
|
522
|
+
black hole, evaluated in the waveform-defined inertial
|
|
523
|
+
frame. Array of shape (len(times_remnant),3) which
|
|
524
|
+
contains the Cartesian spin components
|
|
525
|
+
\{chi_{rx},chi_{ry},chi_{rz}\}.
|
|
526
|
+
* "mass_remnant": The Christodoulou mass of the remnant
|
|
527
|
+
black hole as a function of time. Array of shape
|
|
528
|
+
(len(times_remnant),).
|
|
529
|
+
|
|
530
|
+
See also
|
|
531
|
+
========
|
|
532
|
+
sxs.load : General-purpose function to load SXS data in native
|
|
533
|
+
format
|
|
534
|
+
sxs.waveforms.to_lvc_conventions : Inner function that does all
|
|
535
|
+
the work for this function
|
|
536
|
+
|
|
537
|
+
Conventions
|
|
538
|
+
===========
|
|
539
|
+
We assume geometric units for time (units of M) and frequency
|
|
540
|
+
(units of cycles/M), with total mass M equal to 1.
|
|
541
|
+
|
|
542
|
+
Epoch time is defined by the peak of the $L^2$ norm of the modes:
|
|
543
|
+
|
|
544
|
+
$$t_e = \argmax_t \sum_\ell \sum_m |h_{\ell,m}(t)|^2,$$
|
|
545
|
+
|
|
546
|
+
where the sum over $\ell$ ranges from 2 to `ell_max_epoch`. All
|
|
547
|
+
time axes are then adjusted so that $t_e = 0$.
|
|
548
|
+
|
|
549
|
+
Frequencies are measured from the waveform, rather than orbital
|
|
550
|
+
trajectories, in terms of the angular-velocity vector given by
|
|
551
|
+
equation (7) of arXiv:1302.2919. The frequency is defined as the
|
|
552
|
+
magnitude of this vector divided by $2\pi$.
|
|
553
|
+
|
|
554
|
+
Waveforms, spins, dynamics, times, inclination angle and GW
|
|
555
|
+
reference phase are all defined in the inertial frame that
|
|
556
|
+
coincides with the "waveform-defined frame" at the reference time.
|
|
557
|
+
This frame is chosen so that the $z$ axis is aligned with the
|
|
558
|
+
dominant principal axis of the matrix given by equation (2a) of
|
|
559
|
+
arXiv:1109.5224, except that the strain is used in place of
|
|
560
|
+
$\psi_4$. That axis is only determined up to a sign, so we choose
|
|
561
|
+
the positive $z$ axis to be more parallel than antiparallel to the
|
|
562
|
+
angular velocity. Rotation about the $z$ axis is chosen to
|
|
563
|
+
approximate the condition that the more massive black hole is
|
|
564
|
+
located on the positive $x$ axis at the reference time, but can be
|
|
565
|
+
written solely in terms of the waveform modes:
|
|
566
|
+
|
|
567
|
+
* $\Im{h_{2,2} + \bar{h}_{2,-2}} = 0$
|
|
568
|
+
* $\Re{h_{2,2} + \bar{h}_{2,-2}} < 0$
|
|
569
|
+
* $\Im{h_{2,1} + \bar{h}_{2,-1}} < 0$
|
|
570
|
+
|
|
571
|
+
The first two conditions are necessary for cases of symmetric
|
|
572
|
+
systems in which $h_{2,\pm 1}=0$; the last condition breaks the
|
|
573
|
+
degeneracy of the first two under rotation about the $z$ axis by
|
|
574
|
+
$\pi$. For configurations that are symmetric under that rotation,
|
|
575
|
+
$h_{2,1}$ will be zero, so this condition will be impossible to
|
|
576
|
+
apply, but the symmetry of the system will mean that there is no
|
|
577
|
+
difference in the result.
|
|
578
|
+
|
|
579
|
+
Quaternion conventions are described in Appendix B of
|
|
580
|
+
arXiv:1110.2965. In particular, we use the convention that
|
|
581
|
+
|
|
582
|
+
Q = q_0 + vec(q) -> (q_0, q_1, q_2, q_3)
|
|
583
|
+
|
|
584
|
+
where q_0 is the scalar part.
|
|
585
|
+
|
|
586
|
+
"""
|
|
587
|
+
from ..waveforms.format_handlers.lvc import to_lvc_conventions
|
|
588
|
+
strain = self.load_waveform(*self.strain_path, transform_to_inertial=False)
|
|
589
|
+
return to_lvc_conventions(strain, self.horizons, **kwargs)
|
|
590
|
+
|
|
408
591
|
|
|
409
592
|
class Simulation_v1(SimulationBase):
|
|
410
593
|
"""Simulation object for version 1 of the data format
|
|
@@ -434,10 +617,14 @@ class Simulation_v1(SimulationBase):
|
|
|
434
617
|
if horizons_path in self.files:
|
|
435
618
|
horizons_location = self.files.get(horizons_path)["link"]
|
|
436
619
|
else:
|
|
620
|
+
# Some simulations used the SXS ID as a prefix in file paths
|
|
621
|
+
# within the Zenodo upload in version 1.x of the catalog.
|
|
437
622
|
if (extended_horizons_path := f"{self.sxs_id_stem}/{horizons_path}") in self.files:
|
|
438
623
|
horizons_location = self.files.get(extended_horizons_path)["link"]
|
|
439
624
|
else:
|
|
440
|
-
raise ValueError(
|
|
625
|
+
raise ValueError(
|
|
626
|
+
f"File '{horizons_path}' not found in simulation files for {self.location}"
|
|
627
|
+
)
|
|
441
628
|
horizons_truepath = Path(sxs_path_to_system_path(sxs_id_path / horizons_path))
|
|
442
629
|
return load(horizons_location, truepath=horizons_truepath)
|
|
443
630
|
|
|
@@ -465,19 +652,31 @@ class Simulation_v1(SimulationBase):
|
|
|
465
652
|
extrapolation
|
|
466
653
|
)
|
|
467
654
|
|
|
468
|
-
def load_waveform(self, file_name, group):
|
|
655
|
+
def load_waveform(self, file_name, group, transform_to_inertial=True):
|
|
656
|
+
# Note: `transform_to_inertial` is a slightly unnatural argument in version 1,
|
|
657
|
+
# since the data are actually stored in the inertial frame. If the value is
|
|
658
|
+
# `False`, we will transform the data to the corotating frame, which is what
|
|
659
|
+
# the corresponding argument in version 2 achieves naturally (since the data
|
|
660
|
+
# are stored in the corotating frame in that version).
|
|
469
661
|
from .. import load
|
|
470
662
|
if file_name in self.files:
|
|
471
663
|
location = self.files.get(file_name)["link"]
|
|
472
664
|
else:
|
|
665
|
+
# Some simulations used the SXS ID as a prefix in file paths
|
|
666
|
+
# within the Zenodo upload in version 1.x of the catalog.
|
|
473
667
|
if (extended_file_name := f"{self.sxs_id_stem}/{file_name}") in self.files:
|
|
474
668
|
location = self.files.get(extended_file_name)["link"]
|
|
475
669
|
else:
|
|
476
670
|
raise ValueError(f"File '{file_name}' not found in simulation files")
|
|
477
671
|
sxs_id_path = Path(self.sxs_id)
|
|
478
672
|
truepath = Path(sxs_path_to_system_path(sxs_id_path / file_name))
|
|
479
|
-
w = load(
|
|
673
|
+
w = load(
|
|
674
|
+
location, truepath=truepath, extrapolation_order=group,
|
|
675
|
+
transform_to_inertial=transform_to_inertial
|
|
676
|
+
)
|
|
480
677
|
w.metadata = self.metadata
|
|
678
|
+
if not transform_to_inertial:
|
|
679
|
+
w = w.to_corotating_frame()
|
|
481
680
|
return w
|
|
482
681
|
|
|
483
682
|
|
|
@@ -516,7 +715,7 @@ class Simulation_v2(SimulationBase):
|
|
|
516
715
|
f"/rMPsi4_Asymptotic_GeometricUnits_CoM_Mem/{extrapolation}"
|
|
517
716
|
)
|
|
518
717
|
|
|
519
|
-
def load_waveform(self, file_name, group):
|
|
718
|
+
def load_waveform(self, file_name, group, transform_to_inertial=True):
|
|
520
719
|
from .. import load
|
|
521
720
|
# Note that `name` should not have the file ending on input,
|
|
522
721
|
# but we will replace it regardless with `.with_suffix`.
|
|
@@ -528,11 +727,14 @@ class Simulation_v2(SimulationBase):
|
|
|
528
727
|
json_location = self.files.get(json_path)["link"]
|
|
529
728
|
h5_truepath = Path(sxs_path_to_system_path(sxs_id_path / h5_path))
|
|
530
729
|
json_truepath = Path(sxs_path_to_system_path(sxs_id_path / json_path))
|
|
531
|
-
if not json_truepath.exists():
|
|
730
|
+
if not Path(json_location).exists() and not json_truepath.exists():
|
|
532
731
|
if not read_config("download", True):
|
|
533
732
|
raise ValueError(f"{json_truepath} not found and download is disabled")
|
|
534
733
|
download_file(json_location, sxs_directory("cache") / json_truepath)
|
|
535
|
-
return load(
|
|
734
|
+
return load(
|
|
735
|
+
h5_location, truepath=h5_truepath, group=group, metadata=self.metadata,
|
|
736
|
+
transform_to_inertial=transform_to_inertial
|
|
737
|
+
)
|
|
536
738
|
|
|
537
739
|
|
|
538
740
|
def get_file_info(metadata, sxs_id, download=None):
|
|
@@ -2,7 +2,8 @@ import numpy as np
|
|
|
2
2
|
from scipy.optimize import root_scalar
|
|
3
3
|
from scipy.interpolate import CubicSpline, UnivariateSpline
|
|
4
4
|
import quaternionic
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
from ... import jit, TimeSeries
|
|
6
7
|
from ..waveform_modes import WaveformModesDict
|
|
7
8
|
|
|
8
9
|
from numpy import exp
|
|
@@ -159,10 +160,10 @@ def to_lvc_conventions(
|
|
|
159
160
|
|
|
160
161
|
# Transform to inertial-frame waveform, spins, and omega to `t_ref` frame
|
|
161
162
|
h = h.to_inertial_frame()
|
|
162
|
-
omega =
|
|
163
|
-
chi1 =
|
|
164
|
-
chi2 =
|
|
165
|
-
chi_remnant =
|
|
163
|
+
omega = R_adjustment.rotate(omega)
|
|
164
|
+
chi1 = TimeSeries(R_adjustment.rotate(chi1), t_chi)
|
|
165
|
+
chi2 = TimeSeries(R_adjustment.rotate(chi2), t_chi)
|
|
166
|
+
chi_remnant = TimeSeries(R_adjustment.rotate(horizons.C.chi_inertial), t_remnant)
|
|
166
167
|
|
|
167
168
|
# If requested, interpolate to time step `dt`, ensuring that `t=0` is preserved
|
|
168
169
|
if dt is not None:
|
|
@@ -201,8 +202,8 @@ def to_lvc_conventions(
|
|
|
201
202
|
# If `phi_ref` and `inclination` are not None, return polarizations
|
|
202
203
|
if phi_ref is not None:
|
|
203
204
|
hp, hc = h.evaluate(inclination, π/2 - phi_ref).ndarray.view((float, 2)).T
|
|
204
|
-
return t, hp, hc, dynamics_dict
|
|
205
|
+
return h.t, hp, hc, dynamics_dict
|
|
205
206
|
else:
|
|
206
207
|
# Could do `dict(WaveformModesDict(h))` to convert to a plain dict
|
|
207
208
|
hlm_dict = WaveformModesDict(h)
|
|
208
|
-
return t, hlm_dict, dynamics_dict
|
|
209
|
+
return h.t, hlm_dict, dynamics_dict
|
|
@@ -140,6 +140,11 @@ def load(file, **kwargs):
|
|
|
140
140
|
m_is_scaled_out : bool, optional
|
|
141
141
|
True if the mass is scaled out of the data, so that the data does not
|
|
142
142
|
change when the total mass changes (presumably for vacuum systems only).
|
|
143
|
+
transform_to_inertial : bool, optional
|
|
144
|
+
This is a slightly unnatural argument for this format, because the data is
|
|
145
|
+
already in the inertial frame. It is included for compatibility with the
|
|
146
|
+
RPDMB loader. Here, the default value is `True`, meaning that nothing is
|
|
147
|
+
done. If set to `False`, the data is transformed to the corotating frame.
|
|
143
148
|
|
|
144
149
|
"""
|
|
145
150
|
import pathlib
|
|
@@ -379,6 +384,8 @@ def load(file, **kwargs):
|
|
|
379
384
|
except KeyError as e:
|
|
380
385
|
raise ValueError("\nThis H5 file appears to have not stored all the required information.\n\n") from e
|
|
381
386
|
|
|
387
|
+
transform_to_inertial = kwargs.pop("transform_to_inertial", True)
|
|
388
|
+
|
|
382
389
|
if kwargs:
|
|
383
390
|
import pprint
|
|
384
391
|
warnings.warn("\nUnused kwargs passed to this function:\n{}".format(pprint.pformat(kwargs, width=1)))
|
|
@@ -399,6 +406,9 @@ def load(file, **kwargs):
|
|
|
399
406
|
if metadata:
|
|
400
407
|
w.metadata = metadata
|
|
401
408
|
|
|
409
|
+
if not transform_to_inertial:
|
|
410
|
+
w = w.to_corotating_frame()
|
|
411
|
+
|
|
402
412
|
return w
|
|
403
413
|
|
|
404
414
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sxs
|
|
3
|
-
Version: 2024.0.
|
|
3
|
+
Version: 2024.0.10
|
|
4
4
|
Summary: Interface to data produced by the Simulating eXtreme Spacetimes collaboration
|
|
5
5
|
Project-URL: Homepage, https://github.com/sxs-collaboration/sxs
|
|
6
6
|
Project-URL: Documentation, https://sxs.readthedocs.io/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
sxs/__init__.py,sha256=51_F8xiD6cdE2kIq9dPyHxNQVsp4oCvtR1wQQQ0VS2A,2577
|
|
2
|
-
sxs/__version__.py,sha256=
|
|
3
|
-
sxs/handlers.py,sha256
|
|
2
|
+
sxs/__version__.py,sha256=HO2uZQyvoVBeimxjf5paV_MvgXvaiQQkNFP85H526HY,26
|
|
3
|
+
sxs/handlers.py,sha256=zm1NQTeyM2idXzcmL24YXjnRVn2PBEa72LQQUUMHgOM,16667
|
|
4
4
|
sxs/juliapkg.json,sha256=higH1UDu30K_PN6-o7lAz0j1xjgYEiCCYBAc-Iaw1Iw,178
|
|
5
5
|
sxs/time_series.py,sha256=OKaLg8tFyrtKcef7900ri-a0C6A8wKxA68KovZXvH6I,41081
|
|
6
6
|
sxs/caltechdata/__init__.py,sha256=s-RXyBiImKsQenqJIU6NAjlsjOX7f1MkIIW9rPtWYyg,14761
|
|
@@ -18,7 +18,7 @@ sxs/julia/__init__.py,sha256=uSLP_xfU-GZG7IO5vs0TEkCR4LH8aBYMF-852wDY3kI,3490
|
|
|
18
18
|
sxs/metadata/__init__.py,sha256=KCvJ9Cf1WhIZp-z28UzarKcmUAzV2BOv2gqKiorILjo,149
|
|
19
19
|
sxs/metadata/metadata.py,sha256=y6X7LcsJKiZFjBPTwRHGtsT2uHf2s0r0OG_EGjD27pE,27663
|
|
20
20
|
sxs/simulations/__init__.py,sha256=sl-sDI5N2A03lAfzMig8Jm_Beri_v65qjlIOeGGX9XM,72
|
|
21
|
-
sxs/simulations/simulation.py,sha256=
|
|
21
|
+
sxs/simulations/simulation.py,sha256=BSqUCoiptbY_obC0fKrTACfwiFnvgHRibHLEx-H4_Rk,33915
|
|
22
22
|
sxs/simulations/simulations.py,sha256=s20HdjEIcoG3vsgJcC4CwjfhICVwKWNABOYYucPEfSs,17108
|
|
23
23
|
sxs/utilities/__init__.py,sha256=KTtsBKblP02t20anSzV_7tucRUw_bFObY5my5ZuJEBU,4793
|
|
24
24
|
sxs/utilities/bitwise.py,sha256=G9ZNYgwDQRhq5wbDf-p2HcUqkEP_IRDiQoXW4KyU17k,13205
|
|
@@ -64,8 +64,8 @@ sxs/waveforms/waveform_mixin.py,sha256=S0RNe2HkwnqdCyGEarGYmoXD_DkTWGorsiGGIBWOa
|
|
|
64
64
|
sxs/waveforms/waveform_modes.py,sha256=L6FSreVUSz60EN15A57c3qiwtML1QU-wdr9DYHaINk0,56919
|
|
65
65
|
sxs/waveforms/waveform_signal.py,sha256=Ojrt6DSDdleB0qmu6UwjjPnYdaWsrjnpBA_8dhnM_q4,182
|
|
66
66
|
sxs/waveforms/format_handlers/__init__.py,sha256=0wsnuBYCYsCkN19L2ipga7BtigvPyBcqiy_4qrzmLpE,50
|
|
67
|
-
sxs/waveforms/format_handlers/lvc.py,sha256=
|
|
68
|
-
sxs/waveforms/format_handlers/nrar.py,sha256=
|
|
67
|
+
sxs/waveforms/format_handlers/lvc.py,sha256=dY4rLC1riu1NWyPGc2kSsIsbVM5FgtMbEqca5S6odgk,7775
|
|
68
|
+
sxs/waveforms/format_handlers/nrar.py,sha256=UxD3V59taGXQ_ycSsRsQod0XJp7rKEjqRetrjqTODnI,20946
|
|
69
69
|
sxs/waveforms/format_handlers/rotating_paired_diff_multishuffle_bzip2.py,sha256=C19-9VkQ5dt9I7GHkeFrF56k_BbFPHXIMX_xmmBj7ww,27477
|
|
70
70
|
sxs/waveforms/format_handlers/rotating_paired_xor_multishuffle_bzip2.py,sha256=pFEJIlb6OQQNhv6r48ALFnZMKNZjuQY55ydWBADCDgU,2348
|
|
71
71
|
sxs/waveforms/format_handlers/spectre_cce_v1.py,sha256=nh57zbG_uWJZQVhMrz7H05fpsjl1X6oaita8aTRcWxU,3963
|
|
@@ -78,7 +78,7 @@ sxs/zenodo/api/__init__.py,sha256=EM_eh4Q8R5E0vIfMhyIR1IYFfOBu6vA0UTasgX9gHys,21
|
|
|
78
78
|
sxs/zenodo/api/deposit.py,sha256=J4RGvGjh0cEOrN4bBZWEDcPAhNscqB2fzLlvRZ5HTHM,36948
|
|
79
79
|
sxs/zenodo/api/login.py,sha256=Yz0ytgi81_5BpDzhrS0WPMXlvU2qUaCK8yn8zxfEbko,18007
|
|
80
80
|
sxs/zenodo/api/records.py,sha256=nKkhoHZ95CTztHF9Zzaug5p7IiUCJG4Em1i-l-WqH6U,3689
|
|
81
|
-
sxs-2024.0.
|
|
82
|
-
sxs-2024.0.
|
|
83
|
-
sxs-2024.0.
|
|
84
|
-
sxs-2024.0.
|
|
81
|
+
sxs-2024.0.10.dist-info/METADATA,sha256=5ZHOyiVzpdCcK67xfRxisfJKSbMf1XPEUkveai25Qk8,9245
|
|
82
|
+
sxs-2024.0.10.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
83
|
+
sxs-2024.0.10.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
|
|
84
|
+
sxs-2024.0.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|