sxs 2024.0.22__py3-none-any.whl → 2024.0.24__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "2024.0.22"
1
+ __version__ = "2024.0.24"
@@ -593,7 +593,10 @@ class SimulationBase:
593
593
 
594
594
  """
595
595
  from ..waveforms.format_handlers.lvc import to_lvc_conventions
596
- strain = self.load_waveform(*self.strain_path, transform_to_inertial=False)
596
+ strain = self.load_waveform(
597
+ *self.strain_path,
598
+ transform_to_inertial=False,
599
+ )
597
600
  return to_lvc_conventions(strain, self.horizons, **kwargs)
598
601
 
599
602
 
@@ -683,8 +686,6 @@ class Simulation_v1(SimulationBase):
683
686
  transform_to_inertial=transform_to_inertial
684
687
  )
685
688
  w.metadata = self.metadata
686
- if not transform_to_inertial:
687
- w = w.to_corotating_frame()
688
689
  return w
689
690
 
690
691
 
@@ -57,13 +57,17 @@ class SimulationsDataFrame(pd.DataFrame):
57
57
 
58
58
  @property
59
59
  def IMR(self):
60
- """Restrict dataframe to just BBH systems with inspiral, merger, and ringdown
60
+ """Restrict dataframe to just BBH IMR systems
61
61
 
62
+ "IMR" stands for inspiral, merger, and ringdown. Systems that
63
+ will *not* be in this group include simulations that
64
+ correspond to physical IMR systems, but were not continued
65
+ through the merger.
66
+
62
67
  The criteria used here are just that the reference
63
- eccentricity and remnant mass are actual (finite)
64
- numbers. Currently, at least, the existence of a
65
- measured eccentricity means that the system is not
66
- hyperbolic or head-on.
68
+ eccentricity and remnant mass are actual (finite) numbers.
69
+ Currently, at least, the existence of a measured eccentricity
70
+ means that the system is not hyperbolic or head-on.
67
71
  """
68
72
  df = self.BBH
69
73
  return type(df)(df[
sxs/waveforms/__init__.py CHANGED
@@ -15,6 +15,7 @@ from .format_handlers import (
15
15
  rotating_paired_diff_multishuffle_bzip2,
16
16
  rotating_paired_xor_multishuffle_bzip2,
17
17
  spectre_cce_v1,
18
+ grathena,
18
19
  )
19
20
  from .format_handlers.lvc import to_lvc_conventions
20
21
  from . import memory, transformations, alignment
@@ -0,0 +1,93 @@
1
+ from ... import sxs_directory
2
+ from . import nrar
3
+
4
+
5
+ def load(file, **kwargs):
6
+ """Load a waveform from a GR-Athena++ `tar` file.
7
+
8
+ Parameters
9
+ ==========
10
+ file : str
11
+ The path to the `tar` file containing the waveform data.
12
+
13
+ Other Parameters
14
+ ================
15
+ subfile : str
16
+ The name of the subfile within the `tar` file to read.
17
+ Default is "rh_CCE_GeometricUnits.h5". Other potentially
18
+ useful values replace "rh" with "rPsi4" and/or "CCE" with
19
+ "Asymptotic" or "FiniteRadii".
20
+ radius : str
21
+ The extraction radius to use. Default is "50.00".
22
+
23
+ Notes
24
+ =====
25
+ Waveforms from GR-Athena++ are distributed as `tar` files
26
+ containing a set of HDF5 files, containing CCE data,
27
+ "extrapolated" data (where "extrapolation" refers to the
28
+ single-radius PN-based correction method that Nakano introduced),
29
+ or finite-radius data, for either Psi4 or h. Each of those files
30
+ is NRAR-formatted exactly like the old SXS data. We could extract
31
+ the `tar` file, and then use the `nrar.load` function to read the
32
+ data. Alternatively — as is done here — we could just use the
33
+ `tar` file as a file-like object, and pass that to the `nrar.load`
34
+ function. This is a bit more efficient, and is preferred if we
35
+ intend to directly use the `tar` files.
36
+
37
+ The `tar` file is generally named with the resolution of the
38
+ simulation, which — for the initial catalog at least — may be any
39
+ of 128, 192, 256, 320, or 384.
40
+
41
+ Within the `tar` file, we have files like the following — though
42
+ "384" may be replaced by any resolution:
43
+
44
+ * "384/rPsi4_Asymptotic_GeometricUnits.h5"
45
+ * "384/rPsi4_CCE_GeometricUnits.h5"
46
+ * "384/rPsi4_FiniteRadii_GeometricUnits.h5"
47
+ * "384/rh_Asymptotic_GeometricUnits.h5"
48
+ * "384/rh_CCE_GeometricUnits.h5"
49
+ * "384/rh_FiniteRadii_GeometricUnits.h5"
50
+
51
+ And finally, within each of those h5 files, we have waveforms
52
+ corresponding to a series of extraction radii, which may include
53
+
54
+ * "50.00"
55
+ * "60.00"
56
+ * "70.00"
57
+ * "80.00"
58
+ * "90.00"
59
+ * "100.00"
60
+ * "120.00"
61
+ * "140.00"
62
+
63
+ (Note the two 0s after the decimal point.) The `FiniteRadii` and
64
+ `Asymptotic` data generally contain all of the above radii, while
65
+ the `CCE` data generally contains only the "50.00" and "100.00"
66
+ radius. The catalog paper uses "50.00" as the radius when
67
+ discussing properties of the waveforms, possibly because CCE only
68
+ "exhibits convergence behavior" for data from that radius. They
69
+ also use "100.00" for "extrapolated" waveforms some times. The
70
+ default used here is "50.00".
71
+
72
+ """
73
+ from pathlib import Path
74
+ import tarfile
75
+
76
+ resolution = Path(file).stem
77
+ subfile = kwargs.pop("subfile", "rh_CCE_GeometricUnits.h5")
78
+ radius = kwargs.pop("radius", "50.00")
79
+
80
+ with tarfile.open(file, "r") as tf:
81
+ tf_names = [tfi.name for tfi in tf]
82
+ index = tf_names.index(f"{resolution}/{subfile}")
83
+ h5file = tf.extractfile(list(tf)[index])
84
+ w = nrar.load(
85
+ h5file,
86
+ h5_group=radius,
87
+ frame_type=nrar.Inertial,
88
+ data_type=nrar.h,
89
+ m_is_scaled_out=True,
90
+ r_is_scaled_out=True,
91
+ )
92
+
93
+ return w
@@ -202,6 +202,7 @@ def to_lvc_conventions(
202
202
  # If `phi_ref` and `inclination` are not None, return polarizations
203
203
  if phi_ref is not None:
204
204
  hp, hc = h.evaluate(inclination, π/2 - phi_ref).ndarray.view((float, 2)).T
205
+ hc *= -1 # Because h = hp - i hc
205
206
  return h.t, hp, hc, dynamics_dict
206
207
  else:
207
208
  # Could do `dict(WaveformModesDict(h))` to convert to a plain dict
@@ -148,6 +148,7 @@ def load(file, **kwargs):
148
148
 
149
149
  """
150
150
  import pathlib
151
+ import tarfile
151
152
  import re
152
153
  import h5py
153
154
  import quaternionic
@@ -161,41 +162,53 @@ def load(file, **kwargs):
161
162
  w_attributes = {}
162
163
 
163
164
  # Get an h5py handle to the desired part of the h5 file
164
- file_str = str(file)
165
- split = file_str.rsplit(".h5", 1) # Raises ValueError if ".h5" is not in the string
166
- if len(split) != 2:
167
- split = file_str.rsplit(".hdf5", 1)
168
- file_ending = ".hdf5"
169
- else:
170
- file_ending = ".h5"
171
- if len(split) != 2:
172
- raise ValueError(f"Could not find a valid HDF5 filename ending in '{file_str}'")
173
- file_str, root_group = split
174
- file_str = file_str + file_ending
175
- if not root_group:
165
+ if isinstance(file, tarfile.ExFileObject):
166
+ file_path = file
167
+ file_name = pathlib.Path(file.name).name
168
+ file_str = f"{file_name}"
169
+ file_dir = pathlib.Path(file.name).parent
176
170
  root_group = kwargs.pop("h5_group", "")
177
- if not root_group:
178
- extrapolation_order = kwargs.pop("extrapolation_order", None)
179
- if extrapolation_order is None:
180
- warning = "\nCould not find root group as `h5_group` or as `extrapolation_order`; returning all groups"
181
- warnings.warn(warning)
182
- elif extrapolation_order is Ellipsis:
183
- pass
184
- elif isinstance(extrapolation_order, str):
185
- root_group = extrapolation_order
186
- elif extrapolation_order == -1:
187
- root_group = "OutermostExtraction.dir"
171
+ else:
172
+ file_str = str(file)
173
+ split = file_str.rsplit(".h5", 1) # Raises ValueError if ".h5" is not in the string
174
+ if len(split) != 2:
175
+ split = file_str.rsplit(".hdf5", 1)
176
+ file_ending = ".hdf5"
188
177
  else:
189
- root_group = f"Extrapolated_N{extrapolation_order}.dir"
178
+ file_ending = ".h5"
179
+ if len(split) != 2:
180
+ raise ValueError(f"Could not find a valid HDF5 filename ending in '{file_str}'")
181
+ file_str, root_group = split
182
+ file_str = file_str + file_ending
183
+ if not root_group:
184
+ root_group = kwargs.pop("h5_group", "")
185
+ if not root_group:
186
+ extrapolation_order = kwargs.pop("extrapolation_order", None)
187
+ if extrapolation_order is None:
188
+ warning = "\nCould not find root group as `h5_group` or as `extrapolation_order`; returning all groups"
189
+ warnings.warn(warning)
190
+ elif extrapolation_order is Ellipsis:
191
+ pass
192
+ elif isinstance(extrapolation_order, str):
193
+ root_group = extrapolation_order
194
+ elif extrapolation_order == -1:
195
+ root_group = "OutermostExtraction.dir"
196
+ else:
197
+ root_group = f"Extrapolated_N{extrapolation_order}.dir"
190
198
 
191
- file_path = pathlib.Path(file_str).expanduser().resolve()
192
- file_name = file_path.name
193
- file_dir = file_path.parent
199
+ file_path = pathlib.Path(file_str).expanduser().resolve()
200
+ file_name = file_path.name
201
+ file_dir = file_path.parent
194
202
 
195
203
  with h5py.File(file_path, "r") as f_h5:
196
204
  if root_group:
197
205
  if root_group not in f_h5:
198
- raise ValueError(f"Input root group '{root_group}' was not found in '{file_path}'")
206
+ message = [
207
+ f"Input root group '{root_group}' was not found in '{file_path}'",
208
+ "Available groups are:",
209
+ ]
210
+ f_h5.visit(lambda s: message.append(f"\t{s}"))
211
+ raise ValueError("\n".join(message))
199
212
  f = f_h5[root_group]
200
213
  else:
201
214
  return KeyPassingDict(**{
@@ -3,6 +3,7 @@
3
3
  import re
4
4
  import numbers
5
5
  from collections.abc import MutableMapping
6
+ import warnings
6
7
  import numpy as np
7
8
  from scipy.interpolate import CubicSpline
8
9
  from scipy.optimize import minimize_scalar
@@ -1127,6 +1128,9 @@ class WaveformModes(WaveformMixin, TimeSeries):
1127
1128
  raised.
1128
1129
 
1129
1130
  """
1131
+ if self.frame_type == "corotating":
1132
+ warnings.warn("This waveform is already in a corotating frame; returning original.")
1133
+ return self
1130
1134
  frame, omega = self.corotating_frame(
1131
1135
  R0=R0,
1132
1136
  tolerance=tolerance,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sxs
3
- Version: 2024.0.22
3
+ Version: 2024.0.24
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,5 +1,5 @@
1
1
  sxs/__init__.py,sha256=hbydsXWR88sFiKExPJ1NHWGEvWRbbJBjSc1irSMYKgY,2623
2
- sxs/__version__.py,sha256=I4E6gGsS8NeMVLO7_zs_eRHp09cSVrztULxx3C2s-XA,26
2
+ sxs/__version__.py,sha256=mmwyMBxxhpLBrZ0NORTAKzSf8R7pTJXf2m8m6-6FouM,26
3
3
  sxs/handlers.py,sha256=Nc1_aDKm_wDHg2cITI_ljbqU4VRWpwQ7fdgy3c1XcE8,17531
4
4
  sxs/juliapkg.json,sha256=higH1UDu30K_PN6-o7lAz0j1xjgYEiCCYBAc-Iaw1Iw,178
5
5
  sxs/time_series.py,sha256=OKaLg8tFyrtKcef7900ri-a0C6A8wKxA68KovZXvH6I,41081
@@ -19,8 +19,8 @@ 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=GrZym0PHTULDg_hyFmISNzDfqVLz_hQo-djbgecZs54,134
21
21
  sxs/simulations/local.py,sha256=CEu8PzumNB1-JA05M4tYSW_UZVrldKzOB5T_I3pFWls,5789
22
- sxs/simulations/simulation.py,sha256=R2Nf3z3XEu92-oiHLeynGMpjqQu5iYV25L8K9lFrOcY,34204
23
- sxs/simulations/simulations.py,sha256=qnYHKd6wz5auYweOZeDDMm4ZzG3s-lqOltQCxEZBrmU,23594
22
+ sxs/simulations/simulation.py,sha256=pSwC82oeoaQTs2TB7uJLl0pScN6b9AgHdmTxf_iRKB4,34161
23
+ sxs/simulations/simulations.py,sha256=YttUK3WTU786OrHKMWya8myuMmmjMbazfIVs7A8FPlk,23781
24
24
  sxs/utilities/__init__.py,sha256=WSStlqljfgQheMxHGfuofSc5LdmASGvO3FNO3f_zaT0,4806
25
25
  sxs/utilities/bitwise.py,sha256=G9ZNYgwDQRhq5wbDf-p2HcUqkEP_IRDiQoXW4KyU17k,13205
26
26
  sxs/utilities/dicts.py,sha256=CCpm3upG_9SRj9gjawukSUfaJ5asF-XRG2ausEXhYyg,695
@@ -55,18 +55,19 @@ sxs/utilities/references/fairchild_report.py,sha256=MUnYQD7zJcz202Vt3-j9ueXglthG
55
55
  sxs/utilities/references/inspire.py,sha256=kDjY-UFJT-VTS3yJOT8fT6LJG-pRrX9TK8nv3RZqrbo,8431
56
56
  sxs/utilities/references/journal_abbreviations.py,sha256=SuRXcr4rv9YPbXD4mzujSvE7M6KS1lwELimuyn7mfCE,31018
57
57
  sxs/utilities/references/references.py,sha256=29rPUZKw3dztXQLRDEt1hGYjZaONFd0qX--xQxzOmUU,418
58
- sxs/waveforms/__init__.py,sha256=Z9MYCDhGeXN002vD_umirAF5VdAFunL4RiFSvB_gWnM,1136
58
+ sxs/waveforms/__init__.py,sha256=FPu_MFwfzcLsWhvoLm_AXRLz59eBODes4MY2_taTE5c,1150
59
59
  sxs/waveforms/alignment.py,sha256=YHtOyOUBxdaXMIgjdeGvJqU0zN5UOUChrAOEZdkU45Y,12418
60
60
  sxs/waveforms/memory.py,sha256=1BOov3QJl9wexgGt8HA8MqVZZfLKbykff5pRVzLiILo,7763
61
61
  sxs/waveforms/mode_utilities.py,sha256=gxsW-hunCoIReBVv9IrkGLdshr0rmztbH-JRgD6D9z0,5253
62
62
  sxs/waveforms/transformations.py,sha256=S5C-xnCk2umZlVsYgciyp7VMGZA8NI6md7OZp72upJU,9124
63
63
  sxs/waveforms/waveform_grid.py,sha256=aBlcsudj1XozZD7n42sh6-nzysKNalAdHJkVQ7M6fE4,180
64
64
  sxs/waveforms/waveform_mixin.py,sha256=S0RNe2HkwnqdCyGEarGYmoXD_DkTWGorsiGGIBWOam8,1179
65
- sxs/waveforms/waveform_modes.py,sha256=L6FSreVUSz60EN15A57c3qiwtML1QU-wdr9DYHaINk0,56919
65
+ sxs/waveforms/waveform_modes.py,sha256=svvEHHyOez6MFcpVsIFsiLJqvGrb_saCgSHVBK1XErk,57100
66
66
  sxs/waveforms/waveform_signal.py,sha256=Ojrt6DSDdleB0qmu6UwjjPnYdaWsrjnpBA_8dhnM_q4,182
67
67
  sxs/waveforms/format_handlers/__init__.py,sha256=0wsnuBYCYsCkN19L2ipga7BtigvPyBcqiy_4qrzmLpE,50
68
- sxs/waveforms/format_handlers/lvc.py,sha256=dY4rLC1riu1NWyPGc2kSsIsbVM5FgtMbEqca5S6odgk,7775
69
- sxs/waveforms/format_handlers/nrar.py,sha256=UxD3V59taGXQ_ycSsRsQod0XJp7rKEjqRetrjqTODnI,20946
68
+ sxs/waveforms/format_handlers/grathena.py,sha256=Ng0eEo3Um_WOYe63waaOYxy5Qu8m7-piCjgB3XguUdU,3294
69
+ sxs/waveforms/format_handlers/lvc.py,sha256=gdXYqa8Bn8jCSIRIshMP399WO9ZMtkNtkAQiuzqhH_0,7817
70
+ sxs/waveforms/format_handlers/nrar.py,sha256=3ycVoqQcWAAixV3mKp58_wUhYBHt6QeLv2YGSvy-EGM,21538
70
71
  sxs/waveforms/format_handlers/rotating_paired_diff_multishuffle_bzip2.py,sha256=C19-9VkQ5dt9I7GHkeFrF56k_BbFPHXIMX_xmmBj7ww,27477
71
72
  sxs/waveforms/format_handlers/rotating_paired_xor_multishuffle_bzip2.py,sha256=pFEJIlb6OQQNhv6r48ALFnZMKNZjuQY55ydWBADCDgU,2348
72
73
  sxs/waveforms/format_handlers/spectre_cce_v1.py,sha256=nh57zbG_uWJZQVhMrz7H05fpsjl1X6oaita8aTRcWxU,3963
@@ -79,7 +80,7 @@ sxs/zenodo/api/__init__.py,sha256=EM_eh4Q8R5E0vIfMhyIR1IYFfOBu6vA0UTasgX9gHys,21
79
80
  sxs/zenodo/api/deposit.py,sha256=J4RGvGjh0cEOrN4bBZWEDcPAhNscqB2fzLlvRZ5HTHM,36948
80
81
  sxs/zenodo/api/login.py,sha256=Yz0ytgi81_5BpDzhrS0WPMXlvU2qUaCK8yn8zxfEbko,18007
81
82
  sxs/zenodo/api/records.py,sha256=nKkhoHZ95CTztHF9Zzaug5p7IiUCJG4Em1i-l-WqH6U,3689
82
- sxs-2024.0.22.dist-info/METADATA,sha256=Fr9NWKGw4rnKeDxR1GENCk5nQ2JYSwS4pHPws9nZSB8,9223
83
- sxs-2024.0.22.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
84
- sxs-2024.0.22.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
85
- sxs-2024.0.22.dist-info/RECORD,,
83
+ sxs-2024.0.24.dist-info/METADATA,sha256=JcN5Id2HHk-gLksiFD8wAHbJ_FZTk6C93dah3OjSH3k,9223
84
+ sxs-2024.0.24.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
85
+ sxs-2024.0.24.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
86
+ sxs-2024.0.24.dist-info/RECORD,,