Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces additional weighting options for RM-synthesis, including support for natural and Briggs weighting, and updates related function signatures and configuration options. Key changes include:
- Introducing a new WEIGHT_TYPES literal and updating the FDFOptions option to support four weighting types with a new robust parameter.
- Adding four functions (uniform_weight, noise_weight, natural_weight, briggs_weight) to compute weights based on the selected option.
- Updating the compute_rmsynth_params logic and the run_rmsynth signature to accommodate the new weighting options and robust parameter.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rm_lite/utils/synthesis.py | Adds new weighting functions and updates FDFOptions and weight computation logic. |
| rm_lite/tools_1d/rmsynth.py | Updates parameter types and passes the robust parameter to the synthesis functions. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR introduces new weighting options and related API updates for RM-synthesis. Key changes include defining a new literal type (WEIGHT_TYPES), updating default weighting from "variance" to "uniform" (with support for natural and Briggs weighting), and propagating the new strict parameter to several function calls and examples.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_nufft.py | Added strict=False flag to the helper call in tests |
| rm_lite/utils/synthesis.py | Defined new WEIGHT_TYPES and refactored weighting logic with match-case |
| rm_lite/utils/fitting.py | Updated the call to sf.round to include strict=False |
| pyproject.toml | Raised the minimum Python version and updated classifiers |
| .github/workflows/ci.yml | Updated supported Python versions |
Comments suppressed due to low confidence (3)
rm_lite/utils/synthesis.py:573
- The use of match-case for selecting the weighting method greatly improves readability; ensure that tests fully cover all cases (including the error branch) for these new weighting options.
match fdf_options.weight_type:
rm_lite/utils/fitting.py:292
- Verify that the sf.round function accepts the strict parameter and that its behavior with strict=False is as expected, ensuring consistency across the codebase.
+ fit_vals = [sf.round(p, e) for p, e in zip(popt, errors, strict=False)]
pyproject.toml:14
- Updating the required Python version to >=3.10 is appropriate given new syntax features; ensure that this change is clearly communicated to contributors and documented in the release notes.
+requires-python = ">=3.10"
| @@ -427,6 +427,7 @@ def test_rmsf(): | |||
| ["phi2Arr", "RMSFcube", "fwhmRMSFArr"], | |||
| [phi2Arr, RMSFcube, fwhmRMSFArr], | |||
| [phi2Arr_old, RMSFcube_old, fwhmRMSFArr_old], | |||
There was a problem hiding this comment.
[nitpick] Consider adding a brief comment explaining the purpose of the 'strict=False' flag in this test context to aid future maintainers.
| [phi2Arr_old, RMSFcube_old, fwhmRMSFArr_old], | |
| [phi2Arr_old, RMSFcube_old, fwhmRMSFArr_old], | |
| # Allow iterables of different lengths without raising an error, as this is acceptable in this test context. |
| return TheoreticalNoise(**as_dict) | ||
|
|
||
|
|
||
| WEIGHT_TYPES = Literal["variance", "uniform", "natural", "briggs"] |
There was a problem hiding this comment.
[nitpick] It may be beneficial to update the function docstrings and related documentation to reflect the new valid weighting types and any changes in default behavior.
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
==========================================
+ Coverage 71.09% 80.64% +9.54%
==========================================
Files 13 13
Lines 1249 1121 -128
==========================================
+ Hits 888 904 +16
+ Misses 361 217 -144 ☔ View full report in Codecov by Sentry. |
Adds Robust and other forms of weighting