-
Notifications
You must be signed in to change notification settings - Fork 10
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 deprecation warnings #33
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d4519ae
Fix `scipy.integrate.simps` deprecation warnings
ericpre 70e1fdc
Use hyperspy public API in favour of private API
ericpre 4ccee1e
Use new polynomial API from numpy, as it is recommended since numpy 1.4
ericpre 06460d7
Fix numpy deprecation: "Conversion of an array with ndim > 0 to a sca…
ericpre bae3882
Add changelog entry
ericpre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,16 +60,14 @@ | |
variance2fit = variance | ||
average2fit = average | ||
|
||
fit = np.polyfit(average2fit, variance2fit, pol_order) | ||
fit = np.polynomial.Polynomial.fit(average2fit, variance2fit, pol_order) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole function seems to be missing a test as all touched lines raise a warning. |
||
if weighted is True: | ||
from hyperspy._signals.signal1D import Signal1D | ||
from hyperspy.models.model1d import Model1D | ||
from hyperspy.components1d import Line | ||
import hyperspy.api as hs | ||
|
||
s = Signal1D(variance2fit) | ||
s = hs.signals.Signal1D(variance2fit) | ||
s.axes_manager.signal_axes[0].axis = average2fit | ||
m = Model1D(s) | ||
line = Line() | ||
m = s.create_model() | ||
line = hs.model.components1D.Polynomial() | ||
line.a.value = fit[1] | ||
line.b.value = fit[0] | ||
m.append(line) | ||
|
@@ -109,29 +107,30 @@ | |
"""Find the scale and offset of the Poissonian noise | ||
|
||
By comparing an SI with its denoised version (i.e. by PCA), | ||
this plots an | ||
estimation of the variance as a function of the number of counts | ||
and fits a | ||
polynomy to the result. | ||
this plots an estimation of the variance as a function of the number of counts | ||
and fits a polynomial to the result. | ||
|
||
Parameters | ||
---------- | ||
noisy_SI, clean_SI : signal1D.Signal1D instances | ||
mask : numpy bool array | ||
noisy_SI, clean_SI : hyperspy.api.signals.Signal1D | ||
mask : numpy.ndarray | ||
To define the channels that will be used in the calculation. | ||
pol_order : int | ||
The order of the polynomy. | ||
The order of the polynomial. | ||
higher_than: float | ||
To restrict the fit to counts over the given value. | ||
return_results : Bool | ||
plot_results : Bool | ||
return_results : bool | ||
Whether to return the results or not. | ||
plot_results : bool | ||
Whether to plot the results or not. | ||
store_results: {True, False, "ask"}, default "ask" | ||
If True, it stores the result in the signal metadata | ||
|
||
Returns | ||
------- | ||
Dictionary with the result of a linear fit to estimate the offset | ||
and scale factor | ||
dict | ||
Dictionary with the result of a linear fit to estimate the offset | ||
and scale factor | ||
|
||
""" | ||
with noisy_signal.unfolded(), clean_signal.unfolded(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix deprecation scipy and numpy warnings. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 test for this component?