diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-06-02 21:51:22 +0200 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-06-02 21:51:22 +0200 |
commit | 038be6aa9a2882db877954c1a57bb23ea70b5ad5 (patch) | |
tree | 6cc70fd8be7614ae98b6ab4a335fdf40fb9ca09b /lab_control/test/frequency_response_measurement_test.py | |
parent | 7c7d85f9bdc4715500cbf901fcdd8eb605d2668e (diff) |
Minor improvements
Diffstat (limited to 'lab_control/test/frequency_response_measurement_test.py')
-rw-r--r-- | lab_control/test/frequency_response_measurement_test.py | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/lab_control/test/frequency_response_measurement_test.py b/lab_control/test/frequency_response_measurement_test.py deleted file mode 100644 index 5a73b3e..0000000 --- a/lab_control/test/frequency_response_measurement_test.py +++ /dev/null @@ -1,51 +0,0 @@ -import pytest - -from lab_control.test.mock_lab import MockLab -from lab_control.frequency_response import FrequencyResponseMeasurement - -@pytest.fixture -def mockLab(): - return MockLab() - -@pytest.fixture -def uut(mockLab): - return FrequencyResponseMeasurement() - -def test_frequencyResponseDefaults(uut): - assert uut.minFrequency == 20e0 - assert uut.maxFrequency == 16e3 - assert uut.steps == 50 - assert uut.functionGeneratorChannel == 1 - assert uut.oscilloscopeChannel == 1 - -def test_frequencyResponseRamp(mockLab, uut): - uut.minFrequency = 100.0 - uut.maxFrequency = 200.0 - uut.steps = 11 - uut.functionGeneratorChannel = 1 - uut.oscilloscopeChannel = 1 - - # Expect a ramp response from 0.5 to 1.5 * input amplitude - inputAmplitude = 1.0 - minScale = 0.5 - maxScale = 1.5 - - def testFunction(f: float) -> float: - assert f >= uut.minFrequency and f <= uut.maxFrequency - frequencyPu = (f - uut.minFrequency) / (uut.maxFrequency - uut.minFrequency) - return minScale + maxScale * frequencyPu - - mockLab.connectChannels(uut.functionGeneratorChannel, uut.oscilloscopeChannel) - mockLab.setTestFunction(uut.oscilloscopeChannel, testFunction) - mockLab.setAmplitude(uut.functionGeneratorChannel, inputAmplitude) - mockLab.setOn(uut.functionGeneratorChannel) - - expectedData = [(f, testFunction(f) * inputAmplitude) for f in [100.0, 110.0, 120.0, 130.0, 140.0, 150.0, 160.0, 170.0, 180.0, 190.0, 200.0]] - - assert not uut.measurementDone - assert uut.data == None - - response = uut.measure(mockLab, mockLab) - - assert uut.measurementDone - assert uut.data == expectedData |