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

Update residual line when model line is changed. #3352

Closed

Conversation

HanHsuanWu
Copy link
Contributor

@HanHsuanWu HanHsuanWu commented Apr 10, 2024

Currently, the plotted residual is not being updated whenever the model line changes.
So I added update for model._residual_line whenever mode._model_line is being updated.

import numpy as np
import hyperspy.api as hs

# Random Signal1D signal
s = hs.signals.Signal1D(data=np.random.random((2, 2, 1024)), 
                        axes=[{'name': 'x', 'size': 2}, 
                              {'name': 'y', 'size': 2}, 
                              {'name': 'sig', 'size': 1024}])
# Model object with Polynomial component
m = s.create_model()
# Polynomial=hs.model.components1D.Polynomial()
# m.append(Polynomial)
m.append(hs.model.components1D.PowerLaw())
m.plot(plot_residual=True)

@jlaehne
Copy link
Contributor

jlaehne commented Apr 11, 2024

I think it would make sense to rebase this on release_next_PATCH. Tests are failing.

@ericpre
Copy link
Member

ericpre commented Apr 11, 2024

@HanHsuanWu, in case you are familiar with rebasing, there are some basic instructions in the developer guide on how to rebase - you may find more detailed instructions elsewhere online but this is not always very clear when not familiar with git!
It is not always straighforward to rebase correctly and quite often it is easier to start from scratch with an up to date branch and cherry-pick the commits or copy and paste the code manually.

The difference between the various branches that we use is explained in the developer guide too.

HanHsuanWu added a commit to HanHsuanWu/hyperspy that referenced this pull request Apr 11, 2024
Update residual line when model line is changed. hyperspy#3352
@HanHsuanWu
Copy link
Contributor Author

Thanks guys I opened a new commit in #3355.

@ericpre
Copy link
Member

ericpre commented Apr 11, 2024

Closing in favour of #3355.

@ericpre ericpre closed this Apr 11, 2024
ericpre pushed a commit to HanHsuanWu/hyperspy that referenced this pull request Jun 6, 2024
Update residual line when model line is changed. hyperspy#3352
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

3 participants