gwpy 3.0.9__py3-none-any.whl → 3.0.11__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.

Potentially problematic release.


This version of gwpy might be problematic. Click here for more details.

Files changed (42) hide show
  1. gwpy/_version.py +2 -2
  2. gwpy/cli/gwpy_plot.py +1 -1
  3. gwpy/cli/tests/base.py +11 -1
  4. gwpy/detector/units.py +1 -1
  5. gwpy/frequencyseries/tests/test_hist.py +4 -3
  6. gwpy/io/datafind.py +2 -2
  7. gwpy/io/ffldatafind.py +1 -1
  8. gwpy/io/tests/test_datafind.py +0 -53
  9. gwpy/plot/axes.py +6 -2
  10. gwpy/plot/plot.py +12 -2
  11. gwpy/plot/segments.py +8 -8
  12. gwpy/plot/tests/test_axes.py +4 -2
  13. gwpy/plot/tests/test_segments.py +1 -1
  14. gwpy/segments/__init__.py +1 -1
  15. gwpy/segments/flag.py +13 -11
  16. gwpy/segments/io/hdf5.py +1 -1
  17. gwpy/segments/segments.py +1 -1
  18. gwpy/signal/filter_design.py +1 -1
  19. gwpy/signal/tests/test_coherence.py +31 -10
  20. gwpy/table/io/ligolw.py +1 -1
  21. gwpy/table/tests/test_io_ligolw.py +1 -1
  22. gwpy/testing/errors.py +1 -0
  23. gwpy/testing/marks.py +1 -1
  24. gwpy/timeseries/core.py +0 -1
  25. gwpy/timeseries/io/gwf/__init__.py +1 -1
  26. gwpy/timeseries/statevector.py +4 -2
  27. gwpy/timeseries/tests/test_core.py +7 -13
  28. gwpy/timeseries/tests/test_io_gwf_framecpp.py +1 -1
  29. gwpy/timeseries/tests/test_statevector.py +29 -17
  30. gwpy/timeseries/tests/test_timeseries.py +10 -14
  31. gwpy/types/tests/test_array.py +12 -10
  32. gwpy/types/tests/test_array2d.py +5 -9
  33. gwpy/types/tests/test_series.py +5 -5
  34. gwpy/utils/sphinx/zenodo.py +5 -1
  35. gwpy/utils/tests/test_sphinx_zenodo.py +10 -5
  36. gwpy-3.0.11.dist-info/METADATA +125 -0
  37. {gwpy-3.0.9.dist-info → gwpy-3.0.11.dist-info}/RECORD +41 -41
  38. {gwpy-3.0.9.dist-info → gwpy-3.0.11.dist-info}/WHEEL +1 -1
  39. gwpy-3.0.9.dist-info/METADATA +0 -124
  40. {gwpy-3.0.9.dist-info → gwpy-3.0.11.dist-info}/LICENSE +0 -0
  41. {gwpy-3.0.9.dist-info → gwpy-3.0.11.dist-info}/entry_points.txt +0 -0
  42. {gwpy-3.0.9.dist-info → gwpy-3.0.11.dist-info}/top_level.txt +0 -0
@@ -144,29 +144,39 @@ class TestStateTimeSeries(_TestTimeSeriesBase):
144
144
  assert flag.label == 'Label'
145
145
  assert flag.description == 'Description'
146
146
 
147
- def test_override_unit(self):
148
- return NotImplemented
147
+ def test_override_unit(self, array):
148
+ with pytest.raises(NotImplementedError):
149
+ super().test_override_unit(array)
149
150
 
150
151
  def test_is_compatible_error_unit(self):
151
- return NotImplemented
152
+ pytest.skip(f"not implemented for {self.TEST_CLASS.__name__}")
152
153
 
153
154
  def test_to_from_pycbc(self):
154
- return NotImplemented
155
+ pytest.skip(f"not implemented for {self.TEST_CLASS.__name__}")
155
156
 
156
- def test_to_from_lal(self):
157
- return NotImplemented
157
+ def test_to_from_lal(self, array):
158
+ with pytest.raises(NotImplementedError):
159
+ super().test_to_from_lal(array)
158
160
 
159
- def test_to_from_lal_no_copy(self):
160
- return NotImplemented
161
+ @pytest.mark.parametrize("copy", (False, True))
162
+ def test_to_from_lal_no_copy(self, array, copy):
163
+ with pytest.raises(NotImplementedError):
164
+ super().test_to_from_lal_no_copy(array, copy)
161
165
 
