usnistgov / mass

Microcalorimeter pulse-analysis software
MIT License
6 stars 0 forks source link

Fix some annoying warnings in the test suite #226

Closed joefowler closed 2 years ago

joefowler commented 2 years ago

Original report by Joseph Fowler (Bitbucket: joe_fowler, ).


Test suite gives some warnings:

====================================================================== warnings summary ======================================================================
../../../../../opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/xraydb/utils.py:27
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/xraydb/utils.py:27: DeprecationWarning: Please use `physical_constants` from the `scipy.constants` namespace, the `scipy.constants.codata` namespace is deprecated.
    R_ELECTRON_CM = 100.0 * consts.codata.physical_constants['classical electron radius'][0]

mass/core/test_core.py: 9 warnings
mass/core/test_filtering.py: 8 warnings
mass/regression_test/test_regression.py: 1 warning
  /Users/fowlerj/Software/src/mass/mass/core/channel.py:937: FutureWarning: Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
    self.peak_samplenumber = int(sp.stats.mode(peak_idx)[0][0])

mass/off/test_channels.py::TestSummaries::test_refresh_from_files
  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function Infinite.__del__ at 0x1329c7010>

  Traceback (most recent call last):
    File "/Users/fowlerj/Library/Python/3.10/lib/python/site-packages/progress/__init__.py", line 60, in __del__
      if self._hidden_cursor:
  AttributeError: 'SilenceBar' object has no attribute '_hidden_cursor'

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================= 187 passed, 20 warnings in 13.75s ==============================================================

The warning from xraydb is out of my hands, but I think we can fix the others.

joefowler commented 2 years ago

Original comment by Joseph Fowler (Bitbucket: joe_fowler, ).


Go back to old sp.stats.mode for older sp versions

Fixes #226.

joefowler commented 1 year ago

Original comment by Joseph Fowler (Bitbucket: joe_fowler, ).


Removing milestone: v0.7 (automated comment)