Open
Conversation
Added a private method to scale signal stacks by exposure time, with validation checks for each element. Updated metadata accordingly to reflect scaling.
Contributor
|
To avoid duplicating similar code it could make sense to have a private function for scaling a single element. For a normal signal it would be called from the main function with a parameter telling it to access the For a stack, it would also make sense if |
To reduce the repetition of code, I've split the functionality into two private functions, one which handles the scaling of each signal or stack element, and one which updates this to the metadata. The scale_by_exposure wrapper is now for primarily looping these private functions when appropriate.
Author
|
This commit also handles stacks of signals which have navigational axes as well, (e.g. stacks of hyperspectral maps) by locating the |
This file contains hidden or 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
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.
How stack metadata works + Current situation
Signals created with
hs.stackcan stack the metadata of each signal with thestack_metadata=Trueargument. However, when callingstack1.metadatathe metadata called belongs to the first signal in the stack.The existing scale_by_exposure function accesses
stack1.metadata, therefore scaling the whole stack by the integration time of the first signal in the stack.To access the metadata of each individual signal in the stack
stack1.original_metadatacan be called giving:The function proposed goes into the metadata of each element (as seen above) and scales for each signal's individual integration time. This is useful for handling any stack of signals where the integration time differs between the stacked signals.
Description of the change
scale_by_exposure- determining whether signal has metadata for stack elements_scale_by_exposure_stackis called which performs same operations as existingscale_by_exposurebut loops through navigational axis of stack for each signal contained*I didn't see a neat way for this functionality to fit into the existing
scale_by_exposurewithout repeating chunks of code/making sub functionProgress of the PR
_scale_by_exposure_stack_scale_by_exposure_stackfor handling stacks with of signals with navigational axes (looping through stack inav fails for this case currently)upcoming_changesfolder (seeupcoming_changes/README.rst),docs/readthedocs.org:lumispybuild of this PR (link in github checks),Minimal example of the bug fix or the new feature