From 832e5fc6208f4395aa75423cad28eec5d9bc11a4 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sun, 5 Jun 2022 12:43:51 +0200 Subject: Updated wiki, minor refactoring --- lab_control/jds6600.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lab_control') diff --git a/lab_control/jds6600.py b/lab_control/jds6600.py index 7af522b..32f12af 100644 --- a/lab_control/jds6600.py +++ b/lab_control/jds6600.py @@ -9,12 +9,12 @@ from lab_control.function_generator import FunctionGenerator def _checkChannel(channel: int): assert channel in JDS6600.AVAILABLE_CHANNELS, f"JDS6600: Invalid channel {channel}" -def _checkArg(arg: float, lowerBound: float, upperBound: float): - valid = arg is not None +def _checkBounds(value: float, lowerBound: float, upperBound: float): + valid = value is not None if valid: - valid &= arg >= lowerBound - valid &= arg <= upperBound - assert valid, f"JDS6600: Invalid argument {arg}" + valid &= value >= lowerBound + valid &= value <= upperBound + assert valid, f"JDS6600: Invalid argument {value}" class JDS6600(FunctionGenerator): """ @@ -65,7 +65,7 @@ class JDS6600(FunctionGenerator): def setFrequency(self, channel: int, frequency: float) -> None: _checkChannel(channel) - _checkArg(frequency, 0.0, 60e6) + _checkBounds(frequency, 0.0, 60e6) opcode = 23 + channel - 1 arg = int(frequency * 100.0) @@ -79,7 +79,7 @@ class JDS6600(FunctionGenerator): def setAmplitude(self, channel: int, amplitude: float) -> None: _checkChannel(channel) - _checkArg(amplitude, 0.0, 20.0) + _checkBounds(amplitude, 0.0, 20.0) opcode = f"w{25 + channel - 1}" arg = int(amplitude * 1000.0) @@ -87,7 +87,7 @@ class JDS6600(FunctionGenerator): def setFunction(self, channel: int, function: int) -> None: _checkChannel(channel) - _checkArg(function, 0, 16) + _checkBounds(function, 0, 16) opcode = f"w{21 + channel - 1}" self._sendRequest(opcode, str(function)) -- cgit v1.2.3