def __init__(self, section_name, parent):
     super().__init__(section_name, parent)
     self.items["Channel"] = pc.Combo(devices.control.channel_names)
     self.items["level"] = pc.Bool(initial_value=False)
     self.items["gtol"] = pc.Number(initial_value=1e-3, decimals=5)
     self.items["ltol"] = pc.Number(initial_value=1e-2, decimals=5)
     self.items["Apply"] = pc.Bool(initial_value=False)
Example #2
0
 def create_frame(self):
     # shared settings
     input_table = pw.InputTable()
     allowed = [hardware.name for hardware in opas.hardwares]
     self.opa_combo = pc.Combo(allowed)
     input_table.add("OPA", self.opa_combo)
     self.opa_combo.updated.connect(self.on_opa_combo_updated)
     self.use_tune_points = pc.Bool(initial_value=True)
     input_table.add("Use Tune Points", self.use_tune_points)
     self.layout.addWidget(input_table)
     # motor settings
     self.opa_guis = [
         OPA_GUI(hardware, self.layout, self.use_tune_points)
         for hardware in opas.hardwares
     ]
     self.opa_guis[0].show()
     # mono settings
     allowed = ["Set", "Scan", "Static"]
     self.mono_method_combo = pc.Combo(allowed,
                                       disable_under_module_control=True)
     self.mono_method_combo.updated.connect(self.update_mono_settings)
     self.mono_center = pc.Number(initial_value=7000,
                                  units="wn",
                                  disable_under_module_control=True)
     self.mono_width = pc.Number(initial_value=500,
                                 units="wn",
                                 disable_under_module_control=True)
     self.mono_width.set_disabled_units(True)
     self.mono_npts = pc.Number(initial_value=51,
                                decimals=0,
                                disable_under_module_control=True)
     input_table = pw.InputTable()
     input_table.add("Spectrometer", None)
     input_table.add("Method", self.mono_method_combo)
     input_table.add("Center", self.mono_center)
     input_table.add("Width", self.mono_width)
     input_table.add("Number", self.mono_npts)
     self.layout.addWidget(input_table)
     self.update_mono_settings()
     # processing
     input_table = pw.InputTable()
     input_table.add("Processing", None)
     self.do_post_process = pc.Bool(initial_value=True)
     input_table.add("Process", self.do_post_process)
     # TODO: allowed values, update
     channel_names = list(yaqc_cmds.sensors.get_channels_dict().keys())
     if ("main_channel" not in self.state.keys()
             or self.state["main_channel"] not in channel_names):
         self.state["main_channel"] = channel_names[0]
     self.main_channel = pc.Combo(
         allowed_values=channel_names,
         initial_value=self.state["main_channel"],
     )
     input_table.add("Channel", self.main_channel)
     self.layout.addWidget(input_table)
     sensor_signals.channels_changed.connect(
         self.on_device_settings_updated)
Example #3
0
 def create_frame(self):
     # axes
     self.axes = []
     input_table = pw.InputTable()
     input_table.add("Axes", None)
     self.layout.addWidget(input_table)
     self.axes_container_widget = QtWidgets.QWidget()
     self.axes_container_widget.setLayout(QtWidgets.QVBoxLayout())
     self.axes_container_widget.layout().setMargin(0)
     self.layout.addWidget(self.axes_container_widget)
     add_energy_axis_button = pw.SetButton("ADD ENERGY AXIS")
     add_energy_axis_button.clicked.connect(lambda: self.add_axis("wn"))
     self.layout.addWidget(add_energy_axis_button)
     add_delay_axis_button = pw.SetButton("ADD DELAY AXIS")
     add_delay_axis_button.clicked.connect(lambda: self.add_axis("ps"))
     self.layout.addWidget(add_delay_axis_button)
     add_delay_axis_button = pw.SetButton("ADD ANGLE AXIS")
     add_delay_axis_button.clicked.connect(lambda: self.add_axis("deg"))
     self.layout.addWidget(add_delay_axis_button)
     remove_axis_button = pw.SetButton("REMOVE AXIS", "stop")
     remove_axis_button.clicked.connect(self.remove_axis)
     self.layout.addWidget(remove_axis_button)
     # constants
     self.constants = []
     input_table = pw.InputTable()
     input_table.add("Constants", None)
     self.layout.addWidget(input_table)
     self.constants_container_widget = QtWidgets.QWidget()
     self.constants_container_widget.setLayout(QtWidgets.QVBoxLayout())
     self.constants_container_widget.layout().setMargin(0)
     self.layout.addWidget(self.constants_container_widget)
     add_constant_button, remove_constant_button = self.add_buttons()
     add_constant_button.clicked.connect(self.add_constant)
     remove_constant_button.clicked.connect(self.remove_constant)
     # processing
     input_table = pw.InputTable()
     input_table.add("Processing", None)
     channel_names = list(yaqc_cmds.sensors.get_channels_dict().keys())
     if (
         "main_channel" not in self.state.keys()
         or self.state["main_channel"] not in channel_names
     ):
         self.state["main_channel"] = channel_names[0]
     self.channel_combo = pc.Combo(
         allowed_values=channel_names,
         initial_value=self.state["main_channel"],
     )
     self.channel_combo.updated.connect(self.save_state)
     input_table.add("Main Channel", self.channel_combo)
     if "process_all_channels" not in self.state.keys():
         self.state["process_all_channels"] = False
     self.process_all_channels = pc.Bool(initial_value=self.state["process_all_channels"])
     self.process_all_channels.updated.connect(self.save_state)
     input_table.add("Process All Channels", self.process_all_channels)
     self.layout.addWidget(input_table)
     sensor_signals.channels_changed.connect(self.on_device_settings_updated)
