summaryrefslogtreecommitdiffstats
path: root/lab_control
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-06-05 12:43:51 +0200
committerEddy Pedroni <eddy@0xf7.com>2022-06-05 12:43:51 +0200
commit832e5fc6208f4395aa75423cad28eec5d9bc11a4 (patch)
tree51e7f2a017d7e45045ecb9cf2b1439d8c3ecfeab /lab_control
parent1393405ed5e8796a37224344c51cdcd4427f9b4b (diff)
Updated wiki, minor refactoring
Diffstat (limited to 'lab_control')
-rw-r--r--lab_control/jds6600.py16
1 files changed, 8 insertions, 8 deletions
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))