diff options
Diffstat (limited to 'lab_control/test/mock_lab.py')
-rw-r--r-- | lab_control/test/mock_lab.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lab_control/test/mock_lab.py b/lab_control/test/mock_lab.py index 718f319..40893ca 100644 --- a/lab_control/test/mock_lab.py +++ b/lab_control/test/mock_lab.py @@ -12,8 +12,8 @@ class MockLab(FunctionGenerator, Oscilloscope): class OscChannelState: def __init__(self): - self.amplitudeFunction = None - self.fgChannel = None + self.testFunction = None + self.connectedChannel = None def __init__(self): self.fgChannels = [MockLab.FGChannelState() for i in range(0, 2)] @@ -35,8 +35,11 @@ class MockLab(FunctionGenerator, Oscilloscope): pass def measureAmplitude(self, channel: int) -> float: - fgChannel = self.oscChannels[channel - 1].fgChannel - return self.oscChannels[channel - 1].amplitudeFunction(self.fgChannels[fgChannel].frequency) + fgChannel = self.oscChannels[channel - 1].connectedChannel + frequency = fgChannel.frequency if fgChannel.on else 0.0 + amplitude = fgChannel.amplitude if fgChannel.on else 0.0 + + return self.oscChannels[channel - 1].testFunction(frequency) * amplitude def measurePeakToPeak(self, channel: int) -> float: pass @@ -47,8 +50,8 @@ class MockLab(FunctionGenerator, Oscilloscope): def measureFrequency(self, channel: int) -> float: pass - def setAmplitudeFunction(self, channel: int, f: Callable[[float], float]) -> None: - self.oscChannels[channel - 1].amplitudeFunction = f + def setTestFunction(self, channel: int, f: Callable[[float], float]) -> None: + self.oscChannels[channel - 1].testFunction = f def connectChannels(self, fg: int, osc: int) -> None: - self.oscChannels[osc - 1].fgChannel = fg - 1 + self.oscChannels[osc - 1].connectedChannel = self.fgChannels[fg - 1] |