sxs 2024.0.10__py3-none-any.whl → 2024.0.12__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 +3 -2
- sxs/__version__.py +1 -1
- sxs/simulations/local.py +147 -0
- sxs/simulations/simulation.py +2 -2
- {sxs-2024.0.10.dist-info → sxs-2024.0.12.dist-info}/METADATA +2 -2
- {sxs-2024.0.10.dist-info → sxs-2024.0.12.dist-info}/RECORD +8 -7
- {sxs-2024.0.10.dist-info → sxs-2024.0.12.dist-info}/WHEEL +0 -0
- {sxs-2024.0.10.dist-info → sxs-2024.0.12.dist-info}/licenses/LICENSE +0 -0
sxs/__init__.py
CHANGED
|
@@ -43,8 +43,9 @@ astronomical_unit = 149_597_870_700.0 # m
|
|
|
43
43
|
parsec_in_meters = 3.0856775814913672789139379577965e16 # m
|
|
44
44
|
|
|
45
45
|
# The value of the solar mass parameter G*M_sun is known to higher accuracy than either of its
|
|
46
|
-
# factors. The value here is taken from the
|
|
47
|
-
#
|
|
46
|
+
# factors. The value here is taken from the IAU Division I Working Group's publication on
|
|
47
|
+
# "Numerical Standards for Fundamental Astronomy"
|
|
48
|
+
# <https://iau-a3.gitlab.io/NSFA/NSFA_cbe.html#GMS2012>.
|
|
48
49
|
# In the TDB (Barycentric Dynamical Time) time scale — which seems to be the more relevant one and
|
|
49
50
|
# looks like the more standard one for LIGO — we have
|
|
50
51
|
solar_mass_parameter = 1.32712440041e20 # m^3/s^2
|
sxs/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2024.0.
|
|
1
|
+
__version__ = "2024.0.12"
|
sxs/simulations/local.py
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from .. import sxs_id, Metadata, sxs_directory
|
|
3
|
+
from ..utilities import sxs_identifier_re
|
|
4
|
+
from ..zenodo import path_to_invenio as p2i
|
|
5
|
+
|
|
6
|
+
def file_upload_allowed(file, directory_listing):
|
|
7
|
+
"""Return True if the file should be uploaded
|
|
8
|
+
|
|
9
|
+
A file should be uploaded if
|
|
10
|
+
* it is named "metadata.json" or "Horizons.h5"
|
|
11
|
+
* it is named "Strain_*.json" or "ExtraWaveforms.json" and the corresponding
|
|
12
|
+
".h5" file is in the directory listing
|
|
13
|
+
* it is named "Strain_*.h5" or "ExtraWaveforms.h5" and the corresponding
|
|
14
|
+
".json" file is in the directory listing
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
# Check `file.name` to ignore the directory
|
|
18
|
+
if file.name in ["metadata.json", "Horizons.h5"]:
|
|
19
|
+
return True
|
|
20
|
+
if file.name.startswith("Strain_") or file.name.startswith("ExtraWaveforms"):
|
|
21
|
+
# Ensure that both `.h5` and `.json` exist for all such files
|
|
22
|
+
if file.suffix == ".json":
|
|
23
|
+
return file.with_suffix(".h5") in directory_listing
|
|
24
|
+
elif file.suffix == ".h5":
|
|
25
|
+
return file.with_suffix(".json") in directory_listing
|
|
26
|
+
else:
|
|
27
|
+
return False
|
|
28
|
+
return False
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def files_to_upload(directory, annex_dir="."):
|
|
32
|
+
"""Return a list of files to upload
|
|
33
|
+
|
|
34
|
+
The files to upload are those that are in the directory listing
|
|
35
|
+
and pass the `file_upload_allowed` function.
|
|
36
|
+
|
|
37
|
+
"""
|
|
38
|
+
full_directory = annex_dir / Path(directory)
|
|
39
|
+
files = []
|
|
40
|
+
for lev in full_directory.resolve().glob("Lev*"):
|
|
41
|
+
directory_listing = list(lev.iterdir())
|
|
42
|
+
files.extend([
|
|
43
|
+
file for file in directory_listing
|
|
44
|
+
if file_upload_allowed(file, directory_listing)
|
|
45
|
+
])
|
|
46
|
+
return sorted(files, key=lambda x: str(x).lower())
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def extract_id_from_common_metadata(file, annex_dir):
|
|
50
|
+
"""Extract the SXS ID from a common-metadata.txt file
|
|
51
|
+
|
|
52
|
+
If the ID doesn't exist, return the directory path, relative to
|
|
53
|
+
the `annex_dir`.
|
|
54
|
+
"""
|
|
55
|
+
file = Path(file)
|
|
56
|
+
annex_dir = Path(annex_dir)
|
|
57
|
+
key = str(file.resolve().parent.relative_to(annex_dir.resolve()))
|
|
58
|
+
with file.open("r") as f:
|
|
59
|
+
for line in f.readlines():
|
|
60
|
+
line = line.strip()
|
|
61
|
+
if "alternative-names" in line:
|
|
62
|
+
if (m := sxs_identifier_re.search(line)):
|
|
63
|
+
key = m["sxs_identifier"]
|
|
64
|
+
break
|
|
65
|
+
return key
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def local_simulations(annex_dir):
|
|
69
|
+
"""
|
|
70
|
+
Walk the annex directory to find and process all simulations
|
|
71
|
+
|
|
72
|
+
For each `common-metadata.txt` file found:
|
|
73
|
+
- Ensures that at least one directory starting with "Lev"
|
|
74
|
+
exists; if not, the process is skipped.
|
|
75
|
+
- Defines a key for the metadata, which is either:
|
|
76
|
+
- The SXS ID contained in that file's "alternative-names"
|
|
77
|
+
field, if present.
|
|
78
|
+
- The directory path relative to `annex_dir`.
|
|
79
|
+
- Chooses the highest "Lev" directory and extracts the
|
|
80
|
+
metadata.
|
|
81
|
+
- Finds all files to upload in the directory; if none are
|
|
82
|
+
found, the process is skipped.
|
|
83
|
+
- Adds the "files" dictionary to the metadata, pointing to
|
|
84
|
+
each file that would be uploaded if the simulation were
|
|
85
|
+
published.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
annex_dir (str or Path): The path to the annex directory to be
|
|
89
|
+
processed.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
dict: A dictionary containing the processed simulations
|
|
93
|
+
metadata.
|
|
94
|
+
"""
|
|
95
|
+
from os import walk
|
|
96
|
+
|
|
97
|
+
simulations = {}
|
|
98
|
+
annex_dir = Path(annex_dir).resolve()
|
|
99
|
+
|
|
100
|
+
# The `walk` method can be made *much* faster than the `glob` method
|
|
101
|
+
for dirpath, dirnames, filenames in walk(annex_dir, topdown=True):
|
|
102
|
+
dirpath = Path(dirpath)
|
|
103
|
+
|
|
104
|
+
# Ignore hidden directories
|
|
105
|
+
if dirpath.name.startswith("."):
|
|
106
|
+
dirnames[:] = []
|
|
107
|
+
continue
|
|
108
|
+
|
|
109
|
+
if "common-metadata.txt" in filenames:
|
|
110
|
+
if not any(d.startswith("Lev") for d in dirnames):
|
|
111
|
+
continue
|
|
112
|
+
|
|
113
|
+
key = extract_id_from_common_metadata(dirpath / "common-metadata.txt", annex_dir)
|
|
114
|
+
|
|
115
|
+
# Find the highest Lev directory and extract the metadata
|
|
116
|
+
highest_lev = sorted(
|
|
117
|
+
[d for d in dirnames if d.startswith("Lev")]
|
|
118
|
+
)[-1]
|
|
119
|
+
metadata = Metadata.load(dirpath / highest_lev / "metadata")
|
|
120
|
+
|
|
121
|
+
metadata["files"] = {
|
|
122
|
+
p2i(file.relative_to(dirpath)): {"link": str(file)}
|
|
123
|
+
for file in files_to_upload(dirpath, annex_dir)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
simulations[key] = metadata
|
|
127
|
+
|
|
128
|
+
dirnames[:] = [] # Don't keep looking for common-metadata.txt files under this directory
|
|
129
|
+
|
|
130
|
+
return simulations
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def write_local_simulations(annex_dir):
|
|
134
|
+
"""Write the local simulations to a file for use when loading `Simulations`
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
annex_dir (str or Path): The path to the annex directory to be
|
|
138
|
+
processed.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
None
|
|
142
|
+
"""
|
|
143
|
+
from json import dump
|
|
144
|
+
|
|
145
|
+
simulations = local_simulations(annex_dir)
|
|
146
|
+
with open(sxs_directory("cache") / "local_simulations.json", "w") as f:
|
|
147
|
+
dump(simulations, f, indent=2, separators=(",", ": "), ensure_ascii=True)
|
sxs/simulations/simulation.py
CHANGED
|
@@ -423,7 +423,7 @@ class SimulationBase:
|
|
|
423
423
|
`f_ref`.
|
|
424
424
|
|
|
425
425
|
Parameters
|
|
426
|
-
|
|
426
|
+
----------
|
|
427
427
|
t_ref : float, optional
|
|
428
428
|
The reference time at which the waveform frame is specified.
|
|
429
429
|
This is measured in units of M, and defined relative to the
|
|
@@ -456,7 +456,7 @@ class SimulationBase:
|
|
|
456
456
|
including all modes up to and including this ell value.
|
|
457
457
|
|
|
458
458
|
Returns
|
|
459
|
-
|
|
459
|
+
-------
|
|
460
460
|
times : float array
|
|
461
461
|
Uniformly spaced 1D array of times, in units of M, at which
|
|
462
462
|
the waveform and dynamics quantities are returned. Aligned
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: sxs
|
|
3
|
-
Version: 2024.0.
|
|
3
|
+
Version: 2024.0.12
|
|
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/
|
|
@@ -44,7 +44,7 @@ Requires-Dist: pandas>=1.1.2
|
|
|
44
44
|
Requires-Dist: pytz>=2020.1
|
|
45
45
|
Requires-Dist: quaternionic>=1.0
|
|
46
46
|
Requires-Dist: requests>=2.24.0
|
|
47
|
-
Requires-Dist: scipy>=1.
|
|
47
|
+
Requires-Dist: scipy>=1.7
|
|
48
48
|
Requires-Dist: spherical>=1.0
|
|
49
49
|
Requires-Dist: tqdm>=4.63.1
|
|
50
50
|
Requires-Dist: urllib3>=1.25.10
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
sxs/__init__.py,sha256=
|
|
2
|
-
sxs/__version__.py,sha256=
|
|
1
|
+
sxs/__init__.py,sha256=cZJ3qp5EjO2QSJaajRVJX4xYBvReEHBoG1lNeFpBJfU,2579
|
|
2
|
+
sxs/__version__.py,sha256=tkOiDn4eJJ71UmES82yWpR2x09xcmvhOCR3F4rVLbow,26
|
|
3
3
|
sxs/handlers.py,sha256=zm1NQTeyM2idXzcmL24YXjnRVn2PBEa72LQQUUMHgOM,16667
|
|
4
4
|
sxs/juliapkg.json,sha256=higH1UDu30K_PN6-o7lAz0j1xjgYEiCCYBAc-Iaw1Iw,178
|
|
5
5
|
sxs/time_series.py,sha256=OKaLg8tFyrtKcef7900ri-a0C6A8wKxA68KovZXvH6I,41081
|
|
@@ -18,7 +18,8 @@ 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=y6X7LcsJKiZFjBPTwRHGtsT2uHf2s0r0OG_EGjD27pE,27663
|
|
20
20
|
sxs/simulations/__init__.py,sha256=sl-sDI5N2A03lAfzMig8Jm_Beri_v65qjlIOeGGX9XM,72
|
|
21
|
-
sxs/simulations/
|
|
21
|
+
sxs/simulations/local.py,sha256=pibf9uED--w6OMI6tPq8aKmI1y89CIQph40Zmq4yjNE,5127
|
|
22
|
+
sxs/simulations/simulation.py,sha256=WgxvZexjBH9fwd5qKID7YwvA1wglHerXwS_VQT1LlkY,33915
|
|
22
23
|
sxs/simulations/simulations.py,sha256=s20HdjEIcoG3vsgJcC4CwjfhICVwKWNABOYYucPEfSs,17108
|
|
23
24
|
sxs/utilities/__init__.py,sha256=KTtsBKblP02t20anSzV_7tucRUw_bFObY5my5ZuJEBU,4793
|
|
24
25
|
sxs/utilities/bitwise.py,sha256=G9ZNYgwDQRhq5wbDf-p2HcUqkEP_IRDiQoXW4KyU17k,13205
|
|
@@ -78,7 +79,7 @@ sxs/zenodo/api/__init__.py,sha256=EM_eh4Q8R5E0vIfMhyIR1IYFfOBu6vA0UTasgX9gHys,21
|
|
|
78
79
|
sxs/zenodo/api/deposit.py,sha256=J4RGvGjh0cEOrN4bBZWEDcPAhNscqB2fzLlvRZ5HTHM,36948
|
|
79
80
|
sxs/zenodo/api/login.py,sha256=Yz0ytgi81_5BpDzhrS0WPMXlvU2qUaCK8yn8zxfEbko,18007
|
|
80
81
|
sxs/zenodo/api/records.py,sha256=nKkhoHZ95CTztHF9Zzaug5p7IiUCJG4Em1i-l-WqH6U,3689
|
|
81
|
-
sxs-2024.0.
|
|
82
|
-
sxs-2024.0.
|
|
83
|
-
sxs-2024.0.
|
|
84
|
-
sxs-2024.0.
|
|
82
|
+
sxs-2024.0.12.dist-info/METADATA,sha256=1M3pphEcN6RIcbW43ySVMPKwGKXWZO75ORnOKle5YsM,9245
|
|
83
|
+
sxs-2024.0.12.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
84
|
+
sxs-2024.0.12.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
|
|
85
|
+
sxs-2024.0.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|