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
Interpolate on axis #3214
Merged
ericpre
merged 17 commits into
hyperspy:RELEASE_next_major
from
pietsjoh:interpolate_to_axis
Sep 24, 2023
Merged
Interpolate on axis #3214
ericpre
merged 17 commits into
hyperspy:RELEASE_next_major
from
pietsjoh:interpolate_to_axis
Sep 24, 2023
Conversation
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
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## RELEASE_next_major #3214 +/- ##
======================================================
+ Coverage 81.25% 81.38% +0.12%
======================================================
Files 173 173
Lines 24192 24352 +160
Branches 5621 5677 +56
======================================================
+ Hits 19657 19818 +161
+ Misses 3236 3222 -14
- Partials 1299 1312 +13
☔ View full report in Codecov by Sentry. |
jlaehne
reviewed
Aug 31, 2023
ericpre
approved these changes
Sep 1, 2023
Closed
ericpre
reviewed
Sep 2, 2023
ericpre
reviewed
Sep 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the change
The idea for this feature came from the wish to create the functionality to remove the background from a signal (
remove_background_signal
). For this problem the signal dimension is usually 1 and the background signal is loaded from a seperate file. The axis of the background signalb
doesn't necessarily match the axis of the measured signals
. Thus for the subtraction of the background it would be nice to simply interpolate theb
onto the axis ofs
and then subtracts-b
.This PR aims to solve the interpolation part, which may be more generally useful. The function
interpolate_on_axis()
takes an axis (UniformDataAxis
,FunctionalDataAxis
orDataAxis
) as input and replaces an axis (specified by an index). The data is interpolated usingscipy.interpolate.interp1d
in the process. This feature works both on signal and navigation axes and replaces one axes for a signal with arbitrary dimensions. Moreover, it can be used to switch between different axis types.Progress of the PR
bounds_error
?)set_axis
or fromaxes_manager
?)upcoming_changes
folder (seeupcoming_changes/README.rst
),readthedocs
doc build of this PR (link in github checks)Minimal example of the bug fix or the new feature