summaryrefslogtreecommitdiffstats
path: root/lab_control/test/mock_lab.py
diff options
context:
space:
mode:
Diffstat (limited to 'lab_control/test/mock_lab.py')
-rw-r--r--lab_control/test/mock_lab.py71
1 files changed, 0 insertions, 71 deletions
diff --git a/lab_control/test/mock_lab.py b/lab_control/test/mock_lab.py
deleted file mode 100644
index 1016b92..0000000
--- a/lab_control/test/mock_lab.py
+++ /dev/null
@@ -1,71 +0,0 @@
-from collections.abc import Callable
-
-from lab_control.function_generator import FunctionGenerator
-from lab_control.oscilloscope import Oscilloscope
-
-class MockLab(FunctionGenerator, Oscilloscope):
- class FGChannelState:
- def __init__(self):
- self.on = False
- self.frequency = None
- self.amplitude = None
- self.function = None
-
- class OscChannelState:
- def __init__(self):
- self.testFunction = None
- self.connectedChannel = None
- self.voltsPerDiv = None
-
- def __init__(self):
- self.fgChannels = [MockLab.FGChannelState() for i in range(0, 2)]
- self.oscChannels = [MockLab.OscChannelState() for i in range(0, 4)]
-
- def setOn(self, channel: int) -> None:
- self.fgChannels[channel - 1].on = True
-
- def setOff(self, channel: int) -> None:
- self.fgChannels[channel - 1].on = False
-
- def setFrequency(self, channel: int, frequency: float) -> None:
- self.fgChannels[channel - 1].frequency = frequency
-
- def setAmplitude(self, channel: int, amplitude: float) -> None:
- self.fgChannels[channel - 1].amplitude = amplitude
-
- def setFunction(self, channel: int, function: int) -> None:
- self.fgChannels[channel - 1].function = function
-
- def measureAmplitude(self, channel: int) -> float:
- 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
-
- def measureRMS(self, channel: int) -> float:
- pass
-
- def measureFrequency(self, channel: int) -> float:
- pass
-
- def setVoltsPerDivision(self, channel: int, volts: float) -> None:
- self.oscChannels[channel - 1].voltsPerDiv = volts
-
- def getDivisionsDisplayed(self) -> int:
- return 12
-
- 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].connectedChannel = self.fgChannels[fg - 1]
-
- def getFunctionGeneratorChannel(self, channel: int):
- return self.fgChannels[channel - 1]
-
- def getOscilloscopeChannel(self, channel: int):
- return self.oscChannels[channel - 1]