sxs 2024.0.14__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "2024.0.14"
1
+ __version__ = "2024.0.15"
@@ -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
- raise ValueError(f"Invalid SXS ID in '{simulation_id}'")
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
- # Load the simulation catalog and check if simulation ID exists in the catalog
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
  )
@@ -174,8 +174,7 @@ class Simulations(collections.OrderedDict):
174
174
  return simulations
175
175
 
176
176
  @classmethod
177
- @functools.lru_cache()
178
- def load(cls, download=None):
177
+ def load(cls, download=None, *, local=False):
179
178
  """Load the catalog of SXS simulations
180
179
 
181
180
  Note that — unlike most SXS data files — the simulations file is updated
@@ -195,6 +194,12 @@ class Simulations(collections.OrderedDict):
195
194
  if that fails, and only raise an error if the simulations is not found in the
196
195
  cache. Note that this ignores the sxs configuration file entirely.
197
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
+
198
203
  See Also
199
204
  --------
200
205
  sxs.sxs_directory : Locate cache directory
@@ -207,6 +212,13 @@ class Simulations(collections.OrderedDict):
207
212
  from .. import sxs_directory, read_config
208
213
  from ..utilities import download_file
209
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
+
210
222
  progress = read_config("download_progress", True)
211
223
 
212
224
  remote_timestamp = cls.remote_timestamp(download is not False) # Test for literal `False`
@@ -268,6 +280,8 @@ class Simulations(collections.OrderedDict):
268
280
 
269
281
  sims = cls(simulations)
270
282
  sims.__file__ = str(cache_path)
283
+
284
+ cls._simulations = sims
271
285
  return sims
272
286
 
273
287
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sxs
3
- Version: 2024.0.14
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,5 +1,5 @@
1
1
  sxs/__init__.py,sha256=hbydsXWR88sFiKExPJ1NHWGEvWRbbJBjSc1irSMYKgY,2623
2
- sxs/__version__.py,sha256=vdCUhZemn99E8FoC13JF2FXz3SWQuB-IUxT4uez_vj8,26
2
+ sxs/__version__.py,sha256=BGqJJdNZR4le1Z34PSJ09M4Ey3xZUp0qPiEiOTKJjOw,26
3
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
@@ -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=WgxvZexjBH9fwd5qKID7YwvA1wglHerXwS_VQT1LlkY,33915
23
- sxs/simulations/simulations.py,sha256=orsogZOyktC5EiY2U4HzHlF_evMKT5du7t6s6jGphSk,21132
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.14.dist-info/METADATA,sha256=KttQT3Xa2eCymq08LJ5S0oXqQj_S1f8W2gfDNwJgqGc,9245
83
- sxs-2024.0.14.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
84
- sxs-2024.0.14.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
85
- sxs-2024.0.14.dist-info/RECORD,,
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,,