sxs 2024.0.29__py3-none-any.whl → 2024.0.31__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.29"
1
+ __version__ = "2024.0.31"
sxs/juliapkg.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "julia": "1.10",
2
+ "julia": "1.11",
3
3
  "packages": {
4
4
  "PostNewtonian": {
5
5
  "uuid": "377afc40-5642-4616-8613-b7ebca523866",
6
- "version": "0.10.2"
6
+ "version": "0.10.5"
7
7
  }
8
8
  }
9
9
  }
sxs/metadata/metadata.py CHANGED
@@ -23,6 +23,17 @@ def _valid_identifier_to_metadata_key(key):
23
23
  return _metadata_key_map.get(key, key.replace('_', '-'))
24
24
 
25
25
 
26
+ def _backwards_compatibility(metadata):
27
+ """Deal with the fact that keys have been removed/renamed"""
28
+ # See also `sxs.simulations.simulations.Simulations.dataframe`;
29
+ # it's probably a good idea to duplicate whatever is included here
30
+ # in that function, just to make sure nothing slips through the
31
+ # cracks.
32
+ if "number_of_orbits" not in metadata and "number_of_orbits_from_start" in metadata:
33
+ metadata["number_of_orbits"] = metadata["number_of_orbits_from_start"]
34
+ return metadata
35
+
36
+
26
37
  class Metadata(collections.OrderedDict):
27
38
  """Interface to metadata
28
39
 
@@ -72,25 +83,27 @@ class Metadata(collections.OrderedDict):
72
83
  txt_path = path.with_suffix(".txt")
73
84
 
74
85
  if path.suffix == ".json":
75
- return cls.from_json_file(json_path)
86
+ metadata = cls.from_json_file(json_path)
76
87
  elif path.suffix == ".txt":
77
- return cls.from_txt_file(txt_path, ignore_invalid_lines=ignore_invalid_lines, cache_json=cache_json)
88
+ metadata = cls.from_txt_file(txt_path, ignore_invalid_lines=ignore_invalid_lines, cache_json=cache_json)
78
89
  else:
79
90
  json_exists = json_path.exists()
80
91
  txt_exists = txt_path.exists()
81
92
  if json_exists and not txt_exists:
82
- return cls.from_json_file(json_path)
93
+ metadata = cls.from_json_file(json_path)
83
94
  elif txt_exists and not json_exists:
84
- return cls.from_txt_file(txt_path, ignore_invalid_lines=ignore_invalid_lines, cache_json=cache_json)
95
+ metadata = cls.from_txt_file(txt_path, ignore_invalid_lines=ignore_invalid_lines, cache_json=cache_json)
85
96
  elif json_exists and txt_exists:
86
97
  json_time = json_path.stat().st_mtime
87
98
  txt_time = txt_path.stat().st_mtime
88
99
  if txt_time > json_time:
89
- return cls.from_txt_file(txt_path, ignore_invalid_lines=ignore_invalid_lines, cache_json=cache_json)
100
+ metadata = cls.from_txt_file(txt_path, ignore_invalid_lines=ignore_invalid_lines, cache_json=cache_json)
90
101
  else:
91
- return cls.from_json_file(json_path)
102
+ metadata = cls.from_json_file(json_path)
92
103
  else:
93
104
  raise ValueError(f"Could not find file named '{json_path}' or '{txt_path}'")
105
+
106
+ return _backwards_compatibility(metadata)
94
107
 
95
108
  load = from_file
96
109
 
@@ -113,7 +126,7 @@ class Metadata(collections.OrderedDict):
113
126
  """
114
127
  import json
115
128
  # noinspection PyTypeChecker
116
- return json.load(json_data, object_pairs_hook=cls)
129
+ return _backwards_compatibility(json.load(json_data, object_pairs_hook=cls))
117
130
 
118
131
  @classmethod
119
132
  def from_json_file(cls, json_file):
@@ -136,7 +149,7 @@ class Metadata(collections.OrderedDict):
136
149
  # noinspection PyTypeChecker
137
150
  metadata = json.load(metadata_file, object_pairs_hook=cls)
138
151
  metadata["metadata_path"] = str(json_file)
139
- return metadata
152
+ return _backwards_compatibility(metadata)
140
153
 
141
154
  @classmethod
142
155
  def from_txt_file(cls, txt_file, ignore_invalid_lines=False, cache_json=True):
@@ -259,7 +272,7 @@ class Metadata(collections.OrderedDict):
259
272
  metadata.to_json_file(path.with_suffix(".json"))
260
273
 
261
274
  metadata["metadata_path"] = str(txt_file)
262
- return metadata
275
+ return _backwards_compatibility(metadata)
263
276
 
264
277
  def to_json(self, indent=4, separators=(",", ": ")):
265
278
  """Export to JSON string"""
@@ -404,6 +404,18 @@ class Simulations(collections.OrderedDict):
404
404
 
405
405
  simulations = pd.DataFrame.from_dict(self, orient="index")
406
406
 
407
+ # See also below for "number_of_orbits" field.
408
+ # See also `sxs.metadata.metadata._backwards_compatibility`;
409
+ # it's probably a good idea to duplicate whatever is included
410
+ # here in that function, just to make sure nothing slips
411
+ # through the cracks.
412
+ for col in [
413
+ "number_of_orbits", "number_of_orbits_from_start",
414
+ "number_of_orbits_from_reference_time"
415
+ ]:
416
+ if col not in simulations.columns:
417
+ simulations[col] = np.nan
418
+
407
419
  def floater(x):
