rpdmb.save: L2norm_fractional_tolerance#165
Open
markscheel wants to merge 1 commit into
Open
Conversation
Fixes sxs-collaboration#162 1) L2norm_fractional_tolerance is now used for w.truncate and nothing else. Using None or values <=0 for this parameter means no truncation. 2) There is a new parameter corotating_frame_tolerance that is the tolerance passed into w.to_corotating_frame. It defaults to L2norm_fractional_tolerance for backward compatibility. 3) The code paths that formerly were taken when L2norm_fractional_tolerance==None are now gone. These code paths were apparently used by Mike for testing. There were two code paths: 1) Don't do any of the RPDMB operations and 2) bypass shuffle_widths, use the standard shuffling, and write different attributes into the h5 file. It appears to me that 2) would result in files that could not be read by rpdmb.load (since the attributes looked for by rpdmb.load would be missing).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #165 +/- ##
==========================================
- Coverage 44.24% 44.15% -0.10%
==========================================
Files 83 83
Lines 6208 6201 -7
Branches 1009 1008 -1
==========================================
- Hits 2747 2738 -9
- Misses 3209 3211 +2
Partials 252 252 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
moble
requested changes
Jun 18, 2025
Comment on lines
+65
to
+66
| If L2norm_fractional_tolerance is <=0.0 or None, then no | ||
| truncation is done. |
Member
There was a problem hiding this comment.
We should just skip the None possibility. The old code that would have used that is gone anyway, so it won't break anything more. If anything, letting it succeed but take a different path would be a bad thing.
Suggested change
| If L2norm_fractional_tolerance is <=0.0 or None, then no | |
| truncation is done. | |
| If L2norm_fractional_tolerance is <=0.0, then no | |
| truncation is done. |
Comment on lines
+141
to
+147
| if corotating_frame_tolerance is None: | ||
| corotating_frame_tolerance = L2norm_fractional_tolerance | ||
| if L2norm_fractional_tolerance is None or L2norm_fractional_tolerance <=0.0: | ||
| warning = f"corotating_frame_tolerance has not been specified, so it is defaulting to L2norm_fractional_tolerance. However, L2norm_fractional_tolerance is {L2norm_fractional_tolerance} which does not make sense as a corotating_frame_tolerance. You probably want to explicitly set corotating_frame_tolerance." | ||
| warnings.warn(warning) | ||
|
|
||
|
|
Member
There was a problem hiding this comment.
The minimum sensible tolerance is 100*epsilon, so let's just fall back to that.
Suggested change
| if corotating_frame_tolerance is None: | |
| corotating_frame_tolerance = L2norm_fractional_tolerance | |
| if L2norm_fractional_tolerance is None or L2norm_fractional_tolerance <=0.0: | |
| warning = f"corotating_frame_tolerance has not been specified, so it is defaulting to L2norm_fractional_tolerance. However, L2norm_fractional_tolerance is {L2norm_fractional_tolerance} which does not make sense as a corotating_frame_tolerance. You probably want to explicitly set corotating_frame_tolerance." | |
| warnings.warn(warning) | |
| if corotating_frame_tolerance is None: | |
| corotating_frame_tolerance = max(L2norm_fractional_tolerance, 100*np.finfo(float).eps) |
| if L2norm_fractional_tolerance > 0.0: | ||
| w.truncate(tol=L2norm_fractional_tolerance) | ||
| # Set bits below the desired significance level to 0 | ||
| if L2norm_fractional_tolerance is not None and L2norm_fractional_tolerance > 0.0: |
Member
There was a problem hiding this comment.
Suggested change
| if L2norm_fractional_tolerance is not None and L2norm_fractional_tolerance > 0.0: | |
| if L2norm_fractional_tolerance > 0.0: |
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.
Fixes #162
else. Using None or values <=0 for this parameter means no
truncation.
is the tolerance passed into w.to_corotating_frame.
It defaults to L2norm_fractional_tolerance for backward
compatibility.
L2norm_fractional_tolerance==None are now gone.
These code paths were apparently used by Mike for testing.
There were two code paths: 1) Don't do any of the RPDMB operations
and 2) bypass shuffle_widths, use the standard shuffling, and
write different attributes into the h5 file.
It appears to me that 2) would result in files that could not
be read by rpdmb.load (since the attributes looked for by
rpdmb.load would be missing).
📚 Documentation preview 📚: https://sxs--165.org.readthedocs.build/en/165/