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
Bug iterate signal with markers #1968
Bug iterate signal with markers #1968
Conversation
This would be a better fit for Release next patch, could you rebase it? |
Hi @francisco-dlp, Yes, I can do this, no problem :) Just a question, to be sure; I see a message that you changed the base branch from |
Yes, that's correct, sorry for the misleading message: it was just a quick way to verify if you have branched from Release next patch but sent it to Rnm by mistake. |
a4275d0
to
4ba2860
Compare
4ba2860
to
84753ec
Compare
Done! Instead of rebasing the existing branch, I have branched anew from Thankfully I only had a few commits: I ran into many issues when trying to rebase this branch from RNM to RNP. After initially fetching RNP, I tried
This produced many merging issues, that I was asked to solve separately, from commits spanning several years ago! I was sure something was not going as it should, but I couldn't fix this so I gave up on the rebase approach. Any idea about what I did wrong? I will try to finish the work on this branch soon, as I had forgotten I still wanted to add some tests. |
@francisco-dlp I've finally had some time to implement a test for this PR. I believe that it should be ready now for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for the small questions.
@@ -472,4 +472,42 @@ def test_plot_eds_lines(): | |||
s.plot(True) | |||
s.axes_manager.navigation_axes[0].index = 1 | |||
return s._plot.signal_plot.figure | |||
|
|||
|
|||
@update_close_figure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you refer to the import BaseSignal
? I use a basesignal to test in test_iterate_markers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meand @update_close_figure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is needed to close the figure that is created when add_marker
is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, it seems it is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the purpose of this in other tests is to test if closing the plot closes the markers without issue. Having it here may make this test fail if that gets broken what may be confusing. However, @ericpre should know better.
assert mo.get_data_position('text') == mi.get_data_position('text') | ||
assert mo.marker_properties['color'] == \ | ||
mi.marker_properties['color'] | ||
return ims |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test compares the markers from the sub-signal ims
with the markers from the original signal im
. It should check if the markers are replicated correctly when the signal is iterated into sub-signals; for im in ims
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree but, why does it have to return ims
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups! certainly not. I will remove that together with the update_close_figure.
Thanks for reviewing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly, the update_close_figure
decorator is to check that the plots are closing without raising any error. It doesn't seem to be required here because this should be covered elsewhere.
Could you merge Rnm in? |
Done! Thanks for the clarifications regarding the |
Description
A signal with markers cannot be iteratively plotted, an error is raised (see MEW below). The origin is that
signal.get_current_signal
does not copy correctly the markers. This PR tries to fix this by:signal.__deepcopy__
.marker.auto_update
property, data from multidimensional markers is indexed appropriately.Of course, this is only a proposal to fix the bug open to discussion, I just try to be constructive ;)
BTW I pushed this branch to the main repository by mistake since my remote was not properly configured. I since deleted this, and I am sorry for the mistake!
Progress of the PR
Minimal example of the bug fix
In this MEW, 4 different point, text and rectangle markers are added to a signal with 3 images (4 markers to each image). These have to replicate once the signal is iterated into 3 new images and plotted.