sxs 2025.0.5__py3-none-any.whl → 2025.0.7__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/simulations/simulation.py +66 -52
- sxs/utilities/inspire.py +28 -23
- {sxs-2025.0.5.dist-info → sxs-2025.0.7.dist-info}/METADATA +2 -2
- {sxs-2025.0.5.dist-info → sxs-2025.0.7.dist-info}/RECORD +7 -7
- {sxs-2025.0.5.dist-info → sxs-2025.0.7.dist-info}/WHEEL +0 -0
- {sxs-2025.0.5.dist-info → sxs-2025.0.7.dist-info}/licenses/LICENSE +0 -0
sxs/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2025.0.
|
|
1
|
+
__version__ = "2025.0.7"
|
sxs/simulations/simulation.py
CHANGED
|
@@ -7,6 +7,32 @@ from ..utilities import (
|
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
def search_prefixes(file, lev, files, ending=""):
|
|
11
|
+
"""Find the actual filename present in the list of files
|
|
12
|
+
|
|
13
|
+
Different versions of Zenodo and CaltechDATA place different
|
|
14
|
+
restrictions on filenames — and specifically, things I would
|
|
15
|
+
consider to be directories. If there are multiple Levs for a
|
|
16
|
+
simulation, we have to somehow specify the Lev in the filename.
|
|
17
|
+
The permitted strings for doing so have changed over the years, so
|
|
18
|
+
the directory separator was allowed to be a "/" for old systems,
|
|
19
|
+
but must be something else now; we settled on ":". However, if
|
|
20
|
+
there is just one Lev in a simulation, and we try to save the
|
|
21
|
+
files in a consistent way — including the Lev with the appropriate
|
|
22
|
+
separator, different versions of Zenodo and CaltechDATA will
|
|
23
|
+
either allow or silently remove that prefix. The simplest
|
|
24
|
+
approach is to just search over all possibilities, for which
|
|
25
|
+
filename is actually present in the data. That's what this
|
|
26
|
+
function does.
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
for prefix in [f"{lev}:", f"{lev}/", ""]:
|
|
30
|
+
fn = f"{prefix}{file}"
|
|
31
|
+
if f"{fn}{ending}" in files:
|
|
32
|
+
return fn
|
|
33
|
+
raise ValueError(f"{file}{ending} not found in any form in files")
|
|
34
|
+
|
|
35
|
+
|
|
10
36
|
def Simulation(location, *args, **kwargs):
|
|
11
37
|
"""Construct a Simulation object from a location string
|
|
12
38
|
|
|
@@ -113,8 +139,8 @@ def Simulation(location, *args, **kwargs):
|
|
|
113
139
|
# Extract the simulation ID, version, and Lev from the location string
|
|
114
140
|
simulation_id, input_version = sxs_id_and_version(location)
|
|
115
141
|
if not simulation_id:
|
|
116
|
-
if location.split("/Lev")[0] in simulations:
|
|
117
|
-
simulation_id =
|
|
142
|
+
if (sim_id := location.split("/Lev")[0]) in simulations:
|
|
143
|
+
simulation_id = sim_id
|
|
118
144
|
input_version = latest_version
|
|
119
145
|
else:
|
|
120
146
|
raise ValueError(f"Invalid SXS ID in '{simulation_id}'")
|
|
@@ -129,7 +155,11 @@ def Simulation(location, *args, **kwargs):
|
|
|
129
155
|
series = simulations.dataframe.loc[simulation_id]
|
|
130
156
|
|
|
131
157
|
# If input_version is not the default, remove "files" from metadata
|
|
132
|
-
|
|
158
|
+
version_is_not_default = (
|
|
159
|
+
input_version
|
|
160
|
+
and input_version != max(metadata.get("DOI_versions", []), default="")
|
|
161
|
+
)
|
|
162
|
+
if version_is_not_default:
|
|
133
163
|
metadata = type(metadata)({
|
|
134
164
|
key: value for key, value in metadata.items() if key != "files"
|
|
135
165
|
})
|
|
@@ -211,26 +241,35 @@ def Simulation(location, *args, **kwargs):
|
|
|
211
241
|
kwargs["deprecated"] = deprecated
|
|
212
242
|
|
|
213
243
|
# We want to do this *after* deprecation checking, to avoid possibly unnecessary web requests
|
|
214
|
-
if
|
|
215
|
-
# The
|
|
216
|
-
|
|
244
|
+
if version_is_not_default:
|
|
245
|
+
# The default metadata points to files with a different version, so delete this info
|
|
246
|
+
if "files" in metadata:
|
|
247
|
+
del metadata["files"]
|
|
217
248
|
files = get_file_info(metadata, sxs_id, download=kwargs.get("download_file_info", None))
|
|
218
249
|
|
|
219
250
|
# If Lev is given as part of `location`, use it; otherwise, use the highest available
|
|
220
|
-
lev_numbers =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
251
|
+
lev_numbers = metadata.get(
|
|
252
|
+
"lev_numbers",
|
|
253
|
+
sorted({lev_num for f in metadata.get("files", []) if (lev_num:=lev_number(f))})
|
|
254
|
+
)
|
|
255
|
+
if not lev_numbers:
|
|
256
|
+
raise ValueError(f"Could not find Levs for {location}")
|
|
257
|
+
if input_lev_number is not None and input_lev_number not in lev_numbers:
|
|
258
|
+
raise ValueError(
|
|
259
|
+
f"Lev number '{input_lev_number}' not found in simulation files for {sxs_id}"
|
|
260
|
+
)
|
|
261
|
+
max_lev_number = max(lev_numbers)
|
|
227
262
|
output_lev_number = input_lev_number or max_lev_number
|
|
263
|
+
if output_lev_number is None:
|
|
264
|
+
raise ValueError(
|
|
265
|
+
f"No Lev number found for {location}"
|
|
266
|
+
)
|
|
228
267
|
location = f"{sxs_id_stem}{version}/Lev{output_lev_number}"
|
|
229
268
|
|
|
230
269
|
# Keep the metadata around unless we're asking for an old version
|
|
231
270
|
# or a less-than-maximal Lev
|
|
232
271
|
if (
|
|
233
|
-
|
|
272
|
+
version_is_not_default
|
|
234
273
|
or (lev_numbers and output_lev_number != max_lev_number)
|
|
235
274
|
):
|
|
236
275
|
metadata = None
|
|
@@ -462,9 +501,9 @@ class SimulationBase:
|
|
|
462
501
|
def metadata_path(self):
|
|
463
502
|
for separator in [":", "/"]:
|
|
464
503
|
for ending in [".json", ".txt"]:
|
|
465
|
-
prefix
|
|
466
|
-
|
|
467
|
-
|
|
504
|
+
for prefix in ["", f"{self.lev}{separator}" if self.lev else ""]:
|
|
505
|
+
if (fn := f"{prefix}metadata{ending}") in self.files:
|
|
506
|
+
return fn
|
|
468
507
|
raise ValueError(
|
|
469
508
|
f"Metadata file not found in simulation files for {self.location}"
|
|
470
509
|
)
|
|
@@ -758,50 +797,29 @@ class Simulation_v1(SimulationBase):
|
|
|
758
797
|
|
|
759
798
|
@property
|
|
760
799
|
def horizons_path(self):
|
|
761
|
-
|
|
762
|
-
return f"{prefix}Horizons.h5"
|
|
763
|
-
|
|
764
|
-
def load_horizons(self):
|
|
765
|
-
from .. import load
|
|
766
|
-
sxs_id_path = Path(self.sxs_id)
|
|
767
|
-
horizons_path = self.horizons_path
|
|
768
|
-
if horizons_path in self.files:
|
|
769
|
-
horizons_location = self.files.get(horizons_path)["link"]
|
|
770
|
-
else:
|
|
771
|
-
# Some simulations used the SXS ID as a prefix in file paths
|
|
772
|
-
# within the Zenodo upload in version 1.x of the catalog.
|
|
773
|
-
if (extended_horizons_path := f"{self.sxs_id_stem}/{horizons_path}") in self.files:
|
|
774
|
-
horizons_location = self.files.get(extended_horizons_path)["link"]
|
|
775
|
-
else:
|
|
776
|
-
raise ValueError(
|
|
777
|
-
f"File '{horizons_path}' not found in simulation files for {self.location}"
|
|
778
|
-
)
|
|
779
|
-
horizons_truepath = Path(sxs_path_to_system_path(sxs_id_path / horizons_path))
|
|
780
|
-
return load(horizons_location, truepath=horizons_truepath)
|
|
800
|
+
return search_prefixes("Horizons.h5", self.lev, self.files)
|
|
781
801
|
|
|
782
802
|
@property
|
|
783
803
|
def strain_path(self):
|
|
784
|
-
prefix = f"{self.lev}/" if self.lev else ""
|
|
785
804
|
extrapolation = (
|
|
786
805
|
f"Extrapolated_{self.extrapolation}.dir"
|
|
787
806
|
if self.extrapolation != "Outer"
|
|
788
807
|
else "OutermostExtraction.dir"
|
|
789
808
|
)
|
|
790
809
|
return (
|
|
791
|
-
|
|
810
|
+
search_prefixes("rhOverM_Asymptotic_GeometricUnits_CoM.h5", self.lev, self.files),
|
|
792
811
|
extrapolation
|
|
793
812
|
)
|
|
794
813
|
|
|
795
814
|
@property
|
|
796
815
|
def psi4_path(self):
|
|
797
|
-
prefix = f"{self.lev}/" if self.lev else ""
|
|
798
816
|
extrapolation = (
|
|
799
817
|
f"Extrapolated_{self.extrapolation}.dir"
|
|
800
818
|
if self.extrapolation != "Outer"
|
|
801
819
|
else "OutermostExtraction.dir"
|
|
802
820
|
)
|
|
803
821
|
return (
|
|
804
|
-
|
|
822
|
+
search_prefixes("rMPsi4_Asymptotic_GeometricUnits_CoM.h5", self.lev, self.files),
|
|
805
823
|
extrapolation
|
|
806
824
|
)
|
|
807
825
|
|
|
@@ -848,14 +866,12 @@ class Simulation_v2(SimulationBase):
|
|
|
848
866
|
|
|
849
867
|
@property
|
|
850
868
|
def horizons_path(self):
|
|
851
|
-
|
|
852
|
-
return f"{prefix}Horizons.h5"
|
|
869
|
+
return search_prefixes("Horizons.h5", self.lev, self.files)
|
|
853
870
|
|
|
854
871
|
@property
|
|
855
872
|
def strain_path(self):
|
|
856
|
-
prefix = f"{self.lev}:" if self.lev else ""
|
|
857
873
|
return (
|
|
858
|
-
f"
|
|
874
|
+
search_prefixes(f"Strain_{self.extrapolation}", self.lev, self.files, ".h5"),
|
|
859
875
|
"/"
|
|
860
876
|
)
|
|
861
877
|
|
|
@@ -866,9 +882,9 @@ class Simulation_v2(SimulationBase):
|
|
|
866
882
|
if self.extrapolation != "Outer"
|
|
867
883
|
else "OutermostExtraction.dir"
|
|
868
884
|
)
|
|
869
|
-
prefix = f"{self.lev}:" if self.
|
|
885
|
+
prefix = f"{self.lev}:" if len(self.lev_numbers)>1 else ""
|
|
870
886
|
return (
|
|
871
|
-
f"
|
|
887
|
+
search_prefixes(f"ExtraWaveforms", self.lev, self.files, ".h5"),
|
|
872
888
|
f"/rMPsi4_Asymptotic_GeometricUnits_CoM_Mem/{extrapolation}"
|
|
873
889
|
)
|
|
874
890
|
|
|
@@ -905,20 +921,18 @@ class Simulation_v3(Simulation_v2):
|
|
|
905
921
|
|
|
906
922
|
@property
|
|
907
923
|
def strain_path(self):
|
|
908
|
-
prefix = f"{self.lev}:" if self.lev else ""
|
|
909
924
|
return (
|
|
910
|
-
f"
|
|
925
|
+
search_prefixes(f"Strain_{self.extrapolation}", self.lev, self.files, ".h5"),
|
|
911
926
|
"/"
|
|
912
927
|
) if self.extrapolation == self.default_extrapolation else (
|
|
913
|
-
|
|
928
|
+
search_prefixes("ExtraWaveforms", self.lev, self.files, ".h5"),
|
|
914
929
|
f"/Strain_{self.extrapolation}.dir"
|
|
915
930
|
)
|
|
916
931
|
|
|
917
932
|
@property
|
|
918
933
|
def psi4_path(self):
|
|
919
|
-
prefix = f"{self.lev}:" if self.lev else ""
|
|
920
934
|
return (
|
|
921
|
-
|
|
935
|
+
search_prefixes("ExtraWaveforms", self.lev, self.files, ".h5"),
|
|
922
936
|
f"/Psi4_{self.extrapolation}.dir"
|
|
923
937
|
)
|
|
924
938
|
|
sxs/utilities/inspire.py
CHANGED
|
@@ -44,7 +44,7 @@ def inspire2doi(inspire_bibtex_key, raise_exceptions=False):
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
def query(
|
|
47
|
-
|
|
47
|
+
query_string,
|
|
48
48
|
sort="mostrecent",
|
|
49
49
|
page=1,
|
|
50
50
|
size=1000,
|
|
@@ -56,7 +56,7 @@ def query(
|
|
|
56
56
|
|
|
57
57
|
Parameters
|
|
58
58
|
----------
|
|
59
|
-
|
|
59
|
+
query_string : str
|
|
60
60
|
The search query. For details, see
|
|
61
61
|
https://github.com/inspirehep/rest-api-doc/tree/master#search-query
|
|
62
62
|
fields : str, optional
|
|
@@ -93,32 +93,37 @@ def query(
|
|
|
93
93
|
|
|
94
94
|
"""
|
|
95
95
|
import sys
|
|
96
|
-
import requests
|
|
97
|
-
from requests.adapters import HTTPAdapter
|
|
98
|
-
from urllib3.util.retry import Retry
|
|
99
96
|
|
|
100
|
-
session
|
|
97
|
+
# Reuse the same session, in case user repeatedly calls query
|
|
98
|
+
if not hasattr(query, "session"):
|
|
99
|
+
import requests
|
|
100
|
+
from requests.adapters import HTTPAdapter
|
|
101
|
+
from urllib3.util.retry import Retry
|
|
102
|
+
|
|
103
|
+
query.session = requests.Session()
|
|
104
|
+
|
|
105
|
+
## Retry automatically on certain types of errors
|
|
106
|
+
retry = Retry(
|
|
107
|
+
total=10,
|
|
108
|
+
backoff_factor=0.1,
|
|
109
|
+
status_forcelist=[
|
|
110
|
+
413, # Request Entity Too Large
|
|
111
|
+
429, # Too Many Requests
|
|
112
|
+
500, # Internal Server Error
|
|
113
|
+
502, # Bad Gateway
|
|
114
|
+
503, # Service Unavailable
|
|
115
|
+
504, # Gateway Timeout
|
|
116
|
+
],
|
|
117
|
+
)
|
|
118
|
+
adapter = HTTPAdapter(max_retries=retry)
|
|
119
|
+
query.session.mount("https://", adapter)
|
|
120
|
+
|
|
121
|
+
session = query.session
|
|
101
122
|
collected_results = []
|
|
102
123
|
|
|
103
|
-
## Retry automatically on certain types of errors
|
|
104
|
-
retry = Retry(
|
|
105
|
-
total=10,
|
|
106
|
-
backoff_factor=0.1,
|
|
107
|
-
status_forcelist=[
|
|
108
|
-
413, # Request Entity Too Large
|
|
109
|
-
429, # Too Many Requests
|
|
110
|
-
500, # Internal Server Error
|
|
111
|
-
502, # Bad Gateway
|
|
112
|
-
503, # Service Unavailable
|
|
113
|
-
504, # Gateway Timeout
|
|
114
|
-
],
|
|
115
|
-
)
|
|
116
|
-
adapter = HTTPAdapter(max_retries=retry)
|
|
117
|
-
session.mount("https://", adapter)
|
|
118
|
-
|
|
119
124
|
url = api_url.format(record_type=record_type)
|
|
120
125
|
params = {
|
|
121
|
-
"q":
|
|
126
|
+
"q": query_string,
|
|
122
127
|
"sort": sort,
|
|
123
128
|
"size": size,
|
|
124
129
|
"page": page,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sxs
|
|
3
|
-
Version: 2025.0.
|
|
3
|
+
Version: 2025.0.7
|
|
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/
|
|
@@ -47,7 +47,7 @@ Requires-Dist: quaternionic>=1.0.15
|
|
|
47
47
|
Requires-Dist: requests>=2.24.0
|
|
48
48
|
Requires-Dist: scipy>=1.13
|
|
49
49
|
Requires-Dist: spherical>=1.0.15
|
|
50
|
-
Requires-Dist: sxscatalog>=3.0.
|
|
50
|
+
Requires-Dist: sxscatalog>=3.0.13
|
|
51
51
|
Requires-Dist: tqdm>=4.63.1
|
|
52
52
|
Requires-Dist: urllib3>=1.25.10
|
|
53
53
|
Provides-Extra: docs
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sxs/__init__.py,sha256=8PntABL6yx7Ad70hP7WedNAVDTZiwm_2At5xIQGo4k8,2610
|
|
2
|
-
sxs/__version__.py,sha256=
|
|
2
|
+
sxs/__version__.py,sha256=Sb83Pr0X5dxDLb6m-eW2IPmwgSbc6jBC6oTrW8sZwRE,25
|
|
3
3
|
sxs/handlers.py,sha256=jVV-HK-omzoBx5N2wcpLHvyoWq86hUfWCjnGbPpD91I,18343
|
|
4
4
|
sxs/juliapkg.json,sha256=-baaa3Za_KBmmiGjlh2YYLWmvUvZl6GaKKXwNI4S7qU,178
|
|
5
5
|
sxs/time_series.py,sha256=OKaLg8tFyrtKcef7900ri-a0C6A8wKxA68KovZXvH6I,41081
|
|
@@ -18,7 +18,7 @@ sxs/metadata/metric.py,sha256=Tsig1Jm50OO8r89zfjCuQ4i3JAoiazSb4J9qYtPWKgM,41
|
|
|
18
18
|
sxs/simulations/__init__.py,sha256=eXkheYhRaYyKjul5J1IXpoJ7Wq4nr3Tgwr-HSS3BTek,156
|
|
19
19
|
sxs/simulations/analyze.py,sha256=RaImREx3fWlXgJRCI-Wsq0-LjidL-Mb8SIN3-n-TMqM,10373
|
|
20
20
|
sxs/simulations/local.py,sha256=e77SeaWMl2PWX_EndQtShOXZxcFKhQsUDQ55R2Njcuc,43
|
|
21
|
-
sxs/simulations/simulation.py,sha256=
|
|
21
|
+
sxs/simulations/simulation.py,sha256=tzI1s15mU1CDdst7XZRD4UehtbkRvIao16ONTAA0zfI,42353
|
|
22
22
|
sxs/simulations/simulations.py,sha256=sMle89VoD1CQni1N23Vjo3h2yj9LHHAtuaB_qfD3Wgg,109
|
|
23
23
|
sxs/utilities/__init__.py,sha256=WSStlqljfgQheMxHGfuofSc5LdmASGvO3FNO3f_zaT0,4806
|
|
24
24
|
sxs/utilities/bitwise.py,sha256=G9ZNYgwDQRhq5wbDf-p2HcUqkEP_IRDiQoXW4KyU17k,13205
|
|
@@ -26,7 +26,7 @@ sxs/utilities/dicts.py,sha256=CCpm3upG_9SRj9gjawukSUfaJ5asF-XRG2ausEXhYyg,695
|
|
|
26
26
|
sxs/utilities/downloads.py,sha256=dgQvlpY3DffDX1HrmISb6iThuuIDt9BAPbgXFBrh2PQ,116
|
|
27
27
|
sxs/utilities/files.py,sha256=l7SNOg0ikgqXV3bmPJdXZQMQ_XPGXVUsIJIOjDVp3Mg,4517
|
|
28
28
|
sxs/utilities/formats.py,sha256=EekLcSi-fhFdkPT7R9h10d9_0gZH4EomH5-RVQp-sg8,3867
|
|
29
|
-
sxs/utilities/inspire.py,sha256=
|
|
29
|
+
sxs/utilities/inspire.py,sha256=Q_N0W3Ta37lpihoF3nbBOFCmVHzmp4CAPuW0YapROGw,5541
|
|
30
30
|
sxs/utilities/monotonicity.py,sha256=YVwj3Tjew8dkpJJ9TReyuISD2ul5HJfkEJgCoiLru5Q,812
|
|
31
31
|
sxs/utilities/pretty_print.py,sha256=ZDHR3uvkzQ3Whk_eIp3BB7Abh796nqyrVsQRa68zgGc,1473
|
|
32
32
|
sxs/utilities/select.py,sha256=UgoEQIvkm8NBe6sD5O2gK0g9Pep-xvWoYQ3b7RxI-Ww,6727
|
|
@@ -82,7 +82,7 @@ sxs/zenodo/api/__init__.py,sha256=EM_eh4Q8R5E0vIfMhyIR1IYFfOBu6vA0UTasgX9gHys,21
|
|
|
82
82
|
sxs/zenodo/api/deposit.py,sha256=J4RGvGjh0cEOrN4bBZWEDcPAhNscqB2fzLlvRZ5HTHM,36948
|
|
83
83
|
sxs/zenodo/api/login.py,sha256=Yz0ytgi81_5BpDzhrS0WPMXlvU2qUaCK8yn8zxfEbko,18007
|
|
84
84
|
sxs/zenodo/api/records.py,sha256=nKkhoHZ95CTztHF9Zzaug5p7IiUCJG4Em1i-l-WqH6U,3689
|
|
85
|
-
sxs-2025.0.
|
|
86
|
-
sxs-2025.0.
|
|
87
|
-
sxs-2025.0.
|
|
88
|
-
sxs-2025.0.
|
|
85
|
+
sxs-2025.0.7.dist-info/METADATA,sha256=7S6sizUf1CMLH-B7rsbjpX1rbYTeeJ-0FlClcR07ct0,9311
|
|
86
|
+
sxs-2025.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
87
|
+
sxs-2025.0.7.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
|
|
88
|
+
sxs-2025.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|