162
- def test_to_from_lal_pow10_units(self):
163
- return NotImplemented
166
+ @pytest.mark.requires("lal")
167
+ def test_to_from_lal_pow10_units(self, array):
168
+ with pytest.raises(NotImplementedError):
169
+ super().test_to_from_lal_pow10_units(array)
164
170
 
165
- def test_to_from_lal_scaled_units(self):
166
- return NotImplemented
171
+ @pytest.mark.requires("lal")
172
+ def test_to_from_lal_scaled_units(self, array):
173
+ with pytest.raises(NotImplementedError):
174
+ super().test_to_from_lal_scaled_units(array)
167
175
 
168
- def test_to_from_lal_unrecognised_units(self):
169
- return NotImplemented
176
+ @pytest.mark.requires("lal")
177
+ def test_to_from_lal_unrecognised_units(self, array):
178
+ with pytest.raises(NotImplementedError):
179
+ super().test_to_from_lal_unrecognised_units(array)
170
180
 
171
181
 
172
182
  # -- StateTimeSeriesDict ------------------------------------------------------
@@ -176,8 +186,8 @@ class TestStateTimeSeriesDict(_TestTimeSeriesBaseDict):
176
186
  ENTRY_CLASS = StateTimeSeries
177
187
  DTYPE = 'bool'
178
188
 
179
- def test_resample(self):
180
- return NotImplemented
189
+ def test_resample(self, instance):
190
+ pytest.skip(f"not implemented for {type(instance).__name__}")
181
191
 
182
192
 
183
193
  # -- Bits ---------------------------------------------------------------------
@@ -326,7 +336,9 @@ class TestStateVector(_TestTimeSeriesBase):
326
336
  array.resample(array.sample_rate * 1.5)
327
337
 
328
338
  def test_to_from_lal_scaled_units(self):
329
- return NotImplemented
339
+ pytest.skip(
340
+ f"not implemented for {self.TEST_CLASS.__name__}",
341
+ )
330
342
 
331
343
  # -- data access ----------------------------
332
344
 
@@ -201,7 +201,7 @@ class TestTimeSeries(_TestTimeSeriesBase):
201
201
  def test_read_ascii_header(self, tmpdir):
202
202
  """Check that ASCII files with headers are read without extra options
203
203
 
204
- [regression: https://github.com/gwpy/gwpy/issues/1473]
204
+ [regression: https://gitlab.com/gwpy/gwpy/-/issues/1473]
205
205
  """
206
206
  txt = tmpdir / "text.txt"
207
207
  txt.write_text(
@@ -284,7 +284,7 @@ class TestTimeSeries(_TestTimeSeriesBase):
284
284
  """Check that each GWF API can read a series of files, either in
285
285
  a single process, or in multiple processes
286
286
 
287
- Regression: https://github.com/gwpy/gwpy/issues/1486
287
+ Regression: https://gitlab.com/gwpy/gwpy/-/issues/1486
288
288
  """
289
289
  fmt = "gwf" if api is None else "gwf." + api
290
290
  a1 = self.create(name='TEST')
@@ -512,7 +512,7 @@ class TestTimeSeries(_TestTimeSeriesBase):
512
512
  """Check that `TimeSeries.read` with `gap='raise'` actually
513
513
  raises appropriately.
514
514
 
515
- [regression: https://github.com/gwpy/gwpy/issues/1211]
515
+ [regression: https://gitlab.com/gwpy/gwpy/-/issues/1211]
516
516
  """
517
517
  from gwpy.io.cache import file_segment
518
518
  span = file_segment(utils.TEST_HDF5_FILE)
@@ -846,9 +846,7 @@ class TestTimeSeries(_TestTimeSeriesBase):
846
846
  gw150914.psd(abs(gw150914.span), method='lal_median_mean')
847
847
 
848
848
  # odd number of segments should warn
849
- # pytest hides the second DeprecationWarning that should have been
850
- # triggered here, for some reason
851
- with pytest.warns(UserWarning):
849
+ with pytest.warns(UserWarning), pytest.deprecated_call():
852
850
  gw150914.psd(1, .5, method='lal_median_mean')
853
851
 
854
852
  @pytest.mark.parametrize('method', ('welch', 'bartlett', 'median'))
@@ -1022,18 +1020,16 @@ class TestTimeSeries(_TestTimeSeriesBase):
1022
1020
  pytest.param('pycbc', marks=pytest.mark.requires("pycbc.psd")),
1023
1021
  ])
1024
1022
  def test_spectrogram_median_mean(self, gw150914, library):
1025
- method = '{0}-median-mean'.format(library)
1023
+ method = f"{library}-median-mean"
1026
1024
 
