Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Numpy1.25 deprecation #3189

Merged
merged 4 commits into from Jul 13, 2023

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented Jul 2, 2023

See failure in https://github.com/hyperspy/hyperspy-extensions-list/actions/runs/5434206100/jobs/9882458789

_____________ ERROR collecting tests/signals/test_find_peaks2D.py ______________
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/share/miniconda3/envs/test/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/hyperspy/tests/signals/test_find_peaks2D.py:[97](https://github.com/hyperspy/hyperspy-extensions-list/actions/runs/5434206100/jobs/9882458789#step:18:98): in <module>
    DATASETS = _generate_dataset()
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/hyperspy/tests/signals/test_find_peaks2D.py:73: in _generate_dataset
    sparse_nav2d_shifted.align2D(shifts=shifts, fill_value=0)
/usr/share/miniconda3/envs/test/lib/python3.11/site-packages/hyperspy/_signals/signal2d.py:749: in align2D
    int(np.floor(signal_shifts.isig[0].min().data)) if signal_shifts.isig[0].min().data < 0 else None,
E   DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

Progress of the PR

  • Fix Numpy1.25 deprecation: implicite array to scalar conversion in align2D,
  • [n/a] update docstring (if appropriate),
  • [n/a] update user guide (if appropriate),
  • add an changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting changelog entry in the readthedocs doc build of this PR (link in github checks)
  • [n/a] add tests,
  • ready for review.

@codecov
Copy link

codecov bot commented Jul 2, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.05 ⚠️

Comparison is base (3e7a7e0) 81.27% compared to head (067c661) 81.23%.

Additional details and impacted files
@@                  Coverage Diff                   @@
##           RELEASE_next_major    #3189      +/-   ##
======================================================
- Coverage               81.27%   81.23%   -0.05%     
======================================================
  Files                     176      176              
  Lines                   24401    24409       +8     
  Branches                 5683     5683              
======================================================
- Hits                    19833    19829       -4     
- Misses                   3261     3274      +13     
+ Partials                 1307     1306       -1     
Impacted Files Coverage Δ
hyperspy/_signals/signal2d.py 81.84% <100.00%> (+0.44%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

upcoming_changes/3189.maintenance.rst Outdated Show resolved Hide resolved
@jlaehne jlaehne merged commit cc03d73 into hyperspy:RELEASE_next_major Jul 13, 2023
19 of 22 checks passed
@ericpre ericpre deleted the numpy1.25_deprecation branch July 13, 2023 13:15
ericpre added a commit that referenced this pull request Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants