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

Refactoring for SpectrumROI #2506

Merged
merged 7 commits into from
Feb 26, 2025
Merged

Refactoring for SpectrumROI #2506

merged 7 commits into from
Feb 26, 2025

Conversation

samtygier-stfc
Copy link
Collaborator

@samtygier-stfc samtygier-stfc commented Feb 24, 2025

Work on #2378

Description

Refactoring for SpectrumROI
Remove some unnecessary methods simplify others

Needs rebase after #2500

Developer Testing

I have tested manually and run system tests

Acceptance Criteria and Reviewer Testing

  • Unit tests pass locally: python -m pytest -vs
  • In spectrum viewer
    • Adding and removing ROIs
    • Renaming ROIs
    • Changing ROI colour
    • Resizing ROI from image view or properties

Documentation and Additional Notes

Not needed

@samtygier-stfc samtygier-stfc marked this pull request as ready for review February 24, 2025 15:00
@coveralls
Copy link

coveralls commented Feb 24, 2025

Coverage Status

coverage: 72.846% (-0.02%) from 72.87%
when pulling 4ee4026 on 2378-refactor-roi
into 65f8cf5 on main.

Copy link
Collaborator

@MikeSullivan7 MikeSullivan7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should self.roi_dict: dict[str, ROI] = {} in SpectrumWidget not be self.roi_dict: dict[str, SpectrumROI] = {} as we use SpectrumROI methods on it, e.g. adjust_spec_roi().

Also we have roi_dict: dict[str, ROI] on line 112 and self.roi_dict: dict[str, ROI] = {} on line 141 which is unnecessary.

@samtygier-stfc
Copy link
Collaborator Author

Good spot. That gives some stricter type checking else where, so needed to fix the type for colour in a few places.

Copy link
Collaborator

@MikeSullivan7 MikeSullivan7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes look good, code is a lot more streamlined and easier to read now. All tests pass and Spectrum Viewer behaves as expected when going through usual workflows of using the ROIs.

@MikeSullivan7 MikeSullivan7 added this pull request to the merge queue Feb 26, 2025
Merged via the queue into main with commit c409e60 Feb 26, 2025
8 checks passed
@MikeSullivan7 MikeSullivan7 deleted the 2378-refactor-roi branch February 26, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants