sxs 2024.0.44__py3-none-any.whl → 2025.0.2__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/__init__.py CHANGED
@@ -28,7 +28,7 @@ from .waveforms import WaveformModes, WaveformModesDict, to_lvc_conventions #, W
28
28
  from .waveforms import rotating_paired_xor_multishuffle_bzip2 as rpxmb
29
29
  from .waveforms import rotating_paired_diff_multishuffle_bzip2 as rpdmb
30
30
  from .waveforms import spectre_cce_v1
31
- from . import catalog, metadata, horizons, waveforms, zenodo, caltechdata
31
+ from . import catalog, metadata, horizons, waveforms, zenodo
32
32
  from .simulations import Simulation, Simulations, write_local_simulations, local_simulations
33
33
  from .handlers import load, load_via_sxs_id, loadcontext, load_lvc
34
34
 
sxs/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2024.0.44"
1
+ __version__ = "2025.0.2"
sxs/handlers.py CHANGED
@@ -1,6 +1,7 @@
1
1
  """Functions to facilitate generic handling of SXS-format data files"""
2
2
 
3
3
  import contextlib
4
+ import sxscatalog
4
5
  from . import waveforms, doi_url
5
6
 
6
7
 
@@ -236,7 +237,7 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
236
237
  import pathlib
237
238
  import urllib.request
238
239
  from . import Simulations, Simulation, read_config, sxs_directory, Catalog
239
- from .utilities import url, download_file, sxs_path_to_system_path, sxs_id_version_lev_exact_re, lev_path_re
240
+ from .utilities import url, download_file, sxs_path_to_system_path, sxs_id_version_lev_exact_re, lev_path_re, sxs_identifier_re
240
241
 
241
242
  # Note: `download` and/or `cache` may still be `None` after this
242
243
  if download is None:
@@ -280,25 +281,8 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
280
281
  elif location == "catalog":
281
282
  return Catalog.load(download=download)
282
283
 
283
- elif location == "simulations":
284
- return Simulations.load(
285
- download=download,
286
- local=kwargs.get("local", False),
287
- annex_dir=kwargs.get("annex_dir", None),
288
- output_file=kwargs.get("output_file", None),
289
- compute_md5=kwargs.get("compute_md5", False),
290
- show_progress=kwargs.get("show_progress", False)
291
- )
292
-
293
- elif location == "dataframe":
294
- return Simulations.load(
295
- download=download,
296
- local=kwargs.get("local", False),
297
- annex_dir=kwargs.get("annex_dir", None),
298
- output_file=kwargs.get("output_file", None),
299
- compute_md5=kwargs.get("compute_md5", False),
300
- show_progress=kwargs.get("show_progress", False)
301
- ).dataframe
284
+ elif location in ["simulations", "dataframe"]:
285
+ return sxscatalog.load(location, download=download, **kwargs)
302
286
 
303
287
  elif sxs_id_version_lev_exact_re.match(location):
304
288
  return Simulation(location, download=download, cache=cache, progress=progress, **kwargs)
@@ -310,11 +294,30 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
310
294
  local=kwargs.get("local", False),
311
295
  annex_dir=kwargs.get("annex_dir", None)
312
296
  )
297
+ # If we chop off any "/LevN", and it's in the simulations, load it as a simulation
313
298
  if lev_path_re.sub("", location) in simulations:
314
299
  return Simulation(
315
300
  location, download=download, cache=cache, progress=progress, **kwargs
316
301
  )
317
302
 
303
+ # Now we look for a file in `simulations`
304
+ if sxs_identifier_re.match(location):
305
+ split_location = sxs_identifier_re.split(location)
306
+ # Currently we can only handle unversioned SXS ID files
307
+ if split_location[5] is None:
308
+ sxs_id = split_location[1]
309
+ file = split_location[-1].lstrip("/").lstrip("\\")
310
+ if sxs_id in simulations:
311
+ simulation = simulations[sxs_id]
312
+ if "files" in simulation:
313
+ file_info = simulation["files"][file]
314
+ location = file_info["link"]
315
+ truepath = truepath or (pathlib.Path(sxs_id) / file)
316
+ return load(
317
+ location, truepath=truepath,
318
+ download=download, cache=cache, progress=progress, **kwargs
319
+ )
320
+
318
321
  # Try to find an appropriate SXS file in the catalog
319
322
  catalog = Catalog.load(download=download)
320
323
  selections = catalog.select_files(location)
sxs/metadata/__init__.py CHANGED
@@ -1,10 +1,2 @@
1
1
  """Interface to SXS metadata files"""
2
-
3
- from .metadata import Metadata
4
- from .metric import MetadataMetric
5
-
6
- formats = {
7
- None: Metadata,
8
- "": Metadata,
9
- "metadata": Metadata,
10
- }
2
+ from sxscatalog.metadata import *