Repository navigation
Conversation
…trics Resonance frequency and quality factor from the -3 dB bandwidth of the magnitude response and from the decay of the envelope (Q = pi f0 tau), -3 dB cutoff frequencies, passband ripple, and the rise time, overshoot and settling time of a step response. Tests use systems with exact values: second-order resonators of known Q for both definitions, a Butterworth band-pass and a Chebyshev low-pass, a first-order step (rise tau ln 9, settling tau ln 50) and second-order steps (overshoot exp(-pi zeta / sqrt(1 - zeta^2))). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
response.bifurcation takes recordings along a sweep of a control parameter, up and then down, measures the amplitude of the oscillation in each (spectral peak near a given frequency, or rms), and returns the onset going up, the extinction going down and the hysteresis between them. The test uses a synthetic subcritical sweep with known thresholds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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 the module
pytta.response, with measures of the response of a linear system asked for in #33. They use the first channel of the SignalObj.resonance(signalObj, fmin=0, fmax=None): resonance frequency, quality factor and -3 dB bandwidth of the highest peak of the magnitude response, with Q = f0 / bandwidth and the half-power points interpolated on the squared magnitude.q_from_decay(signalObj, f0): quality factor from the decay, Q = pi f0 tau, with tau the time constant of the Hilbert envelope fitted between -5 and -35 dB.cutoff_frequencies(signalObj): lower and upper -3 dB frequencies around the maximum (nan for a side that does not fall by 3 dB).passband_ripple(signalObj, fmin, fmax): peak-to-valley variation in dB.step_metrics(signalObj, final=None, tolerance=0.02): rise time from 10 % to 90 %, overshoot, and settling time within the tolerance, of a step response (nan when the signal does not reach or does not settle).bifurcation(params, recordings, freq=None, rise=20): for recordings along a sweep of a control parameter (gain, blowing pressure), first up and then down, the amplitude of the oscillation in each (the spectral peak within 5 % offreq, or the rms), the onset going up, the extinction going down and the hysteresis between them. A recording oscillates when its amplitude isrisedB above the quietest one.The tests in
tests/test_response.pyuse systems with exact values: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