Example #4
0
 def create_frame(self):
     # shared settings
     input_table = pw.InputTable()
     self.shutter_state = {
         hardware.name: pc.Bool()
         for hardware in opas.hardwares if hardware.driver.shutter_port
     }
     for k, v in self.shutter_state.items():
         input_table.add(k, v)
     self.layout.addWidget(input_table)
Example #5
0
 def __init__(self):
     QtWidgets.QWidget.__init__(self)
     layout = QtWidgets.QVBoxLayout()
     self.setLayout(layout)
     layout.setMargin(0)
     input_table = pw.InputTable()
     input_table.add("Virtual", None)
     self.use = pc.Bool(initial_value=True)
     input_table.add("Use", self.use)
     layout.addWidget(input_table)
Example #6
0
 def create_frame(self, layout):
     # container widget
     display_container_widget = QtWidgets.QWidget()
     display_container_widget.setLayout(QtWidgets.QVBoxLayout())
     display_layout = display_container_widget.layout()
     display_layout.setMargin(0)
     layout.addWidget(display_container_widget)
     # plot
     self.plot_widget = pw.Plot1D()
     self.plot_scatter = self.plot_widget.add_scatter()
     display_layout.addWidget(self.plot_widget)
     # vertical line
     line = pw.line("V")
     layout.addWidget(line)
     # settings area
     settings_container_widget = QtWidgets.QWidget()
     settings_scroll_area = pw.scroll_area(130)
     settings_scroll_area.setWidget(settings_container_widget)
     settings_scroll_area.setMinimumWidth(300)
     settings_scroll_area.setMaximumWidth(300)
     settings_container_widget.setLayout(QtWidgets.QVBoxLayout())
     settings_layout = settings_container_widget.layout()
     settings_layout.setMargin(5)
     layout.addWidget(settings_scroll_area)
     # input table
     input_table = pw.InputTable()
     input_table.add("Display", None)
     self.display_combobox = pc.Combo()
     self.display_combobox.updated.connect(self.update_display)
     input_table.add("Hardware", self.display_combobox)
     input_table.add("Settings", None)
     self.use_bool = pc.Bool()
     self.use_bool.updated.connect(self.on_toggle_use)
     g.queue_control.disable_when_true(self.use_bool)
     input_table.add("Use", self.use_bool)
     input_table.add("Current Offset", self.hardware.offset)
     settings_layout.addWidget(input_table)
     # add button
     self.add_button = pw.SetButton("ADD FILE", color="go")
     self.add_button.clicked.connect(self.on_add_file)
     g.queue_control.disable_when_true(self.add_button)
     settings_layout.addWidget(self.add_button)
     # table
     self.table = pw.TableWidget()
     self.table.verticalHeader().hide()
     self.table.insertColumn(0)
     self.table.insertColumn(1)
     self.table.insertColumn(2)
     self.table.setHorizontalHeaderLabels(["Hardware", "File Name", ""])
     self.table.setColumnWidth(0, 100)
     self.table.setColumnWidth(1, 100)
     self.table.horizontalHeader().setStretchLastSection(True)
     settings_layout.addWidget(self.table)
Example #7
0
 def __init__(self, *args, **kwargs):
     self.yaqd_port = kwargs["yaqd_port"]
     self.yaqd_host = kwargs.get("yaqd_host", "127.0.0.1")
     self.client = yaqc.Client(self.yaqd_port, host=self.yaqd_host)
     self.motor_positions = {
         k: pc.Number(name=k, decimals=6, display=True) for k in self.client.get_setable_names()
     }
     hw.Driver.__init__(self, *args, **kwargs)
     self.shutter_port = kwargs.get("shutter_yaqd_port")
     if self.shutter_port:
         self.shutter_position = pc.Bool(name="Shutter", display=True, set_method="set_shutter")
         self.shutter = yaqc.Client(self.shutter_port)
         self.shutter.set_identifier("closed")
         self.exposed += [self.shutter_position]
     self.curve = attune.Instrument(**self.client.get_instrument())
     self.load_curve()
     self.get_motor_positions()
     self.get_position()
