sxs 2024.0.42__py3-none-any.whl → 2024.0.44__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.42"
1
+ __version__ = "2024.0.44"
sxs/handlers.py CHANGED
@@ -284,14 +284,20 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
284
284
  return Simulations.load(
285
285
  download=download,
286
286
  local=kwargs.get("local", False),
287
- annex_dir=kwargs.get("annex_dir", None)
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)
288
291
  )
289
292
 
290
293
  elif location == "dataframe":
291
294
  return Simulations.load(
292
295
  download=download,
293
296
  local=kwargs.get("local", False),
294
- annex_dir=kwargs.get("annex_dir", None)
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)
295
301
  ).dataframe
296
302
 
297
303
  elif sxs_id_version_lev_exact_re.match(location):
sxs/simulations/local.py CHANGED
@@ -215,12 +215,13 @@ def write_local_simulations(annex_dir, output_file=None, compute_md5=False, show
215
215
  simulations = local_simulations(annex_dir, compute_md5=compute_md5, show_progress=show_progress)
216
216
 
217
217
  # Write the simulations to file
218
- if output_file is None:
219
- output_file = sxs_directory("cache") / "local_simulations.json"
220
- else:
221
- output_file = Path(output_file)
222
- output_file.parent.mkdir(parents=True, exist_ok=True)
223
- with output_file.open("w") as f:
224
- dump(simulations, f, indent=2, separators=(",", ": "), ensure_ascii=True)
218
+ if output_file is not False: # Test literal identity to allow `None`
219
+ if output_file is None:
220
+ output_file = sxs_directory("cache") / "local_simulations.json"
221
+ else:
222
+ output_file = Path(output_file)
223
+ output_file.parent.mkdir(parents=True, exist_ok=True)
224
+ with output_file.open("w") as f:
225
+ dump(simulations, f, indent=2, separators=(",", ": "), ensure_ascii=True)
225
226
 
226
227
  return simulations
@@ -173,7 +173,7 @@ class Simulations(collections.OrderedDict):
173
173
  return remote_timestamp
174
174
 
175
175
  @classmethod
176
- def local(cls, directory=None, *, download=None):
176
+ def local(cls, directory=None, *, download=None, output_file=None, compute_md5=False, show_progress=False):
177
177
  """Load the local catalog of SXS simulations
178
178
 
179
179
  This function loads the standard public catalog, but also
@@ -192,30 +192,47 @@ class Simulations(collections.OrderedDict):
192
192
  download : {None, bool}, optional
193
193
  Passed to `Simulations.load` when loading the public set
194
194
  of simulations.
195
+ output_file : {None, str, Path}, optional
196
+ If `directory` is not None, this will be passed to
197
+ `sxs.write_local_simulations`.
198
+ compute_md5 : bool, optional
199
+ If `directory` is not None, this will be passed to
200
+ `sxs.local_simulations`.
201
+ show_progress : bool, optional
202
+ If `directory` is not None, this will be passed to
203
+ `sxs.local_simulations`.
195
204
 
196
205
  See Also
197
206
  --------
198
207
  sxs.local_simulations : Search for local simulations
199
- sxs.write_local_simulations : Write local simulations to a file
208
+ sxs.write_local_simulations : Write local simulations to a
209
+ file
200
210
 
201
211
  """
202
212
  import json
203
213
  from .local import write_local_simulations
204
214
  from .. import sxs_directory
205
215
 
206
- local_path = sxs_directory("cache") / "local_simulations.json"
207
216
  if directory is not None:
208
- write_local_simulations(directory)
209
- if not local_path.exists():
210
- if directory is not None:
211
- raise ValueError(f"Writing local simulations for {directory=} failed")
212
- else:
213
- raise ValueError(
214
- f"Local simulations file not found, but no `directory` was provided.\n"
215
- + "If called from `sxs.load`, just pass the name of the directory."
216
- )
217
- with local_path.open("r") as f:
218
- local_simulations = json.load(f)
217
+ local_path = output_file
218
+ local_simulations = write_local_simulations(
219
+ directory,
220
+ output_file=output_file,
221
+ compute_md5=compute_md5,
222
+ show_progress=show_progress
223
+ )
224
+ else:
225
+ local_path = sxs_directory("cache") / "local_simulations.json"
226
+ if not local_path.exists():
227
+ if directory is not None:
228
+ raise ValueError(f"Writing local simulations for {directory=} failed")
229
+ else:
230
+ raise ValueError(
231
+ f"Local simulations file not found, but no `directory` was provided.\n"
232
+ + "If called from `sxs.load`, just pass the name of the directory."
233
+ )
234
+ with local_path.open("r") as f:
235
+ local_simulations = json.load(f)
219
236
  simulations = cls.load(download)
220
237
  doi_versions = {
221
238
  k: v["DOI_versions"]
@@ -229,7 +246,7 @@ class Simulations(collections.OrderedDict):
229
246
  return simulations
230
247
 
231
248
  @classmethod
232
- def load(cls, download=None, *, local=False, annex_dir=None):
249
+ def load(cls, download=None, *, local=False, annex_dir=None, output_file=None, compute_md5=False, show_progress=False):
233
250
  """Load the catalog of SXS simulations
234
251
 
235
252
  Note that — unlike most SXS data files — the simulations file
@@ -263,6 +280,15 @@ class Simulations(collections.OrderedDict):
263
280
  If provided and `local=True`, this function will load
264
281
  local simulations from the given directory. This is
265
282
  equivalent to calling `Simulations.local(directory)`.
283
+ output_file : {None, str, Path}, optional
284
+ If `annex_dir` is not None, this will be passed to
285
+ `sxs.write_local_simulations`.
286
+ compute_md5 : bool, optional
287
+ If `annex_dir` is not None, this will be passed to
288
+ `sxs.simulations.local_simulations`.
289
+ show_progress : bool, optional
290
+ If `annex_dir` is not None, this will be passed to
291
+ `sxs.simulations.local_simulations`.
266
292
 
267
293
  See Also
268
294
  --------
@@ -280,7 +306,13 @@ class Simulations(collections.OrderedDict):
280
306
  return cls._simulations
281
307
 
282
308
  if local or annex_dir is not None:
283
- cls._simulations = cls.local(annex_dir, download=download)
309
+ cls._simulations = cls.local(
310
+ annex_dir,
311
+ download=download,
312
+ output_file=output_file,
313
+ compute_md5=compute_md5,
314
+ show_progress=show_progress
315
+ )
284
316
  return cls._simulations
285
317
 
286
318
  progress = read_config("download_progress", True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sxs
3
- Version: 2024.0.42
3
+ Version: 2024.0.44
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=ottZ66pDpZJXsL9jK_3ggKCu87Pdr1LjtjI0B6EzUkI,26
3
- sxs/handlers.py,sha256=Nc1_aDKm_wDHg2cITI_ljbqU4VRWpwQ7fdgy3c1XcE8,17531
2
+ sxs/__version__.py,sha256=VkT9SDxmqx5TY0atB540yqsbLb0xRC7qK2gKY9KwH-8,26
3
+ sxs/handlers.py,sha256=Lu3rY7jHn3jEwnUDHVZgZIv1-3AAPAXD61baZAO49a8,17909
4
4
  sxs/juliapkg.json,sha256=-baaa3Za_KBmmiGjlh2YYLWmvUvZl6GaKKXwNI4S7qU,178
5
5
  sxs/time_series.py,sha256=OKaLg8tFyrtKcef7900ri-a0C6A8wKxA68KovZXvH6I,41081
6
6
  sxs/caltechdata/__init__.py,sha256=pvyc2Djch4DA6t06op-0NSTegrMSywzNi7Z3W_91-Cg,14670
@@ -19,9 +19,9 @@ sxs/metadata/__init__.py,sha256=jz0A3sBYQoNVZ5sdHv6LgI6y4kP2051-esCR62xt6bM,184
19
19
  sxs/metadata/metadata.py,sha256=vqzNufg46BrbFAuvDF55JvrQc0ZIBxSG4eH2awv5PDs,28610
20
20
  sxs/metadata/metric.py,sha256=W_PMNmsJ2qBjIeAll4TgUz79-SZkiBTswTfK4gKWrPU,6785
21
21
  sxs/simulations/__init__.py,sha256=GrZym0PHTULDg_hyFmISNzDfqVLz_hQo-djbgecZs54,134
22
- sxs/simulations/local.py,sha256=kyFvlw9CywlyBy0H2GiSgOp4M7Uq31Db5LIdd2do43M,8242
22
+ sxs/simulations/local.py,sha256=nfca2cG3LWNC8Jc-i79BZmKdwPfhPgPKja-wXg_qEKw,8344
23
23
  sxs/simulations/simulation.py,sha256=lVA2aSRy4-V1-1bFE74zIN8Tpvf7QDtn9n7xmR7oqcU,37579
24
- sxs/simulations/simulations.py,sha256=xP1ljseDSkfs6_u25-DnSNlFQtQexiP25Kwtm7nWdsE,23910
24
+ sxs/simulations/simulations.py,sha256=5OYQez3BXtg8zbCe85MlSqYtAKv4UqXt7iRfLiPAWxw,25367
25
25
  sxs/utilities/__init__.py,sha256=WSStlqljfgQheMxHGfuofSc5LdmASGvO3FNO3f_zaT0,4806
26
26
  sxs/utilities/bitwise.py,sha256=G9ZNYgwDQRhq5wbDf-p2HcUqkEP_IRDiQoXW4KyU17k,13205
27
27
  sxs/utilities/dicts.py,sha256=CCpm3upG_9SRj9gjawukSUfaJ5asF-XRG2ausEXhYyg,695
@@ -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-2024.0.42.dist-info/METADATA,sha256=46jHQPJbcRe8xSeA1qul7zXbf0_11yfOJO5l1v0Dd2s,9253
86
- sxs-2024.0.42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
87
- sxs-2024.0.42.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
88
- sxs-2024.0.42.dist-info/RECORD,,
85
+ sxs-2024.0.44.dist-info/METADATA,sha256=T73d-Ee58PLzfKUG8mM4fBxZ_r3C3mFQAB-oP-fS8rk,9253
86
+ sxs-2024.0.44.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
87
+ sxs-2024.0.44.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
88
+ sxs-2024.0.44.dist-info/RECORD,,