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 disconnecting events when closing figure and remove_background is active #2734

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented May 8, 2021

Progress of the PR

  • Fix disconnecting events when closing figure and remove_background is active
  • add tests,
  • ready for review.

Minimal example of the bug fix or the new feature

import hyperspy.api as hs
import matplotlib.pyplot as plt
import numpy as np

s = hs.signals.Signal1D(np.arange(1000).reshape((10, 100)))
s.plot()
number_connected_events = len(s.axes_manager.events.indices_changed.connected)
s.remove_background(background_type='Polynomial')
plt.close()
s.plot()

# check the events connected to `axes_manager` when calling `remove_background` are disconnected when closing the figure plot
assert number_connected_events == len(s.axes_manager.events.indices_changed.connected)

@codecov
Copy link

codecov bot commented May 8, 2021

Codecov Report

Merging #2734 (9c54568) into RELEASE_next_patch (74c4cd4) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           RELEASE_next_patch    #2734      +/-   ##
======================================================
+ Coverage               77.24%   77.30%   +0.06%     
======================================================
  Files                     202      202              
  Lines                   30035    30037       +2     
  Branches                 6559     6560       +1     
======================================================
+ Hits                    23201    23221      +20     
+ Misses                   5086     5068      -18     
  Partials                 1748     1748              
Impacted Files Coverage Δ
hyperspy/signal_tools.py 68.28% <100.00%> (+1.26%) ⬆️
hyperspy/drawing/signal1d.py 77.40% <0.00%> (+0.90%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74c4cd4...9c54568. Read the comment docs.

@francisco-dlp francisco-dlp merged commit 4713edc into hyperspy:RELEASE_next_patch May 10, 2021
@ericpre ericpre deleted the fix_disconnection_remove_background branch May 10, 2021 14:48
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