sxs 2024.0.7__tar.gz → 2024.0.8__tar.gz

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.
Files changed (128) hide show
  1. {sxs-2024.0.7 → sxs-2024.0.8}/.github/workflows/build.yml +21 -2
  2. {sxs-2024.0.7 → sxs-2024.0.8}/CITATION.cff +2 -2
  3. {sxs-2024.0.7 → sxs-2024.0.8}/PKG-INFO +17 -16
  4. {sxs-2024.0.7 → sxs-2024.0.8}/README.md +16 -15
  5. sxs-2024.0.8/sxs/__version__.py +1 -0
  6. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/handlers.py +4 -4
  7. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/simulations/simulation.py +20 -18
  8. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/simulations/simulations.py +2 -1
  9. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/__init__.py +1 -0
  10. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/sxs_directories.py +6 -5
  11. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/sxs_identifiers.py +8 -1
  12. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_horizons.py +16 -0
  13. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_simulation.py +8 -0
  14. sxs-2024.0.7/sxs/__version__.py +0 -1
  15. {sxs-2024.0.7 → sxs-2024.0.8}/.codecov.yml +0 -0
  16. {sxs-2024.0.7 → sxs-2024.0.8}/.github/dependabot.yml +0 -0
  17. {sxs-2024.0.7 → sxs-2024.0.8}/.github/scripts/parse_bump_rule.py +0 -0
  18. {sxs-2024.0.7 → sxs-2024.0.8}/.github/workflows/pr_rtd_link.yml +0 -0
  19. {sxs-2024.0.7 → sxs-2024.0.8}/.gitignore +0 -0
  20. {sxs-2024.0.7 → sxs-2024.0.8}/.readthedocs.yaml +0 -0
  21. {sxs-2024.0.7 → sxs-2024.0.8}/LICENSE +0 -0
  22. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/catalog.md +0 -0
  23. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/horizons.md +0 -0
  24. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/load.md +0 -0
  25. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/metadata.md +0 -0
  26. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/simulation.md +0 -0
  27. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/simulations.md +0 -0
  28. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/time_series.md +0 -0
  29. {sxs-2024.0.7 → sxs-2024.0.8}/docs/api/waveforms.md +0 -0
  30. {sxs-2024.0.7 → sxs-2024.0.8}/docs/html/main.html +0 -0
  31. {sxs-2024.0.7 → sxs-2024.0.8}/docs/images/favicon.ico +0 -0
  32. {sxs-2024.0.7 → sxs-2024.0.8}/docs/index.md +0 -0
  33. {sxs-2024.0.7 → sxs-2024.0.8}/docs/javascript/mathjax.js +0 -0
  34. {sxs-2024.0.7 → sxs-2024.0.8}/docs/julia.md +0 -0
  35. {sxs-2024.0.7 → sxs-2024.0.8}/docs/mathematica.md +0 -0
  36. {sxs-2024.0.7 → sxs-2024.0.8}/docs/stylesheets/extra.css +0 -0
  37. {sxs-2024.0.7 → sxs-2024.0.8}/docs/tutorials/00-Introduction.ipynb +0 -0
  38. {sxs-2024.0.7 → sxs-2024.0.8}/docs/tutorials/01-Simulations_and_Metadata.ipynb +0 -0
  39. {sxs-2024.0.7 → sxs-2024.0.8}/docs/tutorials/02-Simulation.ipynb +0 -0
  40. {sxs-2024.0.7 → sxs-2024.0.8}/docs/tutorials/03-Horizons.ipynb +0 -0
  41. {sxs-2024.0.7 → sxs-2024.0.8}/docs/tutorials/04-Waveforms.ipynb +0 -0
  42. {sxs-2024.0.7 → sxs-2024.0.8}/docs/tutorials/05-PreprocessingForFFTs.ipynb +0 -0
  43. {sxs-2024.0.7 → sxs-2024.0.8}/mkdocs.yml +0 -0
  44. {sxs-2024.0.7 → sxs-2024.0.8}/pyproject.toml +0 -0
  45. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/__init__.py +0 -0
  46. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/caltechdata/__init__.py +0 -0
  47. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/caltechdata/catalog.py +0 -0
  48. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/caltechdata/login.py +0 -0
  49. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/catalog/__init__.py +0 -0
  50. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/catalog/catalog.py +0 -0
  51. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/catalog/create.py +0 -0
  52. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/catalog/description.py +0 -0
  53. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/horizons/__init__.py +0 -0
  54. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/horizons/spec_horizons_h5.py +0 -0
  55. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/horizons/xor_multishuffle_bzip2.py +0 -0
  56. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/julia/GWFrames.py +0 -0
  57. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/julia/__init__.py +0 -0
  58. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/juliapkg.json +0 -0
  59. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/metadata/__init__.py +0 -0
  60. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/metadata/metadata.py +0 -0
  61. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/simulations/__init__.py +0 -0
  62. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/time_series.py +0 -0
  63. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/bitwise.py +0 -0
  64. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/decimation/__init__.py +0 -0
  65. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/decimation/greedy_spline.py +0 -0
  66. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/decimation/linear_bisection.py +0 -0
  67. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/decimation/peak_greed.py +0 -0
  68. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/decimation/suppression.py +0 -0
  69. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/dicts.py +0 -0
  70. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/downloads.py +0 -0
  71. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/files.py +0 -0
  72. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/formats.py +0 -0
  73. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/inspire.py +0 -0
  74. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/__init__.py +0 -0
  75. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/comparisons.py +0 -0
  76. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/conversion.py +0 -0
  77. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/dataset.py +0 -0
  78. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/horizons.py +0 -0
  79. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/metadata.py +0 -0
  80. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/waveform_amp_phase.py +0 -0
  81. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/lvcnr/waveforms.py +0 -0
  82. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/monotonicity.py +0 -0
  83. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/pretty_print.py +0 -0
  84. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/references/__init__.py +0 -0
  85. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/references/ads.py +0 -0
  86. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/references/arxiv.py +0 -0
  87. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/references/fairchild_report.py +0 -0
  88. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/references/inspire.py +0 -0
  89. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/references/journal_abbreviations.py +0 -0
  90. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/references/references.py +0 -0
  91. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/select.py +0 -0
  92. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/smooth_functions.py +0 -0
  93. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/utilities/url.py +0 -0
  94. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/__init__.py +0 -0
  95. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/alignment.py +0 -0
  96. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/format_handlers/__init__.py +0 -0
  97. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/format_handlers/lvc.py +0 -0
  98. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/format_handlers/nrar.py +0 -0
  99. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/format_handlers/rotating_paired_diff_multishuffle_bzip2.py +0 -0
  100. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/format_handlers/rotating_paired_xor_multishuffle_bzip2.py +0 -0
  101. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/format_handlers/spectre_cce_v1.py +0 -0
  102. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/memory.py +0 -0
  103. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/mode_utilities.py +0 -0
  104. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/transformations.py +0 -0
  105. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/waveform_grid.py +0 -0
  106. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/waveform_mixin.py +0 -0
  107. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/waveform_modes.py +0 -0
  108. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/waveforms/waveform_signal.py +0 -0
  109. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/__init__.py +0 -0
  110. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/api/__init__.py +0 -0
  111. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/api/deposit.py +0 -0
  112. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/api/login.py +0 -0
  113. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/api/records.py +0 -0
  114. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/catalog.py +0 -0
  115. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/creators.py +0 -0
  116. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/simannex.py +0 -0
  117. {sxs-2024.0.7 → sxs-2024.0.8}/sxs/zenodo/surrogatemodeling.py +0 -0
  118. {sxs-2024.0.7 → sxs-2024.0.8}/tests/__init__.py +0 -0
  119. {sxs-2024.0.7 → sxs-2024.0.8}/tests/conftest.py +0 -0
  120. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_catalog.py +0 -0
  121. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_julia.py +0 -0
  122. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_loader.py +0 -0
  123. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_metadata.py +0 -0
  124. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_time_series.py +0 -0
  125. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_transformations.py +0 -0
  126. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_utilities.py +0 -0
  127. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_waveform_rotations.py +0 -0
  128. {sxs-2024.0.7 → sxs-2024.0.8}/tests/test_waveforms.py +0 -0
@@ -40,6 +40,25 @@ jobs:
40
40
  run: |
41
41
  echo "skipping_build_and_test_replicate=${skip_replicates}" >> $GITHUB_ENV
42
42
 
43
+ - name: Cache sxs file storage
44
+ if: ${{ env.skipping_build_and_test_replicate != 'true' }}
45
+ uses: actions/cache@v4
46
+ with:
47
+ key: sxs-${{ runner.os }}-python${{ matrix.python-version }}
48
+ path: |
49
+ ~/.sxs
50
+ restore-keys: |
51
+ sxs-${{ runner.os }}-
52
+ sxs-
53
+
54
+ - name: Set up Julia
55
+ if: ${{ env.skipping_build_and_test_replicate != 'true' }}
56
+ uses: julia-actions/setup-julia@v2
57
+
58
+ - name: Cache Julia
59
+ if: ${{ env.skipping_build_and_test_replicate != 'true' }}
60
+ uses: julia-actions/cache@v2
61
+
43
62
  - name: Check out code
44
63
  if: ${{ env.skipping_build_and_test_replicate != 'true' }}
45
64
  uses: actions/checkout@v4
@@ -52,7 +71,7 @@ jobs:
52
71
 
53
72
  - name: Install Hatch
54
73
  if: ${{ env.skipping_build_and_test_replicate != 'true' }}