1027
- # median-mean warn on LAL if not given the correct data for an
1028
- # even number of FFTs.
1029
- # pytest only asserts a single warning, and UserWarning will take
1030
- # precedence apparently, so check that for lal
1025
+ # the LAL implementation of median-mean warns if not given the
1026
+ # correct amount of data for an even number of FFTs.
1031
1027
  if library == 'lal':
1032
- warn_ctx = pytest.warns(UserWarning)
1028
+ lal_warn_ctx = pytest.warns(UserWarning)
1033
1029
  else:
1034
- warn_ctx = pytest.deprecated_call()
1030
+ lal_warn_ctx = nullcontext()
1035
1031
 
1036
- with warn_ctx:
1032
+ with pytest.deprecated_call(), lal_warn_ctx:
1037
1033
  sg = gw150914.spectrogram(
1038
1034
  1.5,
1039
1035
  fftlength=.5,
@@ -88,23 +88,25 @@ class TestArray(object):
88
88
 
89
89
  # -- test basic construction ----------------
90
90
 
91
- def test_new(self):
92
- """Test Array creation
91
+ def assert_new(self, array):
92
+ """Run basic assertions for a new instance of the type under test.
93
93
  """
94
- # test basic empty contructor
95
- with pytest.raises(TypeError):
96
- self.TEST_CLASS()
97
-
98
- # test with some data
99
- array = self.create()
100
94
  utils.assert_array_equal(array.value, self.data)
101
95
 
102
96
  # test that copy=True ensures owndata
103
97
  assert self.create(copy=False).flags.owndata is False
104
98
  assert self.create(copy=True).flags.owndata is True
105
99
 
106
- # return array for subclasses to use
107
- return array
100
+ def test_new_empty(self):
101
+ """Test that `Array()` raises an exception.
102
+ """
103
+ with pytest.raises(TypeError):
104
+ self.TEST_CLASS()
105
+
106
+ def test_new(self):
107
+ """Test Array creation.
108
+ """
109
+ self.assert_new(self.create())
108
110
 
109
111
  def test_unit(self, array):
110
112
  # test default unit is dimensionless
@@ -198,7 +198,7 @@ class TestArray2D(_TestSeries):
198
198
 
199
199
  But still represent the output as an `Array2D` with `Index` arrays.
200
200
 
201
- This tests regression of https://github.com/gwpy/gwpy/issues/1504.
201
+ This tests regression of https://gitlab.com/gwpy/gwpy/-/issues/1504.
202
202
  """
203
203
  # create an array with indices
204
204
  a = self.create()
@@ -239,18 +239,14 @@ class TestArray2D(_TestSeries):
239
239
  with pytest.raises(IndexError):
240
240
  array.value_at(1.6, 4.8)
241
241
 
242
- @pytest.mark.skip("not implemented for >1D arrays")
243
242
  def test_pad(self):
244
- return NotImplemented
243
+ pytest.skip("not implemented for >1D arrays")
245
244
 
246
- @pytest.mark.skip("not implemented for >1D arrays")
247
245
  def test_pad_index(self):
248
- return NotImplemented
246
+ pytest.skip("not implemented for >1D arrays")
249
247
 
250
- @pytest.mark.skip("not implemented for >1D arrays")
251
248
  def test_pad_asymmetric(self):
252
- return NotImplemented
249
+ pytest.skip("not implemented for >1D arrays")
253
250
 
254
- @pytest.mark.skip("not applicable for >1D arrays")
255
251
  def test_single_getitem_not_created(self):
256
- return NotImplemented
252
+ pytest.skip("not implemented for >1D arrays")
@@ -36,11 +36,10 @@ from .test_array import TestArray as _TestArray
36
36
  class TestSeries(_TestArray):
37
37
  TEST_CLASS = Series
38
38
 
39
- def test_new(self):
40
- array = super().test_new()
39
+ def assert_new(self, array):
40
+ super().assert_new(array)
41
41
  assert array.x0 == units.Quantity(0, self.TEST_CLASS._default_xunit)
42
42
  assert array.dx == units.Quantity(1, self.TEST_CLASS._default_xunit)
43
- return array
44
43
 
45
44
  # -- test properties ------------------------
46
45
 
@@ -168,7 +167,7 @@ class TestSeries(_TestArray):
168
167
 
169
168
  When subsetting a Series with an iterable of integer indices,
170
169
  make sure that the xindex, if it exists, is also subsetted. Tests
171
- regression against https://github.com/gwpy/gwpy/issues/1680.
170
+ regression against https://gitlab.com/gwpy/gwpy/-/issues/1680.
172
171
  """
173
172
  array.xindex # create xindex
174
173
  indices = numpy.array([0, 1, len(array)-1])
@@ -250,7 +249,8 @@ class TestSeries(_TestArray):
250
249
  def test_crop_float_precision(self):
251
250
  """Verify the float precision of the crop function.
252
251
 
253
- This tests regression against https://github.com/gwpy/gwpy/issues/1601.
252
+ This tests against regression of
253
+ https://gitlab.com/gwpy/gwpy/-/issues/1601.
254
254
  """
255
255
  # construct empty data array with the right shape for this array object
256
256
  shape = (101,) * self.TEST_CLASS._ndim
@@ -62,7 +62,11 @@ def format_citations(
62
62
  "page": 1,
63
63
  "size": int(hits),
64
64
  }
65
- resp = requests.get(apiurl, params) # make the request
65
+ resp = requests.get( # make the request
66
+ apiurl,
67
+ params=params,
68
+ timeout=30,
69
+ )
66
70
  resp.raise_for_status() # make sure it worked
67
71
  records = resp.json() # parse the response
68
72
 
@@ -85,15 +85,20 @@ MOCK_ZENODO_API_RST = """
85
85
  """.strip()
86
86
 
87
87
 
88
- def pytest_skip_rate_limit(func):
89
- """Execute `func` but skip if it raises a rate limit error
88
+ def pytest_skip_zenodo_http_errors(func):
89
+ """Execute `func` but skip if it raises a known server-side error.
90
90
  """
91
91
  @wraps(func)
92
92
  def wrapper(*args, **kwargs):
93
93
  try:
94
94
  return func(*args, **kwargs)
95
95
  except requests.HTTPError as exc: # pragma: no cover
96
- if str(exc).startswith("403 Client Error: rate limit exceeded"):
96
+ if (
97
+ # API rate limit
98
+ str(exc).startswith("403 Client Error: rate limit exceeded")
99
+ # Bad Gateway
100
+ or exc.response.status_code == 502
101
+ ):
97
102
  pytest.skip(str(exc))
98
103
  raise
99
104
  return wrapper
@@ -101,7 +106,7 @@ def pytest_skip_rate_limit(func):
101
106
 
102
107
  @pytest.fixture
103
108
  @pytest_skip_network_error
104
- @pytest_skip_rate_limit
109
+ @pytest_skip_zenodo_http_errors
105
110
  def latest():
106
111
  """Get the latest release of GWpy from the GitHub API.
107
112
  """
@@ -114,7 +119,7 @@ def latest():
114
119
 
115
120
 
116
121
  @pytest_skip_network_error
117
- @pytest_skip_rate_limit
122
+ @pytest_skip_zenodo_http_errors
118
123
  def test_zenodo_format_citations_latest(latest):
119
124
  """Check that :func:`gwpy.utils.sphinx.zenodo.format_citations` includes
120
125
  the latest actual release in the output.
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.2
2
+ Name: gwpy
3
+ Version: 3.0.11
4
+ Summary: A python package for gravitational-wave astrophysics
5
+ Author-email: Duncan Macleod <duncan.macleod@ligo.org>
6
+ License: GPL-3.0-or-later
7
+ Project-URL: Bug Tracker, https://gitlab.com/gwpy/gwpy/-/issues
8
+ Project-URL: Discussion Forum, https://gwpy.slack.com
9
+ Project-URL: Documentation, https://gwpy.github.io/docs/
10
+ Project-URL: Source Code, https://gitlab.com/gwpy/gwpy
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
23
+ Classifier: Topic :: Scientific/Engineering :: Physics
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: astropy>=4.3.0
28
+ Requires-Dist: dateparser>=1.1.4
29
+ Requires-Dist: dqsegdb2
30
+ Requires-Dist: gwdatafind>=1.1.0
31
+ Requires-Dist: gwosc>=0.5.3
32
+ Requires-Dist: h5py>=3.0.0
33
+ Requires-Dist: igwn-segments>=2.0.0
34
+ Requires-Dist: ligotimegps>=1.2.1
35
+ Requires-Dist: matplotlib>=3.3.0
36
+ Requires-Dist: numpy>=1.19.5
37
+ Requires-Dist: packaging>=24.1
38
+ Requires-Dist: python-dateutil
39
+ Requires-Dist: requests>=2.20.0
40
+ Requires-Dist: scipy>=1.6.0
41
+ Requires-Dist: tqdm>=4.52.0
42
+ Provides-Extra: test
43
+ Requires-Dist: coverage[toml]>=5.0; extra == "test"
44
+ Requires-Dist: pytest>=3.9.1; extra == "test"
45
+ Requires-Dist: pytest-freezer; extra == "test"
46
+ Requires-Dist: pytest-cov>=2.4.0; extra == "test"
47
+ Requires-Dist: pytest-requires; extra == "test"
48
+ Requires-Dist: pytest-socket; extra == "test"
49
+ Requires-Dist: pytest-xdist; extra == "test"
50
+ Requires-Dist: requests-mock; extra == "test"
51
+ Provides-Extra: astro
52
+ Requires-Dist: inspiral-range>=0.5.0; extra == "astro"
53
+ Provides-Extra: docs
54
+ Requires-Dist: numpydoc>=0.8.0; extra == "docs"
55
+ Requires-Dist: Sphinx>=4.4.0; extra == "docs"
56
+ Requires-Dist: sphinx-automodapi; extra == "docs"
57
+ Requires-Dist: sphinx-immaterial>=0.7.3; extra == "docs"
58
+ Requires-Dist: sphinxcontrib-programoutput; extra == "docs"
59
+ Provides-Extra: dev
60
+ Requires-Dist: ciecplib; extra == "dev"
61
+ Requires-Dist: inspiral-range>=0.5.0; extra == "dev"
62
+ Requires-Dist: lalsuite; sys_platform != "win32" and extra == "dev"
63
+ Requires-Dist: lscsoft-glue; sys_platform != "win32" and extra == "dev"
64
+ Requires-Dist: psycopg2; sys_platform == "linux" and extra == "dev"
65
+ Requires-Dist: pycbc>=1.13.4; sys_platform != "win32" and extra == "dev"
66
+ Requires-Dist: pymysql; extra == "dev"
67
+ Requires-Dist: python-ligo-lw>=1.7.0; sys_platform != "win32" and extra == "dev"
68
+ Requires-Dist: sqlalchemy; extra == "dev"
69
+ Requires-Dist: uproot>=4.1.5; extra == "dev"
70
+ Provides-Extra: conda
71
+ Requires-Dist: lxml!=4.9.1; sys_platform == "win32" and extra == "conda"
72
+ Requires-Dist: python-framel!=8.46.0,>=8.40.1; extra == "conda"
73
+ Requires-Dist: python-ldas-tools-framecpp; (sys_platform != "win32" and python_version < "3.12") and extra == "conda"
74
+ Requires-Dist: python-nds2-client; extra == "conda"
75
+
76
+ GWpy is a collaboration-driven Python package providing tools for
77
+ studying data from ground-based gravitational-wave detectors.
78
+
79
+ GWpy provides a user-friendly, intuitive interface to the common
80
+ time-domain and frequency-domain data produced by the LIGO and Virgo
81
+ observatories and their analyses, with easy-to-follow tutorials at each
82
+ step.
83
+
84
+ <https://gwpy.github.io>
85
+
86
+ # Release status
87
+
88
+ [![PyPI version](https://badge.fury.io/py/gwpy.svg)](http://badge.fury.io/py/gwpy)
89
+ [![Conda version](https://img.shields.io/conda/vn/conda-forge/gwpy.svg)](https://anaconda.org/conda-forge/gwpy/)
90
+
91
+ [![License](https://img.shields.io/pypi/l/gwpy.svg)](https://choosealicense.com/licenses/gpl-3.0/)
92
+ ![Supported Python versions](https://img.shields.io/pypi/pyversions/gwpy.svg)
93
+
94
+ # Development status
95
+
96
+ [![Build status](https://gitlab.com/gwpy/gwpy/badges/main/pipeline.svg)](https://gitlab.com/gwpy/gwpy/-/pipelines/?ref=main)
97
+ [![Coverage status](https://gitlab.com/gwpy/gwpy/badges/main/coverage.svg)](https://gitlab.com/gwpy/gwpy/-/pipelines/?ref=main)
98
+
99
+ # Installation
100
+
101
+ To install, you can do:
102
+
103
+ ```
104
+ conda install -c conda-forge gwpy
105
+ ```
106
+
107
+ or
108
+
109
+ ```
110
+ python -m pip install gwpy
111
+ ```
112
+
113
+ You can test your installation, and its version by
114
+
115
+ ```
116
+ python -c "import gwpy; print(gwpy.__version__)"
117
+ ```
118
+
119
+ # License
120
+
121
+ GWpy is released under the GNU General Public License v3.0 or later, see
122
+ [here](https://choosealicense.com/licenses/gpl-3.0/) for a description of
123
+ this license, or see the
124
+ [LICENSE](https://gitlab.com/gwpy/gwpy/-/blob/main/LICENSE) file for the
125
+ full text.