Added custom caching for get_spectrum and add ROI handling improvements #2191
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.
Issue
Description
Added custom caching for get_spectrum and added ROI handling improvements
Added a custom caching mechanism using a dictionary in the model
Added methods to manage the cache, including
_roi_to_key
for converting SensibleROI to hashable keys andclear_cache
for clearing the cache.Improved
get_spectrum
to use tacheAdded
can_incrementally_update` determine if updates are possible based on ROI shifts and size changes.
Added
update_spectrum` update the spectrum by calculating differences introduced by ROI changes.
Added
calculate_removed_data
andcalculate_added_data
compute data points removed and added when the ROI changes.Updated
update_cached_data
to remove and add data into the cached valueTesting
It needs a lot more messing around with to find the errors I have already picked up on a few. Plus other things like thresholds
Acceptance Criteria
Documentation
Updated the documentation in the appropriate file in docs/release_notes to reflect the added functionality for ROI speed optimization.