55
- run: pip install --upgrade hatch
74
+ run: python -m pip install --disable-pip-version-check --upgrade hatch
56
75
 
57
76
  - name: Run tests
58
77
  if: ${{ env.skipping_build_and_test_replicate != 'true' }}
@@ -85,7 +104,7 @@ jobs:
85
104
  python-version: ${{ matrix.python-version }}
86
105
 
87
106
  - name: Install Hatch
88
- run: pip install --upgrade hatch
107
+ run: python -m pip install --disable-pip-version-check --upgrade hatch
89
108
 
90
109
  - name: Bump version
91
110
  shell: bash
@@ -10,5 +10,5 @@ authors:
10
10
  title: "The sxs package"
11
11
  license: MIT
12
12
  doi: 10.5281/zenodo.4034006
13
- version: 2024.0.7
14
- date-released: 2024-09-06
13
+ version: 2024.0.8
14
+ date-released: 2024-09-09
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sxs
3
- Version: 2024.0.7
3
+ Version: 2024.0.8
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/
@@ -166,23 +166,24 @@ horizons = sxs_bbh_1234.horizons
166
166
  h = sxs_bbh_1234.h
167
167
  ```
168
168
 
169
- [The `catalog`
170
- object](https://sxs.readthedocs.io/en/main/api/sxs.catalog.catalog/#sxs.catalog.catalog.Catalog)
171
- contains information about every simulation in the catalog, including all
172
- available data files, and information about how to get them. You probably
173
- don't need to actually know about details like where to get the data, but
174
- `catalog` can help you find the simulations you care about. Most importantly,
175
- `catalog.simulations` is a `dict` object, where the keys are names of
176
- simulations (like "SXS:BBH:0123") and the values are the same types as [the
169
+ [The `simulations`
170
+ object](https://sxs.readthedocs.io/en/main/api/simulations/) contains
171
+ information about every simulation in the catalog, including all
172
+ available data files, and information about how to get them. You
173
+ probably don't need to actually know about details like where to get
174
+ the data, but `simulations` can help you find the simulations you care
175
+ about. It is a `dict` object, where the keys are names of simulations
176
+ (like "SXS:BBH:0123") and the values are the same types as [the
177
177
  `metadata`
178
178
  object](https://sxs.readthedocs.io/en/main/api/sxs.metadata.metadata/#sxs.metadata.metadata.Metadata),
179
- which contains metadata about that simulation — things like mass ratio, spins,
180
- etc. This `metadata` reflects the actual output of the simulations, which
181
- leads to some inconsistencies in their formats. A more consistent interface
182
- (though it is biased toward returning NaNs where a human might glean more
183
- information) is provided by `catalog.table`, which returns a
184
- [`pandas`](https://pandas.pydata.org/docs/) `DataFrame` with specific data
185
- types for each column.
179
+ which contains metadata about that simulation — things like mass
180
+ ratio, spins, etc. This `metadata` reflects the actual output of the
181
+ simulations, which leads to some inconsistencies in their formats. A
182
+ more consistent interface (though it is biased toward returning NaNs
183
+ where a human might glean more information) is provided by
184
+ `simulations.dataframe`, which returns a
185
+ [`pandas`](https://pandas.pydata.org/docs/) `DataFrame` with specific
186
+ data types for each column.
186
187
 
187
188
  The actual data itself is primarily contained in the next two objects. [The
188
189
  `horizons`
@@ -94,23 +94,24 @@ horizons = sxs_bbh_1234.horizons
94
94
  h = sxs_bbh_1234.h
95
95
  ```