Example #8
0
 def create_frame(self):
     input_table = pw.InputTable()
     # opa combo
     allowed = [hardware.name for hardware in opas.hardwares]
     self.opa_combo = pc.Combo(allowed)
     input_table.add("OPA", None)
     input_table.add("OPA", self.opa_combo)
     self.npts_opa = pc.Number(decimals=0, initial_value=21)
     input_table.add("npts", self.npts_opa)
     # delay
     self.delay = ScanAxisGUI("delay", "")
     self.delay.start.write(-3)
     self.delay.stop.write(3)
     self.delay.number.write(21)
     input_table.add("Delay", None)
     self.layout.addWidget(input_table)
     self.layout.addWidget(self.delay.widget)
     # constants
     self.constants = []
     input_table = pw.InputTable()
     input_table.add("Constants", None)
     self.layout.addWidget(input_table)
     self.constants_container_widget = QtWidgets.QWidget()
     self.constants_container_widget.setLayout(QtWidgets.QVBoxLayout())
     self.constants_container_widget.layout().setMargin(0)
     self.layout.addWidget(self.constants_container_widget)
     add_constant_button, remove_constant_button = self.add_buttons()
     add_constant_button.clicked.connect(self.add_constant)
     remove_constant_button.clicked.connect(self.remove_constant)
     # processing
     input_table = pw.InputTable()
     input_table.add("Processing", None)
     self.channel_combo = pc.Combo(
         allowed_values=devices.control.channel_names)
     input_table.add("Channel", self.channel_combo)
     self.process_level = pc.Bool(initial_value=False)
     self.process_gtol = pc.Number(initial_value=0, decimals=5)
     self.process_ltol = pc.Number(initial_value=1e-2, decimals=5)
     input_table.add("level", self.process_level)
     input_table.add("gtol", self.process_gtol)
     input_table.add("ltol", self.process_ltol)
     # finish
     self.layout.addWidget(input_table)
Example #9
0
 def __init__(self, units_kind, axis_index):
     self.units_kind = units_kind
     if self.units_kind == "energy":
         self.units = "wn"
         initial_start = 1500
         initial_stop = 1200
     elif self.units_kind == "delay":
         self.units = "ps"
         initial_start = -1
         initial_stop = 1
     elif self.units_kind == "angle":
         self.units = "deg"
         initial_start = 0.0
         initial_stop = 360.0
     else:
         raise ValueError(f"unexpected units kind: {self.units_kind}")
     self.widget = pw.InputTable()
     self.widget.add(str(axis_index) + " (" + self.units_kind + ")", None)
     # start
     self.start = pc.Number(initial_value=initial_start, units=self.units)
     self.start.set_disabled_units(True)
     self.widget.add("Initial", self.start)
     # stop
     self.stop = pc.Number(initial_value=initial_stop, units=self.units)
     self.stop.set_disabled_units(True)
     self.widget.add("Final", self.stop)
     # number
     self.number = pc.Number(initial_value=51, decimals=0)
     self.widget.add("Number", self.number)
     # hardwares
     if self.units_kind == "energy":
         hardware_objs = opas.hardwares + spectrometers.hardwares
     elif self.units_kind == "delay":
         hardware_objs = delays.hardwares
     elif self.units_kind == "angle":
         hardware_objs = filters.hardwares
     self.hardwares = {}
     for hw in hardware_objs:
         checkbox = pc.Bool()
         self.widget.add(hw.name, checkbox)
         self.hardwares[hw.name] = checkbox
Example #10
0
 def __init__(self, *args, **kwargs):
     self.yaqd_port = kwargs["yaqd_port"]
     self.yaqd_host = kwargs.get("yaqd_host", "127.0.0.1")
     self.client = yaqc.Client(self.yaqd_port, host=self.yaqd_host)
     self.client.register_connection_callback(
         signals.updated_attune_store.emit)
     signals.updated_attune_store.connect(self.on_updated_attune_store)
     self.motor_positions = {
         k: pc.Number(name=k, decimals=6, display=True)
         for k in self.client.get_setable_names()
     }
     hw.Driver.__init__(self, *args, **kwargs)
     self.shutter_port = kwargs.get("shutter_yaqd_port")
     if self.shutter_port:
         self.shutter_position = pc.Bool(name="Shutter",
                                         display=True,
                                         set_method="set_shutter")
         self.shutter = yaqc.Client(self.shutter_port)
         self.shutter.set_identifier("closed")
         self.exposed += [self.shutter_position]
     self.on_updated_attune_store()
Example #11
0
 def __init__(self, *args, **kwargs):
     self.freerun = pc.Bool(initial_value=False)
     self.Widget = kwargs.pop("Widget")
     self.data = Data()
     self.active = True
     # shape
     if "shape" in kwargs.keys():
         self.shape = kwargs.pop("shape")
     else:
         self.shape = (1, )
     # map
     if "has_map" in kwargs.keys():
         self.has_map = kwargs.pop("has_map")
     else:
         self.has_map = False
     self.has_map = False  # turning this feature off for now  --Blaise 2020-09-25
     self.measure_time = pc.Number(initial_value=np.nan,
                                   display=True,
                                   decimals=3)
     super().__init__(*args, **kwargs)
     self.settings_updated.emit()
     self.freerun.write(True)
     self.on_freerun_updated()
Example #12
0
 def __init__(self, name, home):
     self.name = name
     self.input_table = pw.InputTable()
     self.input_table.add(name, None)
     self.home = pc.Bool(initial_value=home)
     self.input_table.add("Home", self.home)