sxs 2024.0.13__py3-none-any.whl → 2024.0.15__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 -0
- sxs/simulations/local.py +1 -0
- sxs/simulations/simulation.py +11 -5
- sxs/simulations/simulations.py +77 -4
- {sxs-2024.0.13.dist-info → sxs-2024.0.15.dist-info}/METADATA +1 -1
- {sxs-2024.0.13.dist-info → sxs-2024.0.15.dist-info}/RECORD +9 -9
- {sxs-2024.0.13.dist-info → sxs-2024.0.15.dist-info}/WHEEL +0 -0
- {sxs-2024.0.13.dist-info → sxs-2024.0.15.dist-info}/licenses/LICENSE +0 -0
sxs/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2024.0.
|
|
1
|
+
__version__ = "2024.0.15"
|
sxs/handlers.py
CHANGED
|
@@ -286,6 +286,9 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
|
|
|
286
286
|
elif location == "local_simulations":
|
|
287
287
|
return Simulations.local(download=download)
|
|
288
288
|
|
|
289
|
+
elif location == "dataframe":
|
|
290
|
+
return Simulations.load(download=download).dataframe
|
|
291
|
+
|
|
289
292
|
elif sxs_id_version_lev_exact_re.match(location):
|
|
290
293
|
return Simulation(location, download=download, cache=cache, progress=progress, **kwargs)
|
|
291
294
|
|
sxs/simulations/local.py
CHANGED
|
@@ -119,6 +119,7 @@ def local_simulations(annex_dir):
|
|
|
119
119
|
[d for d in dirnames if d.startswith("Lev")]
|
|
120
120
|
)[-1]
|
|
121
121
|
metadata = Metadata.load(dirpath / highest_lev / "metadata")
|
|
122
|
+
metadata = metadata.add_standard_parameters()
|
|
122
123
|
|
|
123
124
|
metadata["files"] = {
|
|
124
125
|
p2i(file.relative_to(dirpath)): {"link": str(file)}
|
sxs/simulations/simulation.py
CHANGED
|
@@ -97,14 +97,20 @@ def Simulation(location, *args, **kwargs):
|
|
|
97
97
|
"""
|
|
98
98
|
from .. import load, sxs_directory
|
|
99
99
|
|
|
100
|
+
# Load the simulation catalog
|
|
101
|
+
simulations = load("simulations")
|
|
102
|
+
|
|
100
103
|
# Extract the simulation ID, version, and Lev from the location string
|
|
101
104
|
simulation_id, input_version = sxs_id_and_version(location)
|
|
102
105
|
if not simulation_id:
|
|
103
|
-
|
|
106
|
+
if location in simulations:
|
|
107
|
+
simulation_id = location.split("/Lev")[0]
|
|
108
|
+
input_version = "v0.0"
|
|
109
|
+
else:
|
|
110
|
+
raise ValueError(f"Invalid SXS ID in '{simulation_id}'")
|
|
104
111
|
input_lev_number = lev_number(location) # Will be `None` if not present
|
|
105
112
|
|
|
106
|
-
#
|
|
107
|
-
simulations = load("simulations")
|
|
113
|
+
# Check if simulation ID exists in the catalog
|
|
108
114
|
if simulation_id not in simulations:
|
|
109
115
|
raise ValueError(f"Simulation '{simulation_id}' not found in simulation catalog")
|
|
110
116
|
|
|
@@ -113,7 +119,7 @@ def Simulation(location, *args, **kwargs):
|
|
|
113
119
|
series = simulations.dataframe.loc[simulation_id]
|
|
114
120
|
|
|
115
121
|
# Check if the specified version exists in the simulation catalog
|
|
116
|
-
if input_version not in metadata.DOI_versions:
|
|
122
|
+
if input_version != "v0.0" and input_version not in metadata.DOI_versions:
|
|
117
123
|
raise ValueError(f"Version '{input_version}' not found in simulation catalog for '{simulation_id}'")
|
|
118
124
|
|
|
119
125
|
# Set various pieces of information about the simulation
|
|
@@ -205,7 +211,7 @@ def Simulation(location, *args, **kwargs):
|
|
|
205
211
|
sim = Simulation_v1(
|
|
206
212
|
metadata, series, version, sxs_id_stem, sxs_id, url, files, lev_numbers, output_lev_number, location, *args, **kwargs
|
|
207
213
|
)
|
|
208
|
-
elif 2 <= version_number < 3.0:
|
|
214
|
+
elif 2 <= version_number < 3.0 or version == "v0.0":
|
|
209
215
|
sim = Simulation_v2(
|
|
210
216
|
metadata, series, version, sxs_id_stem, sxs_id, url, files, lev_numbers, output_lev_number, location, *args, **kwargs
|
|
211
217
|
)
|
sxs/simulations/simulations.py
CHANGED
|
@@ -2,6 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
import functools
|
|
4
4
|
import collections
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
7
|
+
class SimulationsDataFrame(pd.DataFrame):
|
|
8
|
+
@property
|
|
9
|
+
def BHBH(self):
|
|
10
|
+
"""Restrict dataframe to just binary black hole systems"""
|
|
11
|
+
return type(self)(self[self["object_types"] == "BHBH"])
|
|
12
|
+
BBH = BHBH
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def BHNS(self):
|
|
16
|
+
"""Restrict dataframe to just black hole-neutron star systems"""
|
|
17
|
+
return type(self)(self[self["object_types"] == "BHNS"])
|
|
18
|
+
NSBH = BHNS
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def NSNS(self):
|
|
22
|
+
"""Restrict dataframe to just binary neutron star systems"""
|
|
23
|
+
return type(self)(self[self["object_types"] == "NSNS"])
|
|
24
|
+
BNS = NSNS
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def noneccentric(self):
|
|
28
|
+
"""Restrict dataframe to just non-eccentric systems (e<1e-3)"""
|
|
29
|
+
return type(self)(self[self["reference_eccentricity"] < 1e-3])
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def eccentric(self):
|
|
33
|
+
"""Restrict dataframe to just eccentric systems (e>=1e-3)"""
|
|
34
|
+
return type(self)(self[self["reference_eccentricity"] >= 1e-3])
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def nonprecessing(self):
|
|
38
|
+
"""Restrict dataframe to just nonprecessing systems
|
|
39
|
+
|
|
40
|
+
The criterion used here is that the sum of the x-y components
|
|
41
|
+
of the spins is less than 1e-3 at the reference time.
|
|
42
|
+
"""
|
|
43
|
+
return type(self)(self[
|
|
44
|
+
(self["reference_chi1_perp"] + self["reference_chi2_perp"]) < 1e-3
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def precessing(self):
|
|
49
|
+
"""Restrict dataframe to just precessing systems
|
|
50
|
+
|
|
51
|
+
The criterion used here is that the sum of the x-y components
|
|
52
|
+
of the spins is at least 1e-3 at the reference time.
|
|
53
|
+
"""
|
|
54
|
+
return type(self)(self[
|
|
55
|
+
(self["reference_chi1_perp"] + self["reference_chi2_perp"]) >= 1e-3
|
|
56
|
+
])
|
|
5
57
|
|
|
6
58
|
|
|
7
59
|
class Simulations(collections.OrderedDict):
|
|
@@ -110,13 +162,19 @@ class Simulations(collections.OrderedDict):
|
|
|
110
162
|
with local_path.open("r") as f:
|
|
111
163
|
local_simulations = json.load(f)
|
|
112
164
|
simulations = cls.load(download)
|
|
165
|
+
doi_versions = {
|
|
166
|
+
k: v["DOI_versions"]
|
|
167
|
+
for k,v in simulations.items()
|
|
168
|
+
if "DOI_versions" in v
|
|
169
|
+
}
|
|
113
170
|
simulations.update(local_simulations)
|
|
171
|
+
for k,v in doi_versions.items():
|
|
172
|
+
simulations[k]["DOI_versions"] = v
|
|
114
173
|
simulations.__file__ = str(local_path)
|
|
115
174
|
return simulations
|
|
116
175
|
|
|
117
176
|
@classmethod
|
|
118
|
-
|
|
119
|
-
def load(cls, download=None):
|
|
177
|
+
def load(cls, download=None, *, local=False):
|
|
120
178
|
"""Load the catalog of SXS simulations
|
|
121
179
|
|
|
122
180
|
Note that — unlike most SXS data files — the simulations file is updated
|
|
@@ -136,6 +194,12 @@ class Simulations(collections.OrderedDict):
|
|
|
136
194
|
if that fails, and only raise an error if the simulations is not found in the
|
|
137
195
|
cache. Note that this ignores the sxs configuration file entirely.
|
|
138
196
|
|
|
197
|
+
Keyword-only Parameters
|
|
198
|
+
-----------------------
|
|
199
|
+
local : {None, bool}, optional
|
|
200
|
+
If True, this function will load local simulations from the sxs cache. To
|
|
201
|
+
prepare the cache, you may wish to call `sxs.write_local_simulations`.
|
|
202
|
+
|
|
139
203
|
See Also
|
|
140
204
|
--------
|
|
141
205
|
sxs.sxs_directory : Locate cache directory
|
|
@@ -148,6 +212,13 @@ class Simulations(collections.OrderedDict):
|
|
|
148
212
|
from .. import sxs_directory, read_config
|
|
149
213
|
from ..utilities import download_file
|
|
150
214
|
|
|
215
|
+
if hasattr(cls, "_simulations"):
|
|
216
|
+
return cls._simulations
|
|
217
|
+
|
|
218
|
+
if local:
|
|
219
|
+
cls._simulations = cls.local(download=download)
|
|
220
|
+
return cls._simulations
|
|
221
|
+
|
|
151
222
|
progress = read_config("download_progress", True)
|
|
152
223
|
|
|
153
224
|
remote_timestamp = cls.remote_timestamp(download is not False) # Test for literal `False`
|
|
@@ -209,6 +280,8 @@ class Simulations(collections.OrderedDict):
|
|
|
209
280
|
|
|
210
281
|
sims = cls(simulations)
|
|
211
282
|
sims.__file__ = str(cache_path)
|
|
283
|
+
|
|
284
|
+
cls._simulations = sims
|
|
212
285
|
return sims
|
|
213
286
|
|
|
214
287
|
@classmethod
|
|
@@ -315,7 +388,7 @@ class Simulations(collections.OrderedDict):
|
|
|
315
388
|
dt = pd.to_datetime("1970-1-1").tz_localize("UTC")
|
|
316
389
|
return dt
|
|
317
390
|
|
|
318
|
-
sims_df = pd.concat((
|
|
391
|
+
sims_df = SimulationsDataFrame(pd.concat((
|
|
319
392
|
simulations["reference_time"].map(floater),
|
|
320
393
|
simulations["reference_mass_ratio"].map(floater),
|
|
321
394
|
simulations["reference_dimensionless_spin1"].map(three_vec),
|
|
@@ -387,7 +460,7 @@ class Simulations(collections.OrderedDict):
|
|
|
387
460
|
simulations["date_run_earliest"].map(datetime_from_string),
|
|
388
461
|
simulations["date_run_latest"].map(datetime_from_string),
|
|
389
462
|
simulations["date_postprocessing"].map(datetime_from_string),
|
|
390
|
-
), axis=1)
|
|
463
|
+
), axis=1))
|
|
391
464
|
|
|
392
465
|
sims_df.insert(0, "deprecated", (
|
|
393
466
|
~sims_df.superseded_by.isna()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sxs
|
|
3
|
-
Version: 2024.0.
|
|
3
|
+
Version: 2024.0.15
|
|
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=hbydsXWR88sFiKExPJ1NHWGEvWRbbJBjSc1irSMYKgY,2623
|
|
2
|
-
sxs/__version__.py,sha256=
|
|
3
|
-
sxs/handlers.py,sha256=
|
|
2
|
+
sxs/__version__.py,sha256=BGqJJdNZR4le1Z34PSJ09M4Ey3xZUp0qPiEiOTKJjOw,26
|
|
3
|
+
sxs/handlers.py,sha256=B3mCX7sPtnyYpkzuDCUrpHL4pmHDo9I7UjaHAIJ2s5A,16874
|
|
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,9 +18,9 @@ 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=GrZym0PHTULDg_hyFmISNzDfqVLz_hQo-djbgecZs54,134
|
|
21
|
-
sxs/simulations/local.py,sha256=
|
|
22
|
-
sxs/simulations/simulation.py,sha256=
|
|
23
|
-
sxs/simulations/simulations.py,sha256=
|
|
21
|
+
sxs/simulations/local.py,sha256=CEu8PzumNB1-JA05M4tYSW_UZVrldKzOB5T_I3pFWls,5789
|
|
22
|
+
sxs/simulations/simulation.py,sha256=UN7cQ8y1Ccr3TPI8TyMAr9hvzQuM8NcitqXJJ0IXNPs,34110
|
|
23
|
+
sxs/simulations/simulations.py,sha256=hMmA0_EC9JzTcNFUFDbegZgNw4XwMdKnjKkg-vucpLE,21621
|
|
24
24
|
sxs/utilities/__init__.py,sha256=KTtsBKblP02t20anSzV_7tucRUw_bFObY5my5ZuJEBU,4793
|
|
25
25
|
sxs/utilities/bitwise.py,sha256=G9ZNYgwDQRhq5wbDf-p2HcUqkEP_IRDiQoXW4KyU17k,13205
|
|
26
26
|
sxs/utilities/dicts.py,sha256=CCpm3upG_9SRj9gjawukSUfaJ5asF-XRG2ausEXhYyg,695
|
|
@@ -79,7 +79,7 @@ sxs/zenodo/api/__init__.py,sha256=EM_eh4Q8R5E0vIfMhyIR1IYFfOBu6vA0UTasgX9gHys,21
|
|
|
79
79
|
sxs/zenodo/api/deposit.py,sha256=J4RGvGjh0cEOrN4bBZWEDcPAhNscqB2fzLlvRZ5HTHM,36948
|
|
80
80
|
sxs/zenodo/api/login.py,sha256=Yz0ytgi81_5BpDzhrS0WPMXlvU2qUaCK8yn8zxfEbko,18007
|
|
81
81
|
sxs/zenodo/api/records.py,sha256=nKkhoHZ95CTztHF9Zzaug5p7IiUCJG4Em1i-l-WqH6U,3689
|
|
82
|
-
sxs-2024.0.
|
|
83
|
-
sxs-2024.0.
|
|
84
|
-
sxs-2024.0.
|
|
85
|
-
sxs-2024.0.
|
|
82
|
+
sxs-2024.0.15.dist-info/METADATA,sha256=GzByjeNRag_EYwribITnNpS6_rkI5GA4l15YufjxQ7E,9245
|
|
83
|
+
sxs-2024.0.15.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
84
|
+
sxs-2024.0.15.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
|
|
85
|
+
sxs-2024.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|