96
96
 
97
- [The `catalog`
98
- object](https://sxs.readthedocs.io/en/main/api/sxs.catalog.catalog/#sxs.catalog.catalog.Catalog)
99
- contains information about every simulation in the catalog, including all
100
- available data files, and information about how to get them. You probably
101
- don't need to actually know about details like where to get the data, but
102
- `catalog` can help you find the simulations you care about. Most importantly,
103
- `catalog.simulations` is a `dict` object, where the keys are names of
104
- simulations (like "SXS:BBH:0123") and the values are the same types as [the
97
+ [The `simulations`
98
+ object](https://sxs.readthedocs.io/en/main/api/simulations/) contains
99
+ information about every simulation in the catalog, including all
100
+ available data files, and information about how to get them. You
101
+ probably don't need to actually know about details like where to get
102
+ the data, but `simulations` can help you find the simulations you care
103
+ about. It is a `dict` object, where the keys are names of simulations
104
+ (like "SXS:BBH:0123") and the values are the same types as [the
105
105
  `metadata`
106
106
  object](https://sxs.readthedocs.io/en/main/api/sxs.metadata.metadata/#sxs.metadata.metadata.Metadata),
107
- which contains metadata about that simulation — things like mass ratio, spins,
108
- etc. This `metadata` reflects the actual output of the simulations, which
109
- leads to some inconsistencies in their formats. A more consistent interface
110
- (though it is biased toward returning NaNs where a human might glean more
111
- information) is provided by `catalog.table`, which returns a
112
- [`pandas`](https://pandas.pydata.org/docs/) `DataFrame` with specific data
113
- types for each column.
107
+ which contains metadata about that simulation — things like mass
108
+ ratio, spins, etc. This `metadata` reflects the actual output of the
109
+ simulations, which leads to some inconsistencies in their formats. A
110
+ more consistent interface (though it is biased toward returning NaNs
111
+ where a human might glean more information) is provided by
112
+ `simulations.dataframe`, which returns a
113
+ [`pandas`](https://pandas.pydata.org/docs/) `DataFrame` with specific
114
+ data types for each column.
114
115
 
115
116
  The actual data itself is primarily contained in the next two objects. [The
116
117
  `horizons`
@@ -0,0 +1 @@
1
+ __version__ = "2024.0.8"
@@ -256,10 +256,10 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
256
256
  json_path = path.with_suffix('.json')
257
257
 
258
258
  if not path.exists():
259
- if truepath and (testpath := pathlib.Path(truepath).expanduser()).exists():
259
+ if truepath and (testpath := pathlib.Path(sxs_path_to_system_path(truepath)).expanduser()).exists():
260
260
  path = testpath
261
261
 
262
- elif truepath and (testpath := cache_path / truepath).exists():
262
+ elif truepath and (testpath := cache_path / sxs_path_to_system_path(truepath)).exists():
263
263
  path = testpath
264
264
 
265
265
  elif _safe_resolve_exists(h5_path):
@@ -271,7 +271,7 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
271
271
  elif "scheme" in url.parse(location):
272
272
  m = url.parse(location)
273
273
  truepath = truepath or urllib.request.url2pathname(f"{m['host']}/{m['port']}/{m['resource']}")
274
- path = cache_path / truepath
274
+ path = cache_path / sxs_path_to_system_path(truepath)
275
275
  if not path.resolve().exists():
276
276
  if download is False: # Again, we want literal False, not casting to False
277
277
  raise ValueError(f"File '{truepath}' not found in cache, but downloading turned off")
@@ -298,7 +298,7 @@ def load(location, download=None, cache=None, progress=None, truepath=None, **kw
298
298
  paths = []
299
299
  for sxs_path, file_info in selections.items():
300
300
  truepath = truepath or sxs_path_to_system_path(file_info.get("truepath", sxs_path))
301
- path = cache_path / truepath
301
+ path = cache_path / sxs_path_to_system_path(truepath)
302
302
  if not path.resolve().exists():
303
303
  download_url = file_info["download"]
304
304
  download_file(download_url, path, progress=progress)
@@ -96,7 +96,6 @@ def Simulation(location, *args, **kwargs):
96
96
 
97
97
  """
98
98
  from .. import load, sxs_directory
99
- from ..utilities import sxs_path_to_system_path
100
99
 
101
100
  # Extract the simulation ID, version, and Lev from the location string
102
101
  simulation_id, input_version = sxs_id_and_version(location)
@@ -299,16 +298,17 @@ class SimulationBase:
299
298
  self.deprecated = kwargs.get("deprecated", False)
300
299
 
301
300
  def __repr__(self):
302
- chi1 = self.metadata.reference_dimensionless_spin1
303
- chi2 = self.metadata.reference_dimensionless_spin2
301
+ chi1 = self.series["reference_dimensionless_spin1"]
302
+ chi2 = self.series["reference_dimensionless_spin2"]
303
+ e = self.metadata.reference_eccentricity
304
304
  construction = f"""{type(self).__qualname__}("{self.location}")\n# """
305
305
  if self.deprecated:
306
306
  construction += "DEPRECATED "
307
- construction += f"{self.metadata.number_of_orbits:.3g}-orbit "
307
+ construction += f"n_orbits={self.metadata.number_of_orbits:.3g} "
308
308
  construction += f"q={self.metadata.reference_mass_ratio:.3g} "
309
309
  construction += f"""chi1=[{", ".join(f"{c:.3g}" for c in chi1)}] """
310
310
  construction += f"""chi2=[{", ".join(f"{c:.3g}" for c in chi2)}] """
311
- construction += f"e={self.metadata.reference_eccentricity:.3g} simulation"
311
+ construction += f"e={e:.3g} simulation" if type(e) is float else f"{e=} simulation"
312
312
  return construction
313
313
 
314
314
  def __str__(self):
@@ -332,14 +332,16 @@ class SimulationBase:
332
332
 
333
333
  def load_horizons(self):
334
334
  from .. import load
335
- sxs_id_path = Path(sxs_path_to_system_path(self.sxs_id))
335
+ sxs_id_path = Path(self.sxs_id)
336
336
  horizons_path = self.horizons_path
337
337
  horizons_location = self.files.get(horizons_path)["link"]
338
- horizons_truepath = sxs_id_path / sxs_path_to_system_path(horizons_path)
338
+ horizons_truepath = Path(sxs_path_to_system_path(sxs_id_path / horizons_path))
339
339
  return load(horizons_location, truepath=horizons_truepath)
340
340
 
341
341
  @property
342
342
  def horizons(self):
343
+ if self.horizons_path not in self.files:
344
+ raise ValueError(f"Horizons data is not available for simulation {self.sxs_id}")
343
345
  if not hasattr(self, "_horizons"):
344
346
  self._horizons = self.load_horizons()
345
347
  return self._horizons
@@ -427,7 +429,7 @@ class Simulation_v1(SimulationBase):
427
429
 
428
430
  def load_horizons(self):
429
431
  from .. import load
430
- sxs_id_path = Path(sxs_path_to_system_path(self.sxs_id))
432
+ sxs_id_path = Path(self.sxs_id)
431
433
  horizons_path = self.horizons_path
432
434
  if horizons_path in self.files:
433
435
  horizons_location = self.files.get(horizons_path)["link"]
@@ -436,7 +438,7 @@ class Simulation_v1(SimulationBase):
436
438
  horizons_location = self.files.get(extended_horizons_path)["link"]
437
439
  else:
438
440
  raise ValueError(f"File '{horizons_path}' not found in simulation files")
439
- horizons_truepath = sxs_id_path / sxs_path_to_system_path(horizons_path)
441
+ horizons_truepath = Path(sxs_path_to_system_path(sxs_id_path / horizons_path))
440
442
  return load(horizons_location, truepath=horizons_truepath)
441
443
 
442
444
  @property
@@ -472,8 +474,8 @@ class Simulation_v1(SimulationBase):
472
474
  location = self.files.get(extended_file_name)["link"]
473
475
  else:
474
476
  raise ValueError(f"File '{file_name}' not found in simulation files")
475
- sxs_id_path = Path(sxs_path_to_system_path(self.sxs_id))
476
- truepath = sxs_id_path / sxs_path_to_system_path(file_name)
477
+ sxs_id_path = Path(self.sxs_id)
478
+ truepath = Path(sxs_path_to_system_path(sxs_id_path / file_name))
477
479
  w = load(location, truepath=truepath, extrapolation_order=group)
478
480
  w.metadata = self.metadata
479
481
  return w
@@ -517,15 +519,15 @@ class Simulation_v2(SimulationBase):
517
519
  def load_waveform(self, file_name, group):
518
520
  from .. import load
519
521
  # Note that `name` should not have the file ending on input,
520
- # but we will strip it regardless with `.stem`.
521
- file_name = Path(file_name).stem
522
- sxs_id_path = Path(sxs_path_to_system_path(self.sxs_id))
523
- h5_path = f"{file_name}.h5"
524
- json_path = f"{file_name}.json"
522
+ # but we will replace it regardless with `.with_suffix`.
523
+ file_name = Path(file_name)
524
+ sxs_id_path = Path(self.sxs_id)
525
+ h5_path = str(file_name.with_suffix(".h5"))
526
+ json_path = str(file_name.with_suffix(".json"))
525
527
  h5_location = self.files.get(h5_path)["link"]
526
528
  json_location = self.files.get(json_path)["link"]
527
- h5_truepath = sxs_id_path / sxs_path_to_system_path(h5_path)
528
- json_truepath = sxs_id_path / sxs_path_to_system_path(json_path)
529
+ h5_truepath = Path(sxs_path_to_system_path(sxs_id_path / h5_path))
530
+ json_truepath = Path(sxs_path_to_system_path(sxs_id_path / json_path))
529
531
  if not json_truepath.exists():
530
532
  if not read_config("download", True):
531
533
  raise ValueError(f"{json_truepath} not found and download is disabled")
@@ -54,7 +54,8 @@ class Simulations(collections.OrderedDict):
54
54
  remote_timestamp = datetime.strptime(
55
55
  response.headers["Last-Modified"], "%a, %d %b %Y %H:%M:%S GMT"
56
56
  ).replace(tzinfo=timezone.utc)
57
- except:
57
+ except Exception as e:
58
+ print("Got exception while trying to get the remote timestamp:", e)
58
59
  failed = True
59
60
  if failed:
60
61
  print(
@@ -19,6 +19,7 @@ from .sxs_identifiers import (
19
19
  lev_regex, lev_re,
20
20
  sxs_id_version_lev_regex, sxs_id_version_lev_re,
21
21
  sxs_id_version_lev_exact_regex, sxs_id_version_lev_exact_re,
22
+ sxs_path_regex, sxs_path_re,
22
23
  sxs_id, sxs_id_and_version,
23
24
  lev_number, simulation_title, sxs_id_to_url,
24
25
  )
@@ -3,9 +3,8 @@
3
3
  import re
4
4
  import platform
5
5
  import functools
6
- from .sxs_identifiers import sxs_identifier_regex
6
+ from .sxs_identifiers import sxs_path_re
7
7
 
8
- _sxs_identifier_regex = re.compile(sxs_identifier_regex)
9
8
  _platform_system = platform.system()
10
9
 
11
10
 
@@ -215,12 +214,14 @@ def sxs_directory(directory_type, persistent=True):
215
214
 
216
215
 
217
216
  def sxs_path_to_system_path(path):
218
- """Translate SXS path to a system-compatible path
217
+ r"""Translate SXS path to a system-compatible path
219
218
 
220
219
  Parameters
221
220
  ----------
222
221
  path : str
223
- SXS-style path to a file — for example, "SXS:BBH:0123/Lev4/Horizons.h5"
222
+ SXS-style path to a file — for example, r"SXS:BBH:0123\Lev4:Horizons.h5"
223
+ becomes r"SXS_BBH_0123\Lev4_Horizons.h5" on Windows. Other systems can
224
+ handle the original path, so are not changed.
224
225
 
225
226
  Notes
226
227
  -----
@@ -230,7 +231,7 @@ def sxs_path_to_system_path(path):
230
231
 
231
232
  """
232
233
  if _platform_system == "Windows":
233
- return _sxs_identifier_regex.sub(lambda s: s.group(0).replace(":", "_"), str(path))
234
+ return sxs_path_re.sub(lambda s: s.group(0).replace(":", "_"), str(path))
234
235
  else:
235
236
  return path
236
237
 
@@ -1,19 +1,26 @@
1
1
  """Simple regexes to understand SXS IDs"""
2
2
 
3
3
  import re
4
+ import os
5
+
6
+ sep_regex = r"(:|/)" if os.sep == "/" else r"(:|/|\\)"
4
7
 
5
8
  sxs_identifier_regex = (
6
9
  r"(?P<sxs_identifier>SXS:(?P<simulation_type>BBH|BHNS|NSNS)(?:_ExtCCE)?:"
7
10
  r"(?P<sxs_number>[0-9]+))(?:(v|V)(?P<version>[0-9.]+))?"
8
11
  )
9
12
  lev_regex = r"Lev(?P<lev>-?[0-9]+)"
10
- sxs_id_version_lev_regex = sxs_identifier_regex + rf"(?:(:|/){lev_regex})?"
13
+ sxs_id_version_lev_regex = sxs_identifier_regex + rf"(?:{sep_regex}{lev_regex})?"
11
14
  sxs_id_version_lev_exact_regex = f"^{sxs_id_version_lev_regex}$"
12
15
 
16
+ file_regex = r"(?P<file>[a-zA-Z0-9_]+\.[a-zA-Z0-9]+)"
17
+ sxs_path_regex = sxs_id_version_lev_regex + rf"(?:{sep_regex}{file_regex})?"
18
+
13
19
  sxs_identifier_re = re.compile(sxs_identifier_regex)
14
20
  lev_re = re.compile(lev_regex)
15
21
  sxs_id_version_lev_re = re.compile(sxs_id_version_lev_regex)
16
22
  sxs_id_version_lev_exact_re = re.compile(sxs_id_version_lev_exact_regex)
23
+ sxs_path_re = re.compile(sxs_path_regex)
17
24
 
18
25
  def sxs_id(s, default="", include_version=False):
19
26
  """Return the SXS ID contained in the input string
@@ -56,3 +56,19 @@ def test_xmb_format():
56
56
  d_spec = getattr(h_spec, attr)
57
57
  d_xmb = getattr(h_xmb, attr)
58
58
  assert np.array_equal(d_spec, d_xmb)
59
+
60
+
61
+ def test_horizon_existence():
62
+ bhbh = sxs.load("SXS:BBH:0001", auto_supersede=True)
63
+ bhbh_horizon = bhbh.horizons
64
+ assert bhbh_horizon.A is not None
65
+ assert bhbh_horizon.B is not None
66
+ assert bhbh_horizon.C is not None
67
+ bhns = sxs.load("SXS:BHNS:0001", auto_supersede=True)
68
+ bhns_horizon = bhns.horizons
69
+ assert bhns_horizon.A is not None
70
+ assert bhns_horizon.B is None
71
+ assert bhns_horizon.C is None
72
+ nsns = sxs.load("SXS:NSNS:0001", auto_supersede=True)
73
+ with pytest.raises(ValueError, match="Horizons data is not available for simulation"):
74
+ nsns_horizon = nsns.horizons
@@ -2,6 +2,14 @@ import pytest
2
2
  import sxs
3
3
 
4
4
 
5
+ def test_sxs_load_v2():
6
+ s = sxs.load("SXS:BBH:0001v2.0")
7
+ assert s.sxs_id_stem == "SXS:BBH:0001"
8
+ assert s.version == "v2.0"
9
+ s.h
10
+ s.horizons
11
+
12
+
5
13
  @pytest.mark.parametrize("loader", [sxs.Simulation, sxs.load])
6
14
  def test_superseded_by_single(loader):
7
15
  simulation = "SXS:BBH:0001"
@@ -1 +0,0 @@
1
- __version__ = "2024.0.7"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes