Raise DegenerateBaselineWindowError on degenerate baseline windows (fixes #639) - #679
Merged
HongSik-Yun-Fusion merged 2 commits intoSep 9, 2026
Merged
Conversation
…ixes #639) - Define DegenerateBaselineWindowError subclassing ValueError in vaft.process.magnetics - Add allow_zero_fallback configuration to VestMagneticsProcessingConfig (defaulting to False) - Support allow_zero_fallback and diagnostic context in _linear_baseline and vest_* callers - Raise informative diagnostic error message when valid baseline sample count < 2 - When allow_zero_fallback=True, warn via UserWarning and fall back to zero baseline - Add unit tests verifying error raising, error message contents, and opt-in fallback
…allback in machine mapping - Filter non-finite (NaN/Inf) samples in _linear_baseline so NaN-contaminated baseline windows raise DegenerateBaselineWindowError - Fix channel falsy check in vest_b_field_pol_probe_legacy to preserve integer channel 0 - Expose allow_zero_fallback in vfit_equilibrium_magnetics_detailed and vfit_equilibrium_magnetics - Parse allow_zero_fallback from vest.yaml window dictionary in equilibrium_magnetics_processing_config - Add tests for integer channel 0 and NaN baseline windows
HongSik-Yun-Fusion
deleted the
fix/639-magnetics-baseline-error-handling
branch
September 9, 2026 02:27
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.
Closes #639.
Summary of Changes
DegenerateBaselineWindowError: Subclass ofValueErrorinvaft.process.magnetics(re-exported in__all__) raised when fewer than two valid samples fall inside the baseline window.allow_zero_fallback: bool = FalsetoVestMagneticsProcessingConfigand as a keyword argument acrossvest_*magnetics functions. When explicitly enabled (allow_zero_fallback=True), falls back to zero-baseline subtraction and emits an informativeUserWarning.vest_b_field_pol_probe_legacy,vest_flux_loop_flux_from_voltage,vest_flux_loop_legacy,vest_equilibrium_magnetics_detailed, andvest_equilibrium_magnetics_signalsforward diagnostic context and fallback policy.test/test_equilibrium_magnetics_processing.pycovering probe and flux loop degenerate windows, message format assertions, opt-in fallback warnings, and multi-channel aggregation behavior.