diff --git a/gui/CAEN-N1471H/caen_simulator.py b/gui/CAEN-N1471H/caen_simulator.py index 60997e3..4df0599 100644 --- a/gui/CAEN-N1471H/caen_simulator.py +++ b/gui/CAEN-N1471H/caen_simulator.py @@ -3,7 +3,7 @@ import random -# class that simulates the channel of the caen by giving a random value to its attriutes vmon, imon and +# class that simulates the channel of the caen by giving a random value to its attributes vmon, imon and class ChannelSimulator: def __init__(self, trip_probability=0.02): # private attributes (they do not exist in the real device) @@ -104,9 +104,9 @@ def turn_off(self): class ModuleSimulator: - def __init__(self, nChannels, trip_probability=0.05): + def __init__(self, n_channels, trip_probability=0.05): self.name = "N1471H SIMULATOR" - self.number_of_channels = nChannels + self.number_of_channels = n_channels self.channels = [ ChannelSimulator( 1 - (1 - trip_probability) ** (1.0 / self.number_of_channels) diff --git a/gui/CAEN-N1471H/gui.py b/gui/CAEN-N1471H/gui.py index e76ab7c..88c8733 100644 --- a/gui/CAEN-N1471H/gui.py +++ b/gui/CAEN-N1471H/gui.py @@ -530,19 +530,17 @@ def update_alarm_indicators(self): args = parser.parse_args() - if args.test: - from caen_simulator import * + if not args.test: + caen = hvps.Caen(port=args.port) - m = ModuleSimulator(4) + print("port:", caen.port) + print("baudrate:", caen.baudrate) - CaenHVPSGUI(module=m, channel_names=CHANNEL_NAMES) - exit(0) + m = caen.module(0) - caen = hvps.Caen(port=args.port) + else: + from caen_simulator import * # noqa: F403 - print("port:", caen.port) - print("baudrate:", caen.baudrate) - - m = caen.module(0) + m = ModuleSimulator(4) # noqa: F405 CaenHVPSGUI(module=m, channel_names=CHANNEL_NAMES)