Repository navigation
Conversation
uncalibrate undoes calib_pressure and calib_voltage for one channel or for all of them: the samples are divided by the correction factor and the channel goes back to full scale (CF = 1, unit 'FS'). The check of the calibrator frequency took the argmax of the complex spectrum, which compares real parts and misses a sine, so it warned for a correct calibrator. In calib_volt the warning then failed, since it formatted an integer refFreq with a precision. The check now uses the magnitude of the spectrum. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 31, 2026
This branch has not been deployed
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.
Adds
SignalObj.uncalibrate(chIndex=None), asked for in #14. It undoescalib_pressureandcalib_voltagefor one channel, or for every calibrated channel whenchIndexisNone: the samples are divided by the correction factor and the channel goes back to full scale (CF = 1, unit'FS', dB reference 1). Channels that were not calibrated are left as they are.While writing the tests I found that
calib_voltagefailed with a correct calibrator. Bothcalib_voltandcalib_presscheck the calibrator frequency withnp.argmax(freqSignal). On a complex spectrumargmaxcompares real parts, and the spectrum of a sine is mostly imaginary, so the check found a wrong frequency and printed its warning. Incalib_voltthe warning then raisedValueError: Precision not allowed in integer format specifier, because it formats an integerrefFreqwith'{:.2}'. The check now takes the argmax of the magnitude, and the warning formats both frequencies with'{}'.The tests in
tests/test_uncalibrate.pycalibrate one channel in pressure and another in voltage, then check thatuncalibrate()gives back the original samples and full scale on both, and thatuncalibrate(0)leaves the second channel calibrated.Checked with Python 3.12, numpy 1.26 and scipy 1.17. The existing tests behave as on
development: the 7 failures there (3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com