408
420
  try:
409
421
  f = float(x)
@@ -509,6 +521,8 @@ class Simulations(collections.OrderedDict):
509
521
  # simulations["end_of_trajectory_time"].map(floater),
510
522
  # simulations["merger_time"].map(floater),
511
523
  simulations["number_of_orbits"].map(floater),
524
+ simulations["number_of_orbits_from_start"].map(floater),
525
+ simulations["number_of_orbits_from_reference_time"].map(floater),
512
526
  # simulations["superseded_by"],
513
527
  simulations["DOI_versions"],
514
528
  simulations["keywords"],
@@ -523,6 +537,14 @@ class Simulations(collections.OrderedDict):
523
537
  sims_df["keywords"].map(lambda ks: "deprecated" in ks)
524
538
  ))
525
539
 
540
+ # See also `sxs.metadata.metadata._backwards_compatibility`;
541
+ # it's probably a good idea to duplicate whatever is included
542
+ # here in that function, just to make sure nothing slips
543
+ # through the cracks.
544
+ sims_df["number_of_orbits"] = sims_df["number_of_orbits"].fillna(
545
+ sims_df["number_of_orbits_from_start"]
546
+ )
547
+
526
548
  # We have ignored the following fields present in the
527
549
  # simulations.json file (as of 2024-08-04), listed here with
528
550
  # the number of non-null entries:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sxs
3
- Version: 2024.0.29
3
+ Version: 2024.0.31
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,7 +1,7 @@
1
1
  sxs/__init__.py,sha256=hbydsXWR88sFiKExPJ1NHWGEvWRbbJBjSc1irSMYKgY,2623
2
- sxs/__version__.py,sha256=7e6J-tZSsOjpc-ArB1X6N36VWAzISxlyWGGmed71rEQ,26
2
+ sxs/__version__.py,sha256=UAik3HzTavgwLz8MwmmNCfjGxY005GYSzp-oIt-WBkY,26
3
3
  sxs/handlers.py,sha256=Nc1_aDKm_wDHg2cITI_ljbqU4VRWpwQ7fdgy3c1XcE8,17531
4
- sxs/juliapkg.json,sha256=higH1UDu30K_PN6-o7lAz0j1xjgYEiCCYBAc-Iaw1Iw,178
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=s-RXyBiImKsQenqJIU6NAjlsjOX7f1MkIIW9rPtWYyg,14761
7
7
  sxs/caltechdata/catalog.py,sha256=E2nystCaMZLKxTlLgfbfpGkckfkLyIzhn3YeEI3nQYc,4914
@@ -16,11 +16,11 @@ sxs/horizons/xor_multishuffle_bzip2.py,sha256=y4AKuxmLuj8K1pkdhIoSzENGyMu4uhpiPr
16
16
  sxs/julia/GWFrames.py,sha256=47H9Ugff7ldGBujiUTcADT3b4MSxUtqmajvSApI91WA,2892
17
17
  sxs/julia/__init__.py,sha256=uSLP_xfU-GZG7IO5vs0TEkCR4LH8aBYMF-852wDY3kI,3490
18
18
  sxs/metadata/__init__.py,sha256=KCvJ9Cf1WhIZp-z28UzarKcmUAzV2BOv2gqKiorILjo,149
19
- sxs/metadata/metadata.py,sha256=y6X7LcsJKiZFjBPTwRHGtsT2uHf2s0r0OG_EGjD27pE,27663
19
+ sxs/metadata/metadata.py,sha256=EEax1WTKL4G5U__wHefbBX0l4vtIHTcYFnHwziGkVhM,28348
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
22
  sxs/simulations/simulation.py,sha256=OqQh6xq-s_JoQI6e2XA5j194L0DT3HGYIW8ZZiurZ2Y,34631
23
- sxs/simulations/simulations.py,sha256=KDb_c6btL2kLFXLZbk7ucZUTxnnhxd2aavfFheado4w,23785
23
+ sxs/simulations/simulations.py,sha256=ATxrcihvblGgRHdR7vIMg5eKghN5Jo6U0CafTro4wYA,24827
24
24
  sxs/utilities/__init__.py,sha256=WSStlqljfgQheMxHGfuofSc5LdmASGvO3FNO3f_zaT0,4806
25
25
  sxs/utilities/bitwise.py,sha256=G9ZNYgwDQRhq5wbDf-p2HcUqkEP_IRDiQoXW4KyU17k,13205
26
26
  sxs/utilities/dicts.py,sha256=CCpm3upG_9SRj9gjawukSUfaJ5asF-XRG2ausEXhYyg,695
@@ -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.29.dist-info/METADATA,sha256=PCmR-cFzbd_Xd5Zp6EjpwW594Y-fZleSTNEbSMktFeM,9250
84
- sxs-2024.0.29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
85
- sxs-2024.0.29.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
86
- sxs-2024.0.29.dist-info/RECORD,,
83
+ sxs-2024.0.31.dist-info/METADATA,sha256=Kw-friUAdQiMYlsZaK83BfvEBZgyRfiqLpkDg2j7sNk,9250
84
+ sxs-2024.0.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
85
+ sxs-2024.0.31.dist-info/licenses/LICENSE,sha256=ptVOd5m7LDM5ZF0x32cxb8c2Nd5NDmAhy6DX7xt_7VA,1080
86
+ sxs-2024.0.31.dist-info/RECORD,,