Skip to content

Conversation

@glass-ships
Copy link
Member

Description of work:

Migrates scaling factor calculations for stitching from RefRed.
Adds utility dataclasses to hold datasets and region overlap info

Check all that apply:

  • updated documentation
  • Source added/refactored
  • Added unit tests
  • Added integration tests
  • Verified that tests requiring the /SNS and /HFIR filesystems pass without fail

References:

⚠️ Manual test for the reviewer

(Instructions for testing here)

Check list for the reviewer

  • best software practices
    • clearly named variables (better to be verbose in variable names)
    • code comments explaining the intent of code blocks
  • All the tests are passing
  • The documentation is up to date
  • code comments added when explaining intent

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 96.51741% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.52%. Comparing base (70e99ec) to head (6db06ad).
⚠️ Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
...s/unit/lr_reduction/test_overlap_scaling_factor.py 94.52% 4 Missing ⚠️
tests/test_scaling_factors_workflow.py 97.61% 2 Missing ⚠️
tests/test_scaling_factors.py 97.72% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next      #99      +/-   ##
==========================================
- Coverage   98.99%   98.52%   -0.47%     
==========================================
  Files          11       13       +2     
  Lines         694      812     +118     
==========================================
+ Hits          687      800     +113     
- Misses          7       12       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates scaling factor calculations for stitching from RefRed, introducing new utility dataclasses and methods to handle normalization and stitching of reduced neutron reflectometry data. The implementation calculates scaling factors both for critical edge normalization and for overlapping regions between datasets.

  • Introduces ReducedData and OverlapInfo dataclasses to structure reduced datasets and overlap region metadata
  • Implements scaling_factor_critical_edge function for critical edge normalization
  • Adds OverlapScalingFactor class with methods to calculate scaling factors for overlapping data regions using linear fitting

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 23 comments.

File Description
src/lr_reduction/normalization_and_stitching.py New module containing dataclasses and scaling factor calculation logic for normalization and stitching operations
tests/test_normalization_and_stitching.py New test file with fixtures and test cases for scaling factor calculations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glass-ships glass-ships requested a review from backmari December 18, 2025 18:35
@glass-ships glass-ships self-assigned this Dec 18, 2025
Copy link
Collaborator

@backmari backmari left a comment

Choose a reason for hiding this comment

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

This PR adds logic for calculating critical edge scaling factor and scaling factor for stitching two runs. The logic is copied as close as possible from existing logic in RefRed in order to move calculation logic from the frontend to the backend. This also adds new unit testing for the scaling factor calculations. Looks good 👌

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.

4 participants