sxs 2024.0.33__py3-none-any.whl → 2024.0.34__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.33"
1
+ __version__ = "2024.0.34"
sxs/simulations/local.py CHANGED
@@ -65,7 +65,7 @@ def extract_id_from_common_metadata(file, annex_dir):
65
65
  return key
66
66
 
67
67
 
68
- def local_simulations(annex_dir, compute_md5=False):
68
+ def local_simulations(annex_dir, compute_md5=False, show_progress=False):
69
69
  """
70
70
  Walk the annex directory to find and process all simulations
71
71
 
@@ -91,6 +91,8 @@ def local_simulations(annex_dir, compute_md5=False):
91
91
  compute_md5 : bool, optional
92
92
  Whether to compute the MD5 hash of each file. Default is
93
93
  False.
94
+ show_progress : bool, optional
95
+ Whether to show a progress bar. Default is False.
94
96
 
95
97
  Returns
96
98
  -------
@@ -99,10 +101,24 @@ def local_simulations(annex_dir, compute_md5=False):
99
101
  """
100
102
  from os import walk
101
103
  from ..utilities import md5checksum
104
+ from tqdm import tqdm
102
105
 
103
106
  simulations = {}
104
107
  annex_dir = Path(annex_dir).resolve()
105
108
 
109
+ if show_progress: # Count the number of common-metadata.txt files
110
+ num_files = 0
111
+ for dirpath, dirnames, filenames in walk(annex_dir, topdown=True):
112
+ if Path(dirpath).name.startswith("."):
113
+ dirnames[:] = []
114
+ continue
115
+ if "common-metadata.txt" in filenames:
116
+ if not any(d.startswith("Lev") for d in dirnames):
117
+ continue
118
+ num_files += 1
119
+ dirnames[:] = []
120
+ progress_bar = tqdm(total=num_files, desc="Processing simulations")
121
+
106
122
  # The `walk` method can be made *much* faster than the `glob` method
107
123
  for dirpath, dirnames, filenames in walk(annex_dir, topdown=True):
108
124
  dirpath = Path(dirpath)
@@ -116,6 +132,9 @@ def local_simulations(annex_dir, compute_md5=False):
116
132
  if not any(d.startswith("Lev") for d in dirnames):
117
133
  continue
118
134
 
135
+ if show_progress:
136
+ progress_bar.update(1)
137
+
119
138
  key = extract_id_from_common_metadata(dirpath / "common-metadata.txt", annex_dir)
120
139
 
121
140
  # Find the highest Lev directory and extract the metadata
@@ -143,13 +162,12 @@ def local_simulations(annex_dir, compute_md5=False):
143
162
  return simulations
144
163
 
145
164
 
146
- def write_local_simulations(annex_dir, output_file=None):
165
+ def write_local_simulations(annex_dir, output_file=None, compute_md5=False, show_progress=False):
147
166
  """Write the local simulations to a file for use when loading `Simulations`
148
167
 
149
168
  This function calls `local_simulations` to obtain the dictionary,
150
169
  but also writes the dictionary to a JSON file.
151
170
 
152
-
153
171
  Parameters
154
172
  ----------
155
173
  annex_dir : (str or Path)
@@ -159,6 +177,11 @@ def write_local_simulations(annex_dir, output_file=None):
159
177
  written to `sxs_directory("cache") / "local_simulations.json"`.
160
178
  N.B.: If you specify a different file, `sxs.load` will not
161
179
  automatically find it.
180
+ compute_md5 : bool, optional
181
+ Whether to compute the MD5 hash of each file. Default is
182
+ False.
183
+ show_progress : bool, optional
184
+ Whether to show a progress bar. Default is False.
162
185
 
163
186
  Returns
164
187
  -------
@@ -168,7 +191,7 @@ def write_local_simulations(annex_dir, output_file=None):
168
191
  from json import dump
169
192
 
170
193
  # Process the annex directory to find all simulations
171
- simulations = local_simulations(annex_dir)
194
+ simulations = local_simulations(annex_dir, compute_md5=compute_md5, show_progress=show_progress)
172
195
 
173
196
  # Write the simulations to file
174
197
  if output_file is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sxs
3
- Version: 2024.0.33
3
+ Version: 2024.0.34
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=1aAfFJkJXDhyQxvB5A7JGzfK5gLev3uJrAgjXgoxXkA,26
2
+ sxs/__version__.py,sha256=_cjLIU-5BZ9McQVaMqAHxQtb0C2QCB3z4_ZhWhK4Bzs,26
3
3
  sxs/handlers.py,sha256=Nc1_aDKm_wDHg2cITI_ljbqU4VRWpwQ7fdgy3c1XcE8,17531
4
4
  sxs/juliapkg.json,sha256=-baaa3Za_KBmmiGjlh2YYLWmvUvZl6GaKKXwNI4S7qU,178
5
5
  sxs/time_series.py,sha256=OKaLg8tFyrtKcef7900ri-a0C6A8wKxA68KovZXvH6I,41081
@@ -18,7 +18,7 @@ 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=EEax1WTKL4G5U__wHefbBX0l4vtIHTcYFnHwziGkVhM,28348
20
20
  sxs/simulations/__init__.py,sha256=GrZym0PHTULDg_hyFmISNzDfqVLz_hQo-djbgecZs54,134
21
- sxs/simulations/local.py,sha256=51ULBmrodAPZXv2_qpLeEWKIR9zwPGR-zPt7XG8Vcqs,6403
21
+ sxs/simulations/local.py,sha256=A2r2tzD8ZMKfuKPlTuKYu60nRkxnnohfeFKNoZVfLHg,7480
22
22
  sxs/simulations/simulation.py,sha256=OqQh6xq-s_JoQI6e2XA5j194L0DT3HGYIW8ZZiurZ2Y,34631
23
23
  sxs/simulations/simulations.py,sha256=ATxrcihvblGgRHdR7vIMg5eKghN5Jo6U0CafTro4wYA,24827
24
24
  sxs/utilities/__init__.py,sha256=WSStlqljfgQheMxHGfuofSc5LdmASGvO3FNO3f_zaT0,4806
@@ -80,7 +80,7 @@ sxs/zenodo/api/__init__.py,sha256=EM_eh4Q8R5E0vIfMhyIR1IYFfOBu6vA0UTasgX9gHys,21
80
80
  sxs/zenodo/api/deposit.py,sha256=J4RGvGjh0cEOrN4bBZWEDcPAhNscqB2fzLlvRZ5HTHM,36948
81
81
  sxs/zenodo/api/login.py,sha256=Yz0ytgi81_5BpDzhrS0WPMXlvU2qUaCK8yn8zxfEbko,18007
82
82
  sxs/zenodo/api/records.py,sha256=nKkhoHZ95CTztHF9Zzaug5p7IiUCJG4Em1i-l-WqH6U,3689
83
- sxs-2024.0.33.dist-info/METADATA,sha256=agwAnGwVuDDEI52_MS-8kMT1aX7c6Ps-E5SWq0l6kYE,9253
84
- sxs-2024.0.33.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
85
- sxs-2024.0.33.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
86
- sxs-2024.0.33.dist-info/RECORD,,
83
+ sxs-2024.0.34.dist-info/METADATA,sha256=6YToh2veoD4_MPLzTwoiXOy0xYueasdvjDGhjTRbHVc,9253
84
+ sxs-2024.0.34.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
85
+ sxs-2024.0.34.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
86
+ sxs-2024.0.34.dist-info/RECORD,,