示例#1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.title = "IV Ramp"

        self.register_vsource()
        self.register_environment()

        self.plot = ui.Plot(height=300, legend="right")
        self.plot.add_axis("x", align="bottom", text="Voltage [V] (abs)")
        self.plot.add_axis("y", align="right", text="Current [uA]")
        self.plot.add_series("hvsrc", "x", "y", text="HV Source", color="red")
        self.plot.add_series("xfit", "x", "y", text="Fit", color="magenta")
        self.data_tabs.insert(0, ui.Tab(title="IV Curve", layout=self.plot))

        self.voltage_start = ui.Number(decimals=3, suffix="V")
        self.voltage_stop = ui.Number(decimals=3, suffix="V")
        self.voltage_step = ui.Number(minimum=0, maximum=200, decimals=3, suffix="V")
        self.waiting_time = ui.Number(minimum=0, decimals=2, suffix="s")

        self.hvsrc_current_compliance = ui.Metric(minimum=0, decimals=3, prefixes='mun', unit="A")

        self.bind("voltage_start", self.voltage_start, 0, unit="V")
        self.bind("voltage_stop", self.voltage_stop, 100, unit="V")
        self.bind("voltage_step", self.voltage_step, 1, unit="V")
        self.bind("waiting_time", self.waiting_time, 1, unit="s")

        self.bind("hvsrc_current_compliance", self.hvsrc_current_compliance, 0, unit="A")

        self.general_tab.layout = ui.Row(
            ui.GroupBox(
                title="Ramp",
                layout=ui.Column(
                    ui.Label(text="Start"),
                    self.voltage_start,
                    ui.Label(text="Stop"),
                    self.voltage_stop,
                    ui.Label(text="Step"),
                    self.voltage_step,
                    ui.Label(text="Waiting Time"),
                    self.waiting_time,
                    ui.Spacer()
                )
            ),
            ui.GroupBox(
                title="HV Source",
                layout=ui.Column(
                    ui.Label(text="Compliance"),
                    self.hvsrc_current_compliance,
                    ui.Spacer()
                )
            ),
            ui.Spacer(),
            stretch=(1, 1, 1)
        )

        ampere = comet.ureg('A')
        volt = comet.ureg('V')

        self.series_transform['hvsrc'] = lambda x, y: ((x * volt).to('V').m, (y * ampere).to('uA').m)
        self.series_transform['xfit'] = self.series_transform.get('hvsrc')
示例#2
0
 def __init__(self):
     super().__init__(title="Webserver")
     self._enabled_checkbox = ui.CheckBox(
         text="Enable Server"
     )
     self._host_text = ui.Text()
     self._port_number = ui.Number(
         minimum=0,
         maximum=99999,
         step=1
     )
     self.layout = ui.Column(
         ui.GroupBox(
                 title="JSON API",
                 layout=ui.Column(
                 self._enabled_checkbox,
                 ui.Row(
                     ui.Column(
                         ui.Label("Host"),
                         ui.Label("Port"),
                     ),
                     ui.Column(
                         self._host_text,
                         self._port_number,
                     ),
                     ui.Spacer()
                 ),
                 ui.Spacer(),
                 stretch=(0, 0, 1)
             )
         ),
         ui.Spacer(),
         stretch=(0, 1)
     )
示例#3
0
 def __init__(self):
     super().__init__(title="Options")
     self._png_plots_checkbox = ui.CheckBox("Save plots as PNG")
     self._points_in_plots_checkbox = ui.CheckBox("Show points in plots")
     self._png_analysis_checkbox = ui.CheckBox(
         "Add analysis preview to PNG")
     self._export_json_checkbox = ui.CheckBox("Write JSON data (*.json)")
     self._export_txt_checkbox = ui.CheckBox(
         "Write plain text data (*.txt)")
     self._write_logfiles_checkbox = ui.CheckBox(
         "Write measurement log files (*.log)")
     self._vsrc_instrument_combobox = ui.ComboBox(
         ["K2410", "K2470", "K2657A"])
     self._hvsrc_instrument_combobox = ui.ComboBox(
         ["K2410", "K2470", "K2657A"])
     self._retry_measurement_number = ui.Number(
         minimum=0,
         suffix="x",
         tool_tip="Number of retries for measurements with failed analysis."
     )
     self._retry_contact_number = ui.Number(
         minimum=0,
         suffix="x",
         tool_tip=
         "Number of re-contact retries for measurements with failed analysis."
     )
     self.layout = ui.Column(
         ui.Row(ui.GroupBox(title="Plots",
                            layout=ui.Column(
                                self._png_plots_checkbox,
                                self._points_in_plots_checkbox,
                            )),
                ui.GroupBox(title="Analysis",
                            layout=ui.Column(self._png_analysis_checkbox,
                                             ui.Spacer())),
                stretch=(0, 1)),
         ui.Row(ui.GroupBox(title="Formats",
                            layout=ui.Column(self._export_json_checkbox,
                                             self._export_txt_checkbox)),
                ui.GroupBox(title="Log files",
                            layout=ui.Column(self._write_logfiles_checkbox,
                                             ui.Spacer())),
                stretch=(0, 1)),
         ui.GroupBox(title="Instruments",
                     layout=ui.Row(ui.Column(ui.Label("V Source"),
                                             ui.Label("HV Source")),
                                   ui.Column(
                                       self._vsrc_instrument_combobox,
                                       self._hvsrc_instrument_combobox),
                                   ui.Spacer(vertical=False),
                                   stretch=(0, 0, 1))),
         ui.GroupBox(title="Auto Retry",
                     layout=ui.Row(
                         ui.Column(ui.Label("Retry Measurements"),
                                   ui.Label("Retry Contact")),
                         ui.Column(self._retry_measurement_number,
                                   self._retry_contact_number),
                         ui.Spacer())),
         ui.Spacer(),
         stretch=(0, 0, 0, 0, 1))
示例#4
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self._step_size_number = ui.Number(value=0.,
                                        minimum=0.,
                                        maximum=1000.,
                                        decimals=3,
                                        suffix="mm")
     self._z_limit_number = ui.Number(value=0.,
                                      minimum=0.,
                                      maximum=1000.,
                                      decimals=3,
                                      suffix="mm",
                                      visible=False)
     self._step_color_text = ui.Text()
     self._button_box = ui.DialogButtonBox(buttons=("ok", "cancel"),
                                           accepted=self.accept,
                                           rejected=self.reject)
     self.layout = ui.Column(
         ui.Label("Size", tool_tip="Step size in millimeters"),
         self._step_size_number,
         ui.Label("Z-Limit",
                  tool_tip="Z-Limit in millimeters",
                  visible=False), self._z_limit_number,
         ui.Label("Color", tool_tip="Color code for step"),
         self._step_color_text, self._button_box)
示例#5
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.name_text = ui.Text(value="Unnamed")
     self.x_number = ui.Number(value=0.,
                               minimum=0.,
                               maximum=1000.,
                               decimals=3,
                               suffix="mm")
     self.y_number = ui.Number(value=0.,
                               minimum=0.,
                               maximum=1000.,
                               decimals=3,
                               suffix="mm")
     self.z_number = ui.Number(value=0.,
                               minimum=0.,
                               maximum=1000.,
                               decimals=3,
                               suffix="mm")
     self.comment_text = ui.Text()
     self.button_box = ui.DialogButtonBox(buttons=("ok", "cancel"),
                                          accepted=self.accept,
                                          rejected=self.reject)
     self.layout = ui.Column(
         ui.Label("Name", tool_tip="Position name"), self.name_text,
         ui.Label("X", tool_tip="Position X coordinate"), self.x_number,
         ui.Label("Y", tool_tip="Position Y coordinate"), self.y_number,
         ui.Label("Z", tool_tip="Position Z coordinate"), self.z_number,
         ui.Label("Comment", tool_tip="Optional position comment"),
         self.comment_text, self.button_box)
示例#6
0
 def __init__(self, sample_changed=None, **kwargs):
     super().__init__(**kwargs)
     # Properties
     self.title = "Sample"
     # Callbacks
     self.sample_changed = sample_changed
     # Layout
     self._sample_name_prefix_text = ui.Text(
         tool_tip="Sample name prefix",
         clearable=True,
         editing_finished=self.on_sample_name_edited)
     self._sample_name_infix_text = ui.Text(
         tool_tip="Sample name",
         clearable=True,
         editing_finished=self.on_sample_name_edited)
     self._sample_name_suffix_text = ui.Text(
         tool_tip="Sample name suffix",
         clearable=True,
         editing_finished=self.on_sample_name_edited)
     self._sample_type_text = ui.Text(
         tool_tip="Sample type",
         clearable=True,
         editing_finished=self.on_sample_name_edited)
     self._sample_position_text = ui.Text(
         tool_tip="Sample position on the chuck",
         clearable=True,
         editing_finished=self.on_sample_position_edited)
     self._sequence_text = ui.Text(readonly=True)
     self._sample_comment_text = ui.Text(
         tool_tip="Sample comment (optional)",
         clearable=True,
         editing_finished=self.on_sample_comment_edited)
     self._reload_button = ui.ToolButton(
         icon=make_path('assets', 'icons', 'reload.svg'),
         tool_tip="Reload sequence configuration from file.",
         clicked=self.on_reload_clicked)
     self._sequence_manager_button = ui.ToolButton(
         icon=make_path('assets', 'icons', 'gear.svg'),
         tool_tip="Open sequence manager",
         clicked=self.on_sequence_manager_clicked)
     self._sample_groupbox = ui.GroupBox(
         title="Sample",
         layout=ui.Row(ui.Column(ui.Label("Name"), ui.Label("Type"),
                                 ui.Label("Position"), ui.Label("Comment"),
                                 ui.Label("Sequence")),
                       ui.Column(
                           ui.Row(self._sample_name_prefix_text,
                                  self._sample_name_infix_text,
                                  self._sample_name_suffix_text,
                                  stretch=(3, 7, 3)),
                           self._sample_type_text,
                           self._sample_position_text,
                           self._sample_comment_text,
                           ui.Row(self._sequence_text,
                                  self._reload_button,
                                  self._sequence_manager_button,
                                  stretch=(1, 0))),
                       stretch=(0, 1)))
     self.layout.insert(2, self._sample_groupbox)
示例#7
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.title_label = ui.Label(
         stylesheet="font-size: 16px; font-weight: bold; height: 32px;")
     self.title_label.qt.setTextFormat(QtCore.Qt.RichText)
     self.description_label = ui.Label()
     self.layout = ui.Column(self.title_label, self.description_label,
                             ui.Spacer())
示例#8
0
def main():
    app = comet.Application()
    app.title = "Measurement"

    def on_finish():
        start_button.enabled = True
        stop_button.enabled = False
        current_number.value = 0

    def on_reading(value):
        print(value)
        current_number.value = value

    def on_start():
        start_button.enabled = False
        stop_button.enabled = True
        process = app.processes.get("measure")
        process.start()

    def on_stop():
        start_button.enabled = False
        stop_button.enabled = False
        process = app.processes.get("measure")
        process.stop()

    def on_voltage(value):
        process = app.processes.get("measure")
        process.set('voltage', value)

    process = comet.Process(target=measure)
    process.finished = on_finish
    process.failed = ui.show_exception
    process.reading = on_reading
    app.processes.add("measure", process)

    voltage_number = ui.Number(value=0, minimum=0, maximum=1000, decimals=1, suffix="V", changed=on_voltage)
    current_number = ui.Number(readonly=True, value=0, decimals=3, suffix="mA", stylesheet="color: red")
    start_button = ui.Button(text="Start", clicked=on_start)
    stop_button = ui.Button(text="Stop", enabled=False, clicked=on_stop)

    l = ui.Column(
        ui.Label("Voltage"),
        voltage_number,
        ui.Label("Current"),
        current_number,
        start_button,
        stop_button,
        ui.Spacer()
    )
    app.layout = l

    return app.run()
示例#9
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.title = "Position"
     self._pos_x_label = PositionLabel()
     self._pos_y_label = PositionLabel()
     self._pos_z_label = PositionLabel()
     self.layout = ui.Row(ui.Column(
         ui.Label(text="X", tool_tip="X axis position."),
         ui.Label(text="Y", tool_tip="Y axis position."),
         ui.Label(text="Z", tool_tip="Z axis position.")),
                          ui.Column(self._pos_x_label, self._pos_y_label,
                                    self._pos_z_label),
                          stretch=(1, 1))
示例#10
0
 def __init__(self, reload=None):
     super().__init__(title="Status")
     self.reload = reload
     self.matrix_model_text = ui.Text(readonly=True)
     self.matrix_channels_text = ui.Text(readonly=True)
     self.hvsrc_model_text = ui.Text(readonly=True)
     self.vsrc_model_text = ui.Text(readonly=True)
     self.lcr_model_text = ui.Text(readonly=True)
     self.elm_model_text = ui.Text(readonly=True)
     self.table_model_text = ui.Text(readonly=True)
     self.table_state_text = ui.Text(readonly=True)
     self.env_model_text = ui.Text(readonly=True)
     self.reload_status_button = ui.Button("&Reload",
                                           clicked=self.on_reload)
     self.layout = ui.Column(
         ui.GroupBox(title="Matrix",
                     layout=ui.Column(
                         ui.Row(ui.Label("Model:"),
                                self.matrix_model_text,
                                stretch=(1, 7)),
                         ui.Row(ui.Label("Closed channels:"),
                                self.matrix_channels_text,
                                stretch=(1, 7)))),
         ui.GroupBox(title="HVSource",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.hvsrc_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="VSource",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.vsrc_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="LCRMeter",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.lcr_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="Electrometer",
                     layout=ui.Row(ui.Label("Model:"),
                                   self.elm_model_text,
                                   stretch=(1, 7))),
         ui.GroupBox(title="Table",
                     layout=ui.Column(
                         ui.Row(ui.Label("Model:"),
                                self.table_model_text,
                                stretch=(1, 7)),
                         ui.Row(ui.Label("State:"),
                                self.table_state_text,
                                stretch=(1, 7)))),
         ui.GroupBox(title="Environment Box",
                     layout=ui.Column(
                         ui.Row(ui.Label("Model:"),
                                self.env_model_text,
                                stretch=(1, 7)))), ui.Spacer(),
         self.reload_status_button)
示例#11
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.matrix_enable = ui.CheckBox(text="Enable Switching")
        self.matrix_channels = MatrixChannelsText(
            tool_tip="Matrix card switching channels, comma separated list."
        )

        self.bind("matrix_enable", self.matrix_enable, False)
        self.bind("matrix_channels", self.matrix_channels, [])

        self.control_tabs.append(ui.Tab(
            title="Matrix",
            layout=ui.Column(
                ui.GroupBox(
                    title="Matrix",
                    layout=ui.Column(
                        self.matrix_enable,
                        ui.Label(text="Channels"),
                        ui.Row(
                            self.matrix_channels,
                            # ui.Button(text="Load from Matrix", clicked=self.load_matrix_channels)
                        )
                    )
                ),
                ui.Spacer(),
                stretch=(0, 1)
            )
        ))
示例#12
0
 def __init__(self, joystick_toggled=None, control_clicked=None, **kwargs):
     super().__init__(**kwargs)
     self.title = "Table"
     self.checkable = True
     self._joystick_button = ToggleButton(
         text="Joystick",
         tool_tip="Toggle table joystick",
         checkable=True,
         toggled=self.on_joystick_toggled
     )
     self._position_label = ui.Label(
         text="...",
         tool_tip="Current table position."
     )
     self._control_button = ui.Button(
         text="Control...",
         tool_tip="Open table controls dialog.",
         clicked=self.on_control_clicked
     )
     self.layout=ui.Row(
         self._joystick_button,
         ui.Widget(),
         self._position_label,
         ui.Widget(),
         self._control_button
     )
     # Callbacks
     self.joystick_toggled = joystick_toggled
     self.control_clicked = control_clicked
示例#13
0
 def __init__(self, *args, table_move_to=None, table_contact=None, **kwargs):
     super().__init__(*args, **kwargs)
     self.table_move_to = table_move_to
     self.table_contact = table_contact
     self.title = "Contact"
     self.pos_x_label = PositionLabel()
     self.pos_y_label = PositionLabel()
     self.pos_z_label = PositionLabel()
     # self.move_to_button = ui.Button(
     #     text="Move to",
     #     tool_tip="Move table to position with safe Z distance.",
     #     clicked=self.on_move_to,
     #     enabled=False
     # )
     self.contact_button = ui.Button(
         text="Contact",
         tool_tip="Move table to position and contact.",
         clicked=self.on_contact,
         enabled=False
     )
     self.layout.insert(2, ui.Row(
         ui.GroupBox(
             title="Position",
             layout=ui.Row(
                 ui.Column(
                     ui.Label("X"),
                     ui.Label("Y"),
                     ui.Label("Z")
                 ),
                 ui.Column(
                     self.pos_x_label,
                     self.pos_y_label,
                     self.pos_z_label,
                 )
             )
         ),
         ui.GroupBox(
             title="Table Actions",
             layout=ui.Column(
                 # self.move_to_button,
                 self.contact_button
             )
         ),
         ui.Spacer(vertical=False),
     ))
示例#14
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.title = "Calibration"
     self._cal_x_label = CalibrationLabel("cal")
     self._cal_y_label = CalibrationLabel("cal")
     self._cal_z_label = CalibrationLabel("cal")
     self._rm_x_label = CalibrationLabel("rm")
     self._rm_y_label = CalibrationLabel("rm")
     self._rm_z_label = CalibrationLabel("rm")
     self.layout = ui.Row(ui.Column(
         ui.Label(text="X", tool_tip="X axis calibration state."),
         ui.Label(text="Y", tool_tip="Y axis calibration state."),
         ui.Label(text="Z", tool_tip="Z axis calibration state.")),
                          ui.Column(self._cal_x_label, self._cal_y_label,
                                    self._cal_z_label),
                          ui.Column(self._rm_x_label, self._rm_y_label,
                                    self._rm_z_label),
                          stretch=(1, 1, 1))
示例#15
0
    def register_environment(self):
        self.status_env_chuck_temperature = ui.Text(value=NO_VALUE,
                                                    readonly=True)
        self.status_env_box_temperature = ui.Text(value=NO_VALUE,
                                                  readonly=True)
        self.status_env_box_humidity = ui.Text(value=NO_VALUE, readonly=True)

        self.bind("status_env_chuck_temperature",
                  self.status_env_chuck_temperature, NO_VALUE)
        self.bind("status_env_box_temperature",
                  self.status_env_box_temperature, NO_VALUE)
        self.bind("status_env_box_humidity", self.status_env_box_humidity,
                  NO_VALUE)

        self.status_panel.append(
            ui.GroupBox(title="Environment Status",
                        layout=ui.Column(
                            ui.Row(
                                ui.Column(ui.Label("Chuck temp."),
                                          self.status_env_chuck_temperature),
                                ui.Column(ui.Label("Box temp."),
                                          self.status_env_box_temperature),
                                ui.Column(ui.Label("Box humid."),
                                          self.status_env_box_humidity)))))

        def handler(state):
            if 'env_chuck_temperature' in state:
                value = state.get('env_chuck_temperature', )
                self.status_env_chuck_temperature.value = format_metric(
                    value, "°C", decimals=2)
            if 'env_box_temperature' in state:
                value = state.get('env_box_temperature')
                self.status_env_box_temperature.value = format_metric(
                    value, "°C", decimals=2)
            if 'env_box_humidity' in state:
                value = state.get('env_box_humidity')
                self.status_env_box_humidity.value = format_metric(value,
                                                                   "%rH",
                                                                   decimals=2)

        self.state_handlers.append(handler)
示例#16
0
 def __init__(self, position_picked=None, **kwargs):
     super().__init__(**kwargs)
     self.position_picked = position_picked
     self._name_text = ui.Text(value="Unnamed")
     self._x_number = ui.Number(value=0.,
                                minimum=0.,
                                maximum=1000.,
                                decimals=3,
                                suffix="mm")
     self._y_number = ui.Number(value=0.,
                                minimum=0.,
                                maximum=1000.,
                                decimals=3,
                                suffix="mm")
     self._z_number = ui.Number(value=0.,
                                minimum=0.,
                                maximum=1000.,
                                decimals=3,
                                suffix="mm")
     self._comment_text = ui.Text()
     self._assign_button = ui.Button(
         text="Assign Position",
         tool_tip="Assign current table position.",
         clicked=self.on_assign_clicked)
     self._button_box = ui.DialogButtonBox(buttons=("ok", "cancel"),
                                           accepted=self.accept,
                                           rejected=self.reject)
     self.layout = ui.Column(
         ui.Label("Name", tool_tip="Position name"), self._name_text,
         ui.Row(
             ui.Column(ui.Label("X", tool_tip="Position X coordinate"),
                       self._x_number),
             ui.Column(ui.Label("Y", tool_tip="Position Y coordinate"),
                       self._y_number),
             ui.Column(ui.Label("Z", tool_tip="Position Z coordinate"),
                       self._z_number),
             ui.Column(
                 ui.Spacer(),
                 self._assign_button,
             )), ui.Label("Comment", tool_tip="Optional position comment"),
         self._comment_text, ui.Spacer(), self._button_box)
示例#17
0
    def __init__(self):
        super().__init__(title="Environment")

        # Data series
        self.box_temperature_series = []
        self.chuck_temperature_series = []
        self.box_humidity_series = []

        # Plot
        self.plot = ui.Plot(legend="right")
        self.plot.add_axis("x", align="bottom", type="datetime")
        self.plot.add_axis("y1",
                           align="left",
                           text="Temperature [°C]",
                           color="red")
        self.plot.add_axis("y2",
                           align="right",
                           text="Humidity [%rH]",
                           color="blue")
        self.plot.add_series("box_temperature",
                             "x",
                             "y1",
                             text="Box Temperature",
                             color="red")
        self.plot.add_series("chuck_temperature",
                             "x",
                             "y1",
                             text="Chuck Temperature",
                             color="magenta")
        self.plot.add_series("box_humidity",
                             "x",
                             "y2",
                             text="Box Humidity",
                             color="blue")

        # Inputs
        self.box_temperature_number = ui.Number(suffix="°C",
                                                decimals=1,
                                                readonly=True)
        self.box_humidity_number = ui.Number(suffix="%rH",
                                             decimals=1,
                                             readonly=True)
        self.chuck_temperature_number = ui.Number(suffix="°C",
                                                  decimals=1,
                                                  readonly=True)
        self.box_lux_number = ui.Number(suffix="Lux",
                                        decimals=1,
                                        readonly=True)
        self.box_light_text = ui.Text(readonly=True)
        self.box_door_text = ui.Text(readonly=True)

        # Layout
        self.layout = ui.Column(
            self.plot,
            ui.Label("Box Temperature"), self.box_temperature_number,
            ui.Label("Box Humidity"), self.box_humidity_number,
            ui.Label("Chuck Temperature"), self.chuck_temperature_number,
            ui.Label("Box Light"), self.box_lux_number,
            ui.Label("Box Light State"), self.box_light_text,
            ui.Label("Box Door State"), self.box_door_text, ui.Spacer())
示例#18
0
 def __init__(self, context, table_enabled):
     super().__init__()
     self.title = "Start Sequence"
     self._contact_checkbox = ui.CheckBox(
         text="Move table and contact with Probe Card",
         checked=True,
         enabled=table_enabled)
     self._position_checkbox = ui.CheckBox(
         text="Move table after measurements",
         checked=False,
         enabled=table_enabled,
         changed=self.on_position_checkbox_toggled)
     self._positions_combobox = PositionsComboBox(enabled=False)
     self._operator_combobox = OperatorWidget()
     self._output_combobox = WorkingDirectoryWidget()
     self._button_box = ui.DialogButtonBox(buttons=("yes", "no"),
                                           accepted=self.accept,
                                           rejected=self.reject)
     self._button_box.qt.button(
         self._button_box.QtClass.Yes).setAutoDefault(False)
     self._button_box.qt.button(
         self._button_box.QtClass.No).setDefault(True)
     self.layout = ui.Column(
         ui.Label(text=self._create_message(context)),
         ui.GroupBox(title="Table",
                     layout=ui.Column(
                         self._contact_checkbox,
                         ui.Row(self._position_checkbox,
                                self._positions_combobox), ui.Spacer())),
         ui.Row(ui.GroupBox(title="Operator",
                            layout=self._operator_combobox),
                ui.GroupBox(title="Working Directory",
                            layout=self._output_combobox),
                stretch=(2, 3)),
         self._button_box,
         stretch=(1, 0, 0, 0))
示例#19
0
    def __init__(self):
        super().__init__(title="Table")
        self.temporary_z_limit_changed = None
        self._steps_tree = ui.Tree(header=("Size", "Z-Limit", "Color"),
                                   root_is_decorated=False)
        # Hide Z-Limit column
        self._steps_tree.qt.setColumnHidden(1, True)
        self._steps_tree.selected = self.on_position_selected
        self._steps_tree.double_clicked = self.on_steps_tree_double_clicked
        self._steps_tree.qt.setItemDelegateForColumn(
            0, ItemDelegate(self._steps_tree.qt))
        self._steps_tree.qt.setItemDelegateForColumn(
            1, ItemDelegate(self._steps_tree.qt))
        self._add_step_button = ui.Button(text="&Add",
                                          tool_tip="Add table step",
                                          clicked=self.on_add_step_clicked)
        self._edit_step_button = ui.Button(text="&Edit",
                                           tool_tip="Edit selected table step",
                                           enabled=False,
                                           clicked=self.on_edit_step_clicked)
        self._remove_step_button = ui.Button(
            text="&Remove",
            tool_tip="Remove selected table step",
            enabled=False,
            clicked=self.on_remove_step_clicked)
        self._z_limit_movement_number = ui.Number(
            minimum=0,
            maximum=128.0,
            decimals=3,
            suffix="mm",
            changed=self.on_z_limit_movement_changed)

        def create_number():
            return ui.Number(minimum=0,
                             maximum=1000.0,
                             decimals=3,
                             suffix="mm")

        self._probecard_limit_x_maximum_number = create_number()
        self._probecard_limit_y_maximum_number = create_number()
        self._probecard_limit_z_maximum_number = create_number()
        self._probecard_limit_z_maximum_checkbox = ui.CheckBox(
            text="Temporary Z-Limit",
            tool_tip="Select to show temporary Z-Limit notice.")
        self._joystick_limit_x_maximum_number = create_number()
        self._joystick_limit_y_maximum_number = create_number()
        self._joystick_limit_z_maximum_number = create_number()
        self._probecard_contact_delay_number = ui.Number(minimum=0,
                                                         maximum=3600,
                                                         decimals=2,
                                                         step=.1,
                                                         suffix="s")
        self._recontact_overdrive_number = ui.Number(minimum=0,
                                                     maximum=0.025,
                                                     decimals=3,
                                                     step=.001,
                                                     suffix="mm")
        self.layout = ui.Column(
            ui.GroupBox(title="Control Steps (mm)",
                        layout=ui.Row(self._steps_tree,
                                      ui.Column(self._add_step_button,
                                                self._edit_step_button,
                                                self._remove_step_button,
                                                ui.Spacer()),
                                      stretch=(1, 0))),
            ui.GroupBox(title="Movement Z-Limit",
                        layout=ui.Column(self._z_limit_movement_number)),
            ui.GroupBox(title="Probe Card Limts",
                        layout=ui.Row(
                            ui.Column(ui.Label("X"),
                                      self._probecard_limit_x_maximum_number),
                            ui.Column(ui.Label("Y"),
                                      self._probecard_limit_y_maximum_number),
                            ui.Column(ui.Label("Z"),
                                      self._probecard_limit_z_maximum_number),
                            ui.Column(
                                ui.Label(),
                                ui.Label("Maximum"),
                            ), ui.Spacer(),
                            ui.Column(
                                ui.Label(),
                                self._probecard_limit_z_maximum_checkbox,
                            ))),
            ui.GroupBox(title="Joystick Limits",
                        layout=ui.Row(
                            ui.Column(ui.Label("X"),
                                      self._joystick_limit_x_maximum_number),
                            ui.Column(ui.Label("Y"),
                                      self._joystick_limit_y_maximum_number),
                            ui.Column(ui.Label("Z"),
                                      self._joystick_limit_z_maximum_number),
                            ui.Column(
                                ui.Label(),
                                ui.Label("Maximum"),
                            ), ui.Spacer())),
            ui.Row(ui.GroupBox(title="Probecard Contact Delay",
                               layout=ui.Row(
                                   self._probecard_contact_delay_number)),
                   ui.GroupBox(title="Re-Contact Z-Overdrive (1x)",
                               layout=ui.Row(
                                   self._recontact_overdrive_number)),
                   stretch=(0, 1)),
            stretch=(1, 0, 0, 0, 0))
示例#20
0
 def __init__(self, process, lcr_process):
     super().__init__()
     self.lcr_process = lcr_process
     self.lcr_process.finished = self.on_lcr_finished
     self.lcr_process.failed = self.on_lcr_failed
     self.lcr_process.reading = self.on_lcr_reading
     self.mount(process)
     self.resize(640, 480)
     self.title = "Table Control"
     self.add_x_button = KeypadButton(text="+X", clicked=self.on_add_x)
     self.sub_x_button = KeypadButton(text="-X", clicked=self.on_sub_x)
     self.add_y_button = KeypadButton(text="+Y", clicked=self.on_add_y)
     self.sub_y_button = KeypadButton(text="-Y", clicked=self.on_sub_y)
     self.add_z_button = KeypadButton(text="+Z", clicked=self.on_add_z)
     self.sub_z_button = KeypadButton(text="-Z", clicked=self.on_sub_z)
     self.step_up_button = KeypadButton(
         text="↑⇵",
         tool_tip=
         "Step up, move single step up then double step down and double step up (experimental).",
         clicked=self.on_step_up)
     self.control_buttons = (self.add_x_button, self.sub_x_button,
                             self.add_y_button, self.sub_y_button,
                             self.add_z_button, self.sub_z_button,
                             self.step_up_button)
     self._lcr_prim_text = ui.Text(readonly=True)
     self._lcr_sec_text = ui.Text(readonly=True)
     self._lcr_chart = LCRChart()
     self._lcr_groupbox = ui.GroupBox(
         title="Contact Quality (LCR)",
         checkable=True,
         checked=False,
         toggled=self.on_lcr_toggled,
         layout=ui.Column(ui.Row(ui.Label("Cp"), self._lcr_prim_text),
                          ui.Row(ui.Label("Rp"), self._lcr_sec_text),
                          self._lcr_chart))
     self.probecard_light_button = ToggleButton(
         text="PC Light",
         tool_tip="Toggle probe card light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_probecard_light_clicked)
     self.microscope_light_button = ToggleButton(
         text="Mic Light",
         tool_tip="Toggle microscope light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_microscope_light_clicked)
     self.box_light_button = ToggleButton(text="Box Light",
                                          tool_tip="Toggle box light",
                                          checkable=True,
                                          checked=False,
                                          enabled=False,
                                          toggled=self.on_box_light_clicked)
     # Create movement radio buttons
     self.step_width_buttons = ui.Column()
     for item in self.load_table_step_sizes():
         step_size = item.get('step_size') * comet.ureg('um')
         step_color = item.get('step_color')
         step_size_label = format_metric(step_size.to('m').m,
                                         'm',
                                         decimals=1)
         button = ui.RadioButton(
             text=step_size_label,
             tool_tip=f"Move in {step_size_label} steps.",
             stylesheet=f"QRadioButton:enabled{{color:{step_color};}}",
             checked=len(self.step_width_buttons) == 0,
             toggled=self.on_step_toggled)
         button.movement_width = step_size.to('mm').m
         button.movement_color = step_color
         self.step_width_buttons.append(button)
     self.control_layout = ui.Column(ui.Row(ui.Row(
         ui.Column(KeypadSpacer(), self.sub_y_button, KeypadSpacer()),
         ui.Column(
             self.sub_x_button,
             KeypadSpacer(),
             self.add_x_button,
         ), ui.Column(
             KeypadSpacer(),
             self.add_y_button,
             KeypadSpacer(),
         ), KeypadSpacer(),
         ui.Column(ui.Row(self.add_z_button, self.step_up_button),
                   KeypadSpacer(), self.sub_z_button)),
                                            ui.Spacer(),
                                            stretch=(0, 1)),
                                     ui.Spacer(),
                                     stretch=(0, 1))
     self.positions_widget = TablePositionsWidget(
         enabled=False,
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self.contacts_widget = TableContactsWidget(
         enabled=False,
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self._position_widget = PositionWidget()
     self._calibration_widget = CalibrationWidget()
     self.z_limit_label = PositionLabel()
     self.x_hard_limit_label = PositionLabel()
     self.y_hard_limit_label = PositionLabel()
     self.z_hard_limit_label = PositionLabel()
     self.laser_label = SwitchLabel()
     self._calibrate_button = ui.Button(text="Calibrate",
                                        clicked=self.on_calibrate)
     self._update_interval_number = ui.Number(
         value=settings.table_control_update_interval,
         minimum=.5,
         maximum=10.0,
         decimals=2,
         step=0.25,
         suffix="s",
         changed=self.on_update_interval_changed)
     self._interval_groupbox = ui.GroupBox(title="Update Interval",
                                           layout=ui.Row(
                                               self._update_interval_number,
                                               ui.Spacer(),
                                               stretch=(0, 1)))
     self._dodge_height_number = ui.Number(
         tool_tip="Doge height in microns.",
         minimum=0,
         maximum=10000,
         decimals=0,
         step=1,
         suffix="um")
     self._dodge_groupbox = ui.GroupBox(
         title="X/Y Dodge",
         tool_tip="Enables -/+ Z dodge for XY movements.",
         checkable=True,
         layout=ui.Row(ui.Label("Height"),
                       self._dodge_height_number,
                       ui.Spacer(),
                       stretch=(0, 0, 1)))
     self._lcr_reset_on_move_checkbox = ui.CheckBox(
         text="Reset graph on X/Y move")
     self._contact_quality_groupbox = ui.GroupBox(
         title="Contact Quality (LCR)",
         layout=ui.Row(self._lcr_reset_on_move_checkbox,
                       ui.Spacer(),
                       stretch=(0, 1)))
     self._step_up_delay_number = ui.Number(minimum=0,
                                            maximum=1000,
                                            decimals=0,
                                            step=25,
                                            suffix="ms")
     self._step_up_multiply_number = ui.Number(minimum=1,
                                               maximum=10,
                                               decimals=0,
                                               suffix="x")
     self._step_up_groubox = ui.GroupBox(
         title="Step Up (↑⇵)",
         layout=ui.Row(
             ui.Column(ui.Label("Delay"), ui.Label("Multiplicator (⇵)")),
             ui.Column(self._step_up_delay_number,
                       self._step_up_multiply_number), ui.Spacer()))
     self._lcr_update_interval_number = ui.Number(minimum=0,
                                                  maximum=1000,
                                                  decimals=0,
                                                  step=25,
                                                  suffix="ms")
     self._lcr_matrix_channels_text = ui.Text()
     self._lcr_options_groupbox = ui.GroupBox(
         title="Contact Quality (LCR)",
         layout=ui.Row(
             ui.Column(
                 ui.Label("Reading Interval"),
                 ui.Label("Matrix Channels"),
             ),
             ui.Column(
                 ui.Row(self._lcr_update_interval_number, ui.Spacer()),
                 self._lcr_matrix_channels_text)))
     self.progress_bar = ui.ProgressBar(visible=False)
     self.message_label = ui.Label()
     self.stop_button = ui.Button(text="&Stop",
                                  default=False,
                                  auto_default=False,
                                  enabled=False,
                                  clicked=self.on_stop)
     self.close_button = ui.Button(text="&Close",
                                   default=False,
                                   auto_default=False,
                                   clicked=self.on_close)
     self.layout = ui.Column(
         ui.Row(
             ui.Column(
                 ui.Row(
                     ui.GroupBox(
                         title="Control",
                         layout=ui.Column(
                             ui.Spacer(horizontal=False),
                             self.control_layout,
                             ui.Spacer(horizontal=False)
                         )
                     ),
                     ui.GroupBox(
                         title="Step Width",
                         layout=self.step_width_buttons
                     ),
                     self._lcr_groupbox,
                     ui.Column(
                         ui.GroupBox(
                             title="Lights",
                             layout=ui.Column(
                                 self.probecard_light_button,
                                 self.microscope_light_button,
                                 self.box_light_button,
                                 ui.Spacer()
                             )
                         )
                     ),
                     stretch=(0, 0, 1, 0)
                 ),
                 ui.Tabs(
                     ui.Tab(
                         title="Move",
                         layout=self.positions_widget
                     ),
                     ui.Tab(
                         title="Contacts",
                         layout=self.contacts_widget
                     ),
                     ui.Tab(
                         title="Calibrate",
                         layout=ui.Column(
                             ui.GroupBox(
                                 title="Table Calibration",
                                 layout=ui.Column(
                                     ui.Row(
                                         self._calibrate_button,
                                         ui.Label("Calibrate table by moving into cal/rm switches\nof every axis in" \
                                                  " a safe manner to protect the probe card."),
                                         stretch=(0, 1)
                                     )
                                 )
                             ),
                             ui.Spacer(),
                             stretch=(0, 1)
                         )
                     ),
                     ui.Tab(
                         title="Options",
                         layout=ui.Column(
                             ui.Row(
                                 self._interval_groupbox,
                                 self._dodge_groupbox,
                                 self._contact_quality_groupbox,
                                 stretch=(0, 0, 1)
                             ),
                             self._step_up_groubox,
                             self._lcr_options_groupbox,
                             ui.Spacer(),
                             stretch=(0, 0, 0, 1)
                         )
                     )
                 ),
                 stretch=(0, 1)
             ),
             ui.Column(
                 self._position_widget,
                 self._calibration_widget,
                 ui.GroupBox(
                     title="Soft Limits",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.z_limit_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Hard Limits",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("X"),
                             ui.Label("Y"),
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.x_hard_limit_label,
                             self.y_hard_limit_label,
                             self.z_hard_limit_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Safety",
                     layout=ui.Row(
                         ui.Label(
                             text="Laser Sensor"
                         ),
                         self.laser_label
                     )
                 ),
                 ui.Spacer()
             ),
             stretch=(1, 0)
         ),
         ui.Row(
             self.progress_bar,
             self.message_label,
             ui.Spacer(),
             self.stop_button,
             self.close_button
         ),
         stretch=(1, 0)
     )
     self.close_event = self.on_close_event
     self.reset_position()
     self.reset_caldone()
     self.update_limits()
     self.reset_safety()
     self.update_control_buttons()
示例#21
0
    def register_electrometer(self):
        def toggle_elm_filter(enabled):
            self.elm_filter_count.enabled = enabled
            self.elm_filter_count_label.enabled = enabled
            self.elm_filter_type.enabled = enabled
            self.elm_filter_type_label.enabled = enabled

        self.elm_filter_enable = ui.CheckBox(text="Enable",
                                             changed=toggle_elm_filter)
        self.elm_filter_count = ui.Number(minimum=0, maximum=100, decimals=0)
        self.elm_filter_count_label = ui.Label(text="Count")
        self.elm_filter_type = ui.ComboBox(["repeat", "moving"])
        self.elm_filter_type_label = ui.Label(text="Type")

        self.elm_zero_correction = ui.CheckBox(text="Zero Correction")
        self.elm_integration_rate = ui.Number(minimum=0,
                                              maximum=100.0,
                                              decimals=2,
                                              suffix="Hz")

        def toggle_elm_current_autorange(enabled):
            self.elm_current_range.enabled = not enabled
            self.elm_current_autorange_minimum.enabled = enabled
            self.elm_current_autorange_maximum.enabled = enabled

        self.elm_current_range = ui.Metric(minimum=0,
                                           decimals=3,
                                           prefixes='munp',
                                           unit="A")
        self.elm_current_autorange_enable = ui.CheckBox(
            text="Enable", changed=toggle_elm_current_autorange)
        self.elm_current_autorange_minimum = ui.Metric(minimum=0,
                                                       decimals=3,
                                                       prefixes='munp',
                                                       unit="A")
        self.elm_current_autorange_maximum = ui.Metric(minimum=0,
                                                       decimals=3,
                                                       prefixes='munp',
                                                       unit="A")

        toggle_elm_filter(False)
        toggle_elm_current_autorange(False)

        self.bind("elm_filter_enable", self.elm_filter_enable, False)
        self.bind("elm_filter_count", self.elm_filter_count, 10)
        self.bind("elm_filter_type", self.elm_filter_type, "repeat")
        self.bind("elm_zero_correction", self.elm_zero_correction, False)
        self.bind("elm_integration_rate", self.elm_integration_rate, 50.0)
        self.bind("elm_current_range",
                  self.elm_current_range,
                  20e-12,
                  unit="A")
        self.bind("elm_current_autorange_enable",
                  self.elm_current_autorange_enable, False)
        self.bind("elm_current_autorange_minimum",
                  self.elm_current_autorange_minimum,
                  2.0E-11,
                  unit="A")
        self.bind("elm_current_autorange_maximum",
                  self.elm_current_autorange_maximum,
                  2.0E-2,
                  unit="A")

        self.status_elm_current = ui.Text(value=NO_VALUE, readonly=True)

        self.bind("status_elm_current", self.status_elm_current, NO_VALUE)

        self.status_panel.append(
            ui.GroupBox(title="Electrometer Status",
                        layout=ui.Column(
                            ui.Row(ui.Column(ui.Label("Current"),
                                             self.status_elm_current),
                                   ui.Spacer(),
                                   stretch=(1, 2)))))

        self.control_tabs.append(
            ui.Tab(
                title="Electrometer",
                layout=ui.Row(
                    ui.GroupBox(title="Filter",
                                layout=ui.Column(self.elm_filter_enable,
                                                 self.elm_filter_count_label,
                                                 self.elm_filter_count,
                                                 self.elm_filter_type_label,
                                                 self.elm_filter_type,
                                                 ui.Spacer())),
                    ui.Column(
                        ui.GroupBox(title="Range",
                                    layout=ui.Column(
                                        ui.Label(text="Current Range"),
                                        self.elm_current_range,
                                    )),
                        ui.GroupBox(title="Auto Range",
                                    layout=ui.Column(
                                        self.elm_current_autorange_enable,
                                        ui.Label(text="Minimum Current"),
                                        self.elm_current_autorange_minimum,
                                        ui.Label(text="Maximum Current"),
                                        self.elm_current_autorange_maximum,
                                        ui.Spacer()))),
                    ui.GroupBox(title="Options",
                                layout=ui.Column(
                                    self.elm_zero_correction,
                                    ui.Label(text="Integration Rate"),
                                    self.elm_integration_rate, ui.Spacer())),
                    ui.Spacer(),
                    stretch=(1, 1, 1))))

        def handler(state):
            if 'elm_current' in state:
                value = state.get('elm_current')
                self.status_elm_current.value = format_metric(value, "A")

        self.state_handlers.append(handler)
示例#22
0
    def register_vsource(self):
        self.hvsrc_sense_mode = ui.ComboBox(["local", "remote"])
        self.hvsrc_route_terminal = ui.ComboBox(["front", "rear"])

        def toggle_hvsrc_filter(enabled):
            self.hvsrc_filter_count.enabled = enabled
            self.hvsrc_filter_count_label.enabled = enabled
            self.hvsrc_filter_type.enabled = enabled
            self.hvsrc_filter_type_label.enabled = enabled

        self.hvsrc_filter_enable = ui.CheckBox(text="Enable",
                                               changed=toggle_hvsrc_filter)
        self.hvsrc_filter_count = ui.Number(minimum=0, maximum=100, decimals=0)
        self.hvsrc_filter_count_label = ui.Label(text="Count")
        self.hvsrc_filter_type = ui.ComboBox(["repeat", "moving"])
        self.hvsrc_filter_type_label = ui.Label(text="Type")

        def toggle_hvsrc_source_voltage_autorange(enabled):
            self.hvsrc_source_voltage_range.enabled = not enabled

        self.hvsrc_source_voltage_autorange_enable = ui.CheckBox(
            text="Autorange", changed=toggle_hvsrc_source_voltage_autorange)
        self.hvsrc_source_voltage_range = ui.Number(minimum=-1100,
                                                    maximum=1100,
                                                    decimals=1,
                                                    suffix="V")

        toggle_hvsrc_filter(False)
        toggle_hvsrc_source_voltage_autorange(False)

        self.bind("hvsrc_sense_mode", self.hvsrc_sense_mode, "local")
        self.bind("hvsrc_route_terminal", self.hvsrc_route_terminal, "rear")
        self.bind("hvsrc_filter_enable", self.hvsrc_filter_enable, False)
        self.bind("hvsrc_filter_count", self.hvsrc_filter_count, 10)
        self.bind("hvsrc_filter_type", self.hvsrc_filter_type, "repeat")
        self.bind("hvsrc_source_voltage_autorange_enable",
                  self.hvsrc_source_voltage_autorange_enable, True)
        self.bind("hvsrc_source_voltage_range",
                  self.hvsrc_source_voltage_range,
                  20,
                  unit="V")

        self.status_hvsrc_voltage = ui.Text(value=NO_VALUE, readonly=True)
        self.status_hvsrc_current = ui.Text(value=NO_VALUE, readonly=True)
        self.status_hvsrc_output = ui.Text(value=NO_VALUE, readonly=True)

        self.bind("status_hvsrc_voltage", self.status_hvsrc_voltage, NO_VALUE)
        self.bind("status_hvsrc_current", self.status_hvsrc_current, NO_VALUE)
        self.bind("status_hvsrc_output", self.status_hvsrc_output, NO_VALUE)

        self.status_panel.append(
            ui.GroupBox(title="HV Source Status",
                        layout=ui.Column(
                            ui.Row(
                                ui.Column(ui.Label("Voltage"),
                                          self.status_hvsrc_voltage),
                                ui.Column(ui.Label("Current"),
                                          self.status_hvsrc_current),
                                ui.Column(ui.Label("Output"),
                                          self.status_hvsrc_output)))))

        self.control_tabs.append(
            ui.Tab(
                title="HV Source",
                layout=ui.Row(
                    ui.GroupBox(title="Filter",
                                layout=ui.Column(self.hvsrc_filter_enable,
                                                 self.hvsrc_filter_count_label,
                                                 self.hvsrc_filter_count,
                                                 self.hvsrc_filter_type_label,
                                                 self.hvsrc_filter_type,
                                                 ui.Spacer())),
                    ui.GroupBox(title="Source Voltage Range",
                                layout=ui.Column(
                                    self.hvsrc_source_voltage_autorange_enable,
                                    ui.Label(text="Range"),
                                    self.hvsrc_source_voltage_range,
                                    ui.Spacer())),
                    ui.GroupBox(title="Options",
                                layout=ui.Column(
                                    ui.Label(text="Sense Mode"),
                                    self.hvsrc_sense_mode,
                                    ui.Label(text="Route Terminal"),
                                    self.hvsrc_route_terminal, ui.Spacer())),
                    stretch=(1, 1, 1))))

        def handler(state):
            if 'hvsrc_voltage' in state:
                value = state.get('hvsrc_voltage')
                self.status_hvsrc_voltage.value = format_metric(value, "V")
            if 'hvsrc_current' in state:
                value = state.get('hvsrc_current')
                self.status_hvsrc_current.value = format_metric(value, "A")
            if 'hvsrc_output' in state:
                value = state.get('hvsrc_output')
                self.status_hvsrc_output.value = format_switch(
                    value, default=NO_VALUE)

        self.state_handlers.append(handler)
示例#23
0
 def __init__(self, process):
     super().__init__()
     self.mount(process)
     self.resize(640, 480)
     self.title = "Table Control"
     self.add_x_button = KeypadButton(text="+X", clicked=self.on_add_x)
     self.sub_x_button = KeypadButton(text="-X", clicked=self.on_sub_x)
     self.add_y_button = KeypadButton(text="+Y", clicked=self.on_add_y)
     self.sub_y_button = KeypadButton(text="-Y", clicked=self.on_sub_y)
     self.add_z_button = KeypadButton(text="+Z", clicked=self.on_add_z)
     self.sub_z_button = KeypadButton(text="-Z", clicked=self.on_sub_z)
     self.control_buttons = (self.add_x_button, self.sub_x_button,
                             self.add_y_button, self.sub_y_button,
                             self.add_z_button, self.sub_z_button)
     self.probecard_light_button = ToggleButton(
         text="PC Light",
         tool_tip="Toggle probe card light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_probecard_light_clicked)
     self.microscope_light_button = ToggleButton(
         text="Mic Light",
         tool_tip="Toggle microscope light",
         checkable=True,
         checked=False,
         enabled=False,
         toggled=self.on_microscope_light_clicked)
     self.box_light_button = ToggleButton(text="Box Light",
                                          tool_tip="Toggle box light",
                                          checkable=True,
                                          checked=False,
                                          enabled=False,
                                          toggled=self.on_box_light_clicked)
     # Create movement radio buttons
     self.step_width_buttons = ui.Column()
     for item in self.load_table_step_sizes():
         step_size = item.get('step_size') * comet.ureg('um')
         step_color = item.get('step_color')
         step_size_label = format_metric(step_size.to('m').m,
                                         'm',
                                         decimals=1)
         button = ui.RadioButton(
             text=step_size_label,
             tool_tip=f"Move in {step_size_label} steps.",
             stylesheet=f"QRadioButton:enabled{{color:{step_color};}}",
             checked=len(self.step_width_buttons) == 0,
             toggled=self.on_step_toggled)
         button.movement_width = step_size.to('mm').m
         button.movement_color = step_color
         self.step_width_buttons.append(button)
     self.control_layout = ui.Column(ui.Row(ui.Row(
         ui.Column(KeypadSpacer(), self.sub_y_button, KeypadSpacer()),
         ui.Column(
             self.sub_x_button,
             KeypadSpacer(),
             self.add_x_button,
         ), ui.Column(
             KeypadSpacer(),
             self.add_y_button,
             KeypadSpacer(),
         ), KeypadSpacer(),
         ui.Column(self.add_z_button, KeypadSpacer(), self.sub_z_button)),
                                            ui.Spacer(),
                                            stretch=(0, 1)),
                                     ui.Spacer(),
                                     stretch=(0, 1))
     self.positions_widget = TablePositionsWidget(
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self.contacts_widget = TableContactsWidget(
         position_picked=self.on_position_picked,
         absolute_move=self.on_absolute_move)
     self.pos_x_label = PositionLabel()
     self.pos_y_label = PositionLabel()
     self.pos_z_label = PositionLabel()
     self.cal_x_label = CalibrationLabel("cal")
     self.cal_y_label = CalibrationLabel("cal")
     self.cal_z_label = CalibrationLabel("cal")
     self.rm_x_label = CalibrationLabel("rm")
     self.rm_y_label = CalibrationLabel("rm")
     self.rm_z_label = CalibrationLabel("rm")
     self.z_limit_label = PositionLabel()
     self.laser_label = SwitchLabel()
     self.calibrate_button = ui.Button(text="Calibrate",
                                       clicked=self.on_calibrate)
     self.update_interval_number = ui.Number(
         value=self.settings.get("table_control_update_interval") or 1.0,
         minimum=.5,
         maximum=10.0,
         decimals=2,
         step=0.25,
         suffix="s",
         changed=self.on_update_interval_changed)
     self.progress_bar = ui.ProgressBar(visible=False)
     self.message_label = ui.Label()
     self.stop_button = ui.Button(text="&Stop",
                                  default=False,
                                  auto_default=False,
                                  enabled=False,
                                  clicked=self.on_stop)
     self.close_button = ui.Button(text="&Close",
                                   default=False,
                                   auto_default=False,
                                   clicked=self.on_close)
     self.layout = ui.Column(
         ui.Row(
             ui.Column(
                 ui.Row(
                     ui.GroupBox(
                         title="Control",
                         layout=ui.Column(
                             ui.Spacer(horizontal=False),
                             self.control_layout,
                             ui.Spacer(horizontal=False)
                         )
                     ),
                     ui.GroupBox(
                         title="Step Width",
                         layout=self.step_width_buttons
                     ),
                     ui.GroupBox(
                         title="Lights",
                         layout=ui.Column(
                             self.probecard_light_button,
                             self.microscope_light_button,
                             self.box_light_button,
                             ui.Spacer()
                         )
                     ),
                     stretch=(0, 1)
                 ),
                 ui.Tabs(
                     ui.Tab(
                         title="Move",
                         layout=self.positions_widget
                     ),
                     ui.Tab(
                         title="Contacts",
                         layout=self.contacts_widget
                     ),
                     ui.Tab(
                         title="Calibrate",
                         layout=ui.Column(
                                 ui.GroupBox(
                                 title="Table Calibration",
                                 layout=ui.Column(
                                     ui.Row(
                                         self.calibrate_button,
                                         ui.Label("Calibrate table by moving into cal/rm switches\nof every axis in" \
                                                  " a safe manner to protect the probe card."),
                                         stretch=(0, 1)
                                     )
                                 )
                             ),
                             ui.Spacer(),
                             stretch=(0, 1)
                         )
                     ),
                     ui.Tab(
                         title="Options",
                         layout=ui.Column(
                             ui.GroupBox(
                                 title="Update Interval",
                                 layout=ui.Row(
                                     self.update_interval_number,
                                     ui.Spacer(),
                                     stretch=(0, 1)
                                 )
                             ),
                             ui.Spacer(),
                             stretch=(0, 1)
                         )
                     )
                 ),
                 stretch=(0, 1)
             ),
             ui.Column(
                 ui.GroupBox(
                     title="Position",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("X"),
                             ui.Label("Y"),
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.pos_x_label,
                             self.pos_y_label,
                             self.pos_z_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Calibration",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("X"),
                             ui.Label("Y"),
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.cal_x_label,
                             self.cal_y_label,
                             self.cal_z_label
                         ),
                         ui.Column(
                             self.rm_x_label,
                             self.rm_y_label,
                             self.rm_z_label
                         ),
                         stretch=(1, 1)
                     )
                 ),
                 ui.GroupBox(
                     title="Limits",
                     layout=ui.Row(
                         ui.Column(
                             ui.Label("Z")
                         ),
                         ui.Column(
                             self.z_limit_label
                         )
                     )
                 ),
                 ui.GroupBox(
                     title="Safety",
                     layout=ui.Row(
                         ui.Label(
                             text="Laser Sensor"
                         ),
                         self.laser_label
                     )
                 ),
                 ui.Spacer()
             ),
             stretch=(1, 0)
         ),
         ui.Row(
             self.progress_bar,
             self.message_label,
             ui.Spacer(),
             self.stop_button,
             self.close_button
         ),
         stretch=(1, 0)
     )
     self.close_event = self.on_close_event
     self.reset_position()
     self.reset_caldone()
     self.update_limits()
     self.reset_safety()
     self.update_control_buttons()
示例#24
0
    def register_lcr(self):
        def change_lcr_open_correction_mode(mode):
            self.lcr_open_correction_channel.enabled = mode == "multi"

        self.lcr_integration_time = ui.ComboBox(["short", "medium", "long"])
        self.lcr_averaging_rate = ui.Number(minimum=1, maximum=256, decimals=0)
        self.lcr_auto_level_control = ui.CheckBox(text="Auto Level Control")
        self.lcr_soft_filter = ui.CheckBox(text="Filter STD/mean < 0.005")
        self.lcr_open_correction_mode = ui.ComboBox(
            ["single", "multi"], changed=change_lcr_open_correction_mode)
        self.lcr_open_correction_channel = ui.Number(minimum=0,
                                                     maximum=127,
                                                     decimals=0)

        change_lcr_open_correction_mode(self.lcr_open_correction_mode.current)

        self.bind("lcr_integration_time", self.lcr_integration_time, "medium")
        self.bind("lcr_averaging_rate", self.lcr_averaging_rate, 1)
        self.bind("lcr_auto_level_control", self.lcr_auto_level_control, True)
        self.bind("lcr_soft_filter", self.lcr_soft_filter, True)
        self.bind("lcr_open_correction_mode", self.lcr_open_correction_mode,
                  "single")
        self.bind("lcr_open_correction_channel",
                  self.lcr_open_correction_channel, 0)

        self.status_lcr_voltage = ui.Text(value=NO_VALUE, readonly=True)
        self.status_lcr_current = ui.Text(value=NO_VALUE, readonly=True)
        self.status_lcr_output = ui.Text(value=NO_VALUE, readonly=True)

        self.bind("status_lcr_voltage", self.status_lcr_voltage, NO_VALUE)
        self.bind("status_lcr_current", self.status_lcr_current, NO_VALUE)
        self.bind("status_lcr_output", self.status_lcr_output, NO_VALUE)

        self.status_panel.append(
            ui.GroupBox(title="LCR Status",
                        layout=ui.Row(
                            ui.Column(ui.Label("Voltage"),
                                      self.status_lcr_voltage),
                            ui.Column(ui.Label("Current"),
                                      self.status_lcr_current),
                            ui.Column(ui.Label("Output"),
                                      self.status_lcr_output))))

        self.control_tabs.append(
            ui.Tab(title="LCR",
                   layout=ui.Row(
                       ui.GroupBox(title="Open Correction",
                                   layout=ui.Column(
                                       ui.Label(text="Method"),
                                       self.lcr_open_correction_mode,
                                       ui.Label(text="Channel"),
                                       self.lcr_open_correction_channel,
                                       ui.Spacer())),
                       ui.GroupBox(title="Options",
                                   layout=ui.Column(
                                       ui.Label(text="Integration Time"),
                                       self.lcr_integration_time,
                                       ui.Label(text="Averaging Rate"),
                                       self.lcr_averaging_rate,
                                       self.lcr_auto_level_control,
                                       self.lcr_soft_filter, ui.Spacer())),
                       ui.Spacer(),
                       stretch=(1, 1, 1))))

        def handler(state):
            if 'lcr_voltage' in state:
                value = state.get('lcr_voltage')
                self.status_lcr_voltage.value = format_metric(value, "V")
            if 'lcr_current' in state:
                value = state.get('lcr_current')
                self.status_lcr_current.value = format_metric(value, "A")
            if 'lcr_output' in state:
                value = state.get('lcr_output')
                self.status_lcr_output.value = format_switch(value,
                                                             default=NO_VALUE)

        self.state_handlers.append(handler)
示例#25
0
    def __init__(self, message_changed=None, progress_changed=None, **kwargs):
        super().__init__()
        # Callbacks
        self.message_changed = message_changed
        self.progress_changed = progress_changed
        # Layout
        self.temporary_z_limit_label = ui.Label(
            text="Temporary Probecard Z-Limit applied. "
            "Revert after finishing current measurements.",
            stylesheet=
            "QLabel{color: black; background-color: yellow; padding: 4px; border-radius: 4px;}",
            visible=False)
        self.sequence_widget = SequenceWidget(
            tree_selected=self.on_tree_selected,
            tree_double_clicked=self.on_tree_double_clicked,
            start_all=self.on_start_all,
            start=self.on_start,
            stop=self.on_stop,
            reset_sequence_state=self.on_reset_sequence_state,
            edit_sequence=self.on_edit_sequence)
        self.sequence_tree = self.sequence_widget._sequence_tree
        self.start_sample_action = self.sequence_widget._start_sample_action
        self.start_contact_action = self.sequence_widget._start_contact_action
        self.start_measurement_action = self.sequence_widget._start_measurement_action

        # Environment Controls

        self.environment_control_widget = EnvironmentControlWidget(
            toggled=self.on_environment_groupbox_toggled,
            laser_sensor_toggled=self.on_laser_sensor_toggled,
            box_light_toggled=self.on_box_light_toggled,
            microscope_light_toggled=self.on_microscope_light_toggled,
            microscope_camera_toggled=self.on_microscope_camera_toggled,
            microscope_control_toggled=self.on_microscope_control_toggled,
            probecard_light_toggled=self.on_probecard_light_toggled,
            probecard_camera_toggled=self.on_probecard_camera_toggled,
            pid_control_toggled=self.on_pid_control_toggled)

        # Table controls

        self.table_control_widget = TableControlWidget(
            toggled=self.on_table_groupbox_toggled,
            joystick_toggled=self.on_table_joystick_toggled,
            control_clicked=self.on_table_control_clicked)

        # Operator

        self.operator_widget = OperatorWidget()
        self.operator_widget.load_settings()
        self.operator_groupbox = ui.GroupBox(title="Operator",
                                             layout=self.operator_widget)

        # Working directory

        self.output_widget = WorkingDirectoryWidget()

        self.output_groupbox = ui.GroupBox(title="Working Directory",
                                           layout=self.output_widget)

        # Controls

        self.control_widget = ui.Column(self.sequence_widget,
                                        self.table_control_widget,
                                        self.environment_control_widget,
                                        ui.Row(self.operator_groupbox,
                                               self.output_groupbox,
                                               stretch=(3, 7)),
                                        stretch=(1, 0, 0))

        # Tabs

        self.measurement_tab = MeasurementTab(restore=self.on_measure_restore)
        self.environment_tab = EnvironmentTab()
        self.status_tab = StatusTab(reload=self.on_status_start)
        self.summary_tab = SummaryTab()

        self.panels = self.measurement_tab.panels
        self.panels.sample_changed = self.on_sample_changed

        self.log_widget = LogWidget()
        self.log_widget.add_logger(logging.getLogger())

        self.logging_tab = ui.Tab(title="Logs", layout=self.log_widget)

        # Tabs

        self.tab_widget = ui.Tabs(self.measurement_tab, self.environment_tab,
                                  self.status_tab, self.logging_tab,
                                  self.summary_tab)

        # Layout

        self.splitter = ui.Splitter()
        self.splitter.append(self.control_widget)
        self.splitter.append(self.tab_widget)
        self.splitter.stretch = 4, 9
        self.splitter.collapsible = False

        self.append(self.temporary_z_limit_label)
        self.append(self.splitter)
        self.stretch = 0, 1

        # Setup process callbacks

        self.environ_process = self.processes.get("environ")
        self.environ_process.pc_data_updated = self.on_pc_data_updated

        self.status_process = self.processes.get("status")
        self.status_process.finished = self.on_status_finished

        self.table_process = self.processes.get("table")
        self.table_process.joystick_changed = self.on_table_joystick_changed
        self.table_process.position_changed = self.on_table_position_changed
        self.table_process.caldone_changed = self.on_table_calibration_changed

        self.measure_process = self.processes.get("measure")
        self.measure_process.finished = self.on_finished
        self.measure_process.measurement_state = self.on_measurement_state
        self.measure_process.measurement_reset = self.on_measurement_reset
        self.measure_process.save_to_image = self.on_save_to_image

        self.contact_quality_process = self.processes.get("contact_quality")

        # Experimental

        # Install timer to update environment controls
        self.environment_timer = Timer(timeout=self.sync_environment_controls)
        self.environment_timer.start(self.environment_poll_interval)

        self.close_event = self.on_stop
示例#26
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.title = "CV Ramp (V Source)"

        self.register_hvsource()
        self.register_lcr()
        self.register_environment()

        self.plot = ui.Plot(height=300, legend="right")
        self.plot.add_axis("x", align="bottom", text="Voltage [V] (abs)")
        self.plot.add_axis("y", align="right", text="Capacitance [pF]")
        self.plot.add_series("lcr", "x", "y", text="LCR Cp", color="blue")
        self.data_tabs.insert(0, ui.Tab(title="CV Curve", layout=self.plot))

        self.plot2 = ui.Plot(height=300, legend="right")
        self.plot2.add_axis("x", align="bottom", text="Voltage [V] (abs)")
        self.plot2.add_axis("y", align="right", text="1/Capacitance² [1/F²]")
        self.plot2.axes.get("y").qt.setLabelFormat("%G")
        self.plot2.add_series("lcr2", "x", "y", text="LCR Cp", color="blue")
        self.data_tabs.insert(1, ui.Tab(title="1/C² Curve", layout=self.plot2))

        self.voltage_start = ui.Number(decimals=3, suffix="V")
        self.voltage_stop = ui.Number(decimals=3, suffix="V")
        self.voltage_step = ui.Number(minimum=0,
                                      maximum=200,
                                      decimals=3,
                                      suffix="V")
        self.waiting_time = ui.Number(minimum=0, decimals=2, suffix="s")

        self.vsrc_current_compliance = ui.Number(decimals=3, suffix="uA")

        self.lcr_frequency = ui.Number(value=1,
                                       minimum=0.020,
                                       maximum=20e3,
                                       decimals=3,
                                       suffix="kHz")
        self.lcr_amplitude = ui.Number(minimum=0, decimals=3, suffix="mV")

        self.bind("bias_voltage_start", self.voltage_start, 0, unit="V")
        self.bind("bias_voltage_stop", self.voltage_stop, 100, unit="V")
        self.bind("bias_voltage_step", self.voltage_step, 1, unit="V")
        self.bind("waiting_time", self.waiting_time, 1, unit="s")
        self.bind("vsrc_current_compliance",
                  self.vsrc_current_compliance,
                  0,
                  unit="uA")
        self.bind("lcr_frequency", self.lcr_frequency, 1.0, unit="kHz")
        self.bind("lcr_amplitude", self.lcr_amplitude, 250, unit="mV")

        self.general_tab.layout = ui.Row(
            ui.GroupBox(title="V Source Ramp",
                        layout=ui.Column(ui.Label(text="Start"),
                                         self.voltage_start,
                                         ui.Label(text="Stop"),
                                         self.voltage_stop,
                                         ui.Label(text="Step"),
                                         self.voltage_step,
                                         ui.Label(text="Waiting Time"),
                                         self.waiting_time, ui.Spacer())),
            ui.GroupBox(title="V Source",
                        layout=ui.Column(ui.Label(text="Compliance"),
                                         self.vsrc_current_compliance,
                                         ui.Spacer())),
            ui.GroupBox(title="LCR",
                        layout=ui.Column(ui.Label(text="AC Frequency"),
                                         self.lcr_frequency,
                                         ui.Label(text="AC Amplitude"),
                                         self.lcr_amplitude, ui.Spacer())),
            stretch=(1, 1, 1))

        fahrad = comet.ureg('F')
        volt = comet.ureg('V')

        self.series_transform['lcr'] = lambda x, y: ((x * volt).to('V').m,
                                                     (y * fahrad).to('pF').m)
示例#27
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.title = "IV Ramp Bias Elm"

        self.register_vsource()
        self.register_hvsource()
        self.register_electrometer()
        self.register_environment()

        self.plot = ui.Plot(height=300, legend="right")
        self.plot.add_axis("x", align="bottom", text="Voltage [V]")
        self.plot.add_axis("y", align="right", text="Current [uA]")
        self.plot.add_series("elm",
                             "x",
                             "y",
                             text="Electrometer",
                             color="blue")
        self.plot.add_series("xfit", "x", "y", text="Fit", color="magenta")
        self.data_tabs.insert(0, ui.Tab(title="IV Curve", layout=self.plot))

        self.voltage_start = ui.Number(decimals=3, suffix="V")
        self.voltage_stop = ui.Number(decimals=3, suffix="V")
        self.voltage_step = ui.Number(minimum=0,
                                      maximum=200,
                                      decimals=3,
                                      suffix="V")
        self.waiting_time = ui.Number(minimum=0, decimals=2, suffix="s")
        self.bias_voltage = ui.Number(decimals=3, suffix="V")
        self.bias_mode = ui.ComboBox(["constant", "offset"])

        self.hvsrc_current_compliance = ui.Number(decimals=3, suffix="uA")
        self.hvsrc_accept_compliance = ui.CheckBox("Accept Compliance")
        self.vsrc_current_compliance = ui.Number(decimals=3, suffix="uA")
        self.vsrc_accept_compliance = ui.CheckBox("Accept Compliance")

        self.bind("voltage_start", self.voltage_start, 0, unit="V")
        self.bind("voltage_stop", self.voltage_stop, 0, unit="V")
        self.bind("voltage_step", self.voltage_step, 0, unit="V")
        self.bind("waiting_time", self.waiting_time, 1, unit="s")
        self.bind("bias_voltage", self.bias_voltage, 0, unit="V")
        self.bind("bias_mode", self.bias_mode, "constant")
        self.bind("hvsrc_current_compliance",
                  self.hvsrc_current_compliance,
                  0,
                  unit="uA")
        self.bind("hvsrc_accept_compliance", self.hvsrc_accept_compliance,
                  False)
        self.bind("vsrc_current_compliance",
                  self.vsrc_current_compliance,
                  0,
                  unit="uA")
        self.bind("vsrc_accept_compliance", self.vsrc_accept_compliance, False)

        self.general_tab.layout = ui.Row(
            ui.GroupBox(title="HV Source Ramp",
                        layout=ui.Column(ui.Label(text="Start"),
                                         self.voltage_start,
                                         ui.Label(text="Stop"),
                                         self.voltage_stop,
                                         ui.Label(text="Step"),
                                         self.voltage_step,
                                         ui.Label(text="Waiting Time"),
                                         self.waiting_time, ui.Spacer())),
            ui.GroupBox(title="V Source Bias",
                        layout=ui.Column(ui.Label(text="Bias Voltage"),
                                         self.bias_voltage,
                                         ui.Label(text="Bias Compliance"),
                                         self.vsrc_current_compliance,
                                         self.vsrc_accept_compliance,
                                         ui.Label(text="Bias Mode"),
                                         self.bias_mode, ui.Spacer())),
            ui.GroupBox(title="HV Source",
                        layout=ui.Column(ui.Label(text="Compliance"),
                                         self.hvsrc_current_compliance,
                                         self.hvsrc_accept_compliance,
                                         ui.Spacer())),
            stretch=(1, 1, 1))

        ampere = comet.ureg('A')
        volt = comet.ureg('V')

        self.series_transform['elm'] = lambda x, y: ((x * volt).to('V').m,
                                                     (y * ampere).to('uA').m)
        self.series_transform['xfit'] = self.series_transform.get('elm')
示例#28
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.title = "Frequency Scan"

        self.register_vsource()
        self.register_lcr()
        self.register_environment()

        self.plot = ui.Plot(height=300, legend="right")
        self.plot.add_axis("x", align="bottom", text="Voltage [V] (abs)")
        self.plot.add_axis("y", align="right", text="Capacitance [pF]")
        self.plot.add_series("lcr", "x", "y", text="LCR", color="blue")
        self.data_tabs.insert(0, ui.Tab(title="CV Curve", layout=self.plot))

        self.bias_voltage = ui.Number(decimals=3, suffix="V")

        self.hvsrc_current_compliance = ui.Number(decimals=3, suffix="uA")

        self.lcr_frequency_start = ui.Number(minimum=0,
                                             decimals=3,
                                             suffix="Hz")
        self.lcr_frequency_stop = ui.Number(minimum=0,
                                            decimals=3,
                                            suffix="MHz")
        self.lcr_frequency_steps = ui.Number(minimum=1,
                                             maximum=1000,
                                             decimals=0)
        self.lcr_amplitude = ui.Number(minimum=0, decimals=3, suffix="mV")

        self.bind("bias_voltage", self.bias_voltage, 0, unit="V")
        self.bind("hvsrc_current_compliance",
                  self.hvsrc_current_compliance,
                  0,
                  unit="uA")
        self.bind("lcr_frequency_start",
                  self.lcr_frequency_start,
                  0,
                  unit="Hz")
        self.bind("lcr_frequency_stop", self.lcr_frequency_stop, 0, unit="MHz")
        self.bind("lcr_frequency_steps", self.lcr_frequency_steps, 1)
        self.bind("lcr_amplitude", self.lcr_amplitude, 0, unit="mV")

        self.general_tab.layout = ui.Row(
            ui.GroupBox(title="HV Source",
                        layout=ui.Column(ui.Label(text="Bias Voltage"),
                                         self.bias_voltage,
                                         ui.Label(text="Current Compliance"),
                                         self.hvsrc_current_compliance,
                                         ui.Spacer())),
            ui.GroupBox(title="LCR",
                        layout=ui.Column(
                            ui.Label(text="AC Frequency Start"),
                            self.lcr_frequency_start,
                            ui.Label(text="AC Frequency Stop"),
                            self.lcr_frequency_stop,
                            ui.Label(text="AC Frequency Steps (log10)"),
                            self.lcr_frequency_steps,
                            ui.Label(text="AC Amplitude"), self.lcr_amplitude,
                            ui.Spacer())),
            ui.Spacer(),
            stretch=(1, 1, 1))

        fahrad = comet.ureg('F')
        volt = comet.ureg('V')

        self.series_transform['lcr'] = lambda x, y: ((x * volt).to('V').m,
                                                     (y * fahrad).to('pF').m)
        self.series_transform['xfit'] = self.series_transform.get('lcr')
示例#29
0
def main():
    app = comet.Application()
    app.title = "UI Demo"

    values = ["Chapman", "Cleese", "Gilliam", "Idle", "Jones", "Palin"]

    tab1 = ui.Tab(title="Tab 1",
                  layout=ui.Column(
                      ui.Row(ui.Column(
                          ui.GroupBox(title="Numbers",
                                      layout=ui.Column(
                                          ui.Label(text="Number 1"),
                                          ui.Number(value=1,
                                                    minimum=0,
                                                    maximum=10,
                                                    step=1,
                                                    prefix="#"),
                                          ui.Label(text="Number 2"),
                                          ui.Number(value=2.345,
                                                    minimum=0,
                                                    maximum=10,
                                                    step=.1,
                                                    decimals=3,
                                                    suffix="mV"),
                                          ui.Label(text="Number 3"),
                                          ui.Number(value=1.23,
                                                    minimum=0,
                                                    maximum=10,
                                                    decimals=2,
                                                    suffix="mA",
                                                    readonly=True),
                                          ui.Label(text="Number 4"),
                                          ui.Number(value=4.2,
                                                    minimum=0,
                                                    maximum=10,
                                                    decimals=1,
                                                    suffix="dB",
                                                    enabled=False)))),
                             ui.Column(
                                 ui.GroupBox(title="Text",
                                             layout=ui.Column(
                                                 ui.Label(text="Text 1"),
                                                 ui.Text(value="Chapman"),
                                                 ui.Label(text="Text 2"),
                                                 ui.Text(value="Cleese",
                                                         clearable=True),
                                                 ui.Label(text="Text 3"),
                                                 ui.Text(value="Idle",
                                                         readonly=True),
                                                 ui.Label(text="Text 4"),
                                                 ui.Text(value="Palin",
                                                         enabled=False)))),
                             ui.Spacer(),
                             stretch=(2, 2, 3)),
                      ui.Spacer(),
                      stretch=(0, 1)))

    def on_append():
        list1.append(f"Spam {len(list1)}")
        list1.current = list1[0]

    def on_remove():
        if list1.current is not None:
            list1.remove(list1.current)

    list1 = ui.List()
    tab2 = ui.Tab(title="Tab 2",
                  layout=ui.Column(ui.Row(
                      ui.GroupBox(title="List 1",
                                  layout=ui.Column(
                                      list1,
                                      ui.Button(text="&Add",
                                                clicked=on_append),
                                      ui.Button(text="&Remove",
                                                clicked=on_remove))),
                      ui.GroupBox(title="List 2", layout=ui.List(values)),
                      ui.GroupBox(title="List 3",
                                  layout=ui.List(values, enabled=False))),
                                   ui.Spacer(),
                                   stretch=(0, 1)))

    table1 = ui.Table(header=["Key", "Value"])
    tab3 = ui.Tab(title="Tab 3", layout=ui.Column(table1))

    tree1 = ui.Tree(header=["Key", "Value"])
    tab4 = ui.Tab(title="Tab 4", layout=ui.Column(tree1))

    first = ui.Button(text="Click")
    scroll = ui.ScrollArea(layout=ui.Column(*[
        ui.CheckBox(text=f"Option {i+1}", checked=random.choice([True, False]))
        for i in range(64)
    ]))
    second = ui.Column(scroll)
    tab5 = ui.Tab(title="Tab 5", layout=first)
    tab5.layout = second
    del first

    tab6 = ui.Tab(title="Tab 6",
                  layout=ui.Row(ui.Column(
                      ui.Label("Metric 1"),
                      ui.Metric('V',
                                decimals=3,
                                changed=lambda value: print(value)),
                      ui.Label("Metric 2"),
                      ui.Metric('A',
                                prefixes='munp',
                                changed=lambda value: print(value)),
                      ui.Spacer()),
                                ui.Spacer(),
                                stretch=(1, 2)))

    def on_changed(value):
        app.message = value

    def on_click():
        app.message = combobox1.current

    tabs = ui.Tabs(tab1, tab2, tab3, tab4, tab5, tab6)
    combobox1 = ui.ComboBox(values)

    app.layout = ui.Row(ui.Column(
        ui.GroupBox(title="GroupBox 1",
                    layout=ui.Column(
                        ui.Button(text="Button 1", clicked=on_click),
                        ui.Button(text="Button 2", enabled=False),
                        ui.Button(text="Button 3", checkable=True),
                        ui.Button(text="Button 4",
                                  checkable=True,
                                  enabled=False),
                        ui.Button(text="Button 5",
                                  checkable=True,
                                  checked=True))),
        ui.GroupBox(title="GroupBox 2",
                    layout=ui.Column(
                        ui.CheckBox(text="CheckBox 1"),
                        ui.CheckBox(text="CheckBox 2", enabled=False),
                        ui.CheckBox(text="CheckBox 3",
                                    checked=True,
                                    enabled=False),
                        ui.CheckBox(text="CheckBox 4", checked=True))),
        ui.GroupBox(title="GroupBox 3",
                    layout=ui.Column(
                        ui.ComboBox(), combobox1,
                        ui.ComboBox(values,
                                    current="Cleese",
                                    changed=on_changed),
                        ui.ComboBox(values, current="Idle", enabled=False))),
        ui.Spacer()),
                        tabs,
                        stretch=(2, 7))

    # Populate table
    spam = table1.append(["Spam", 42])
    spam[0].checked = True
    #spam[0].enabled = False
    ham = table1.append(["Ham", 41])
    ham[0].checked = True
    #ham[0].enabled = False

    # Populate tree
    spam = tree1.append(["Spam", 42])
    spam[0].checked = True
    spam.append(["Ham", 41])
    spam.append(["Eggs", 40])

    # Add an remove tab
    tab = ui.Tab()
    tabs.insert(0, tab)
    tab.title = "Spam"
    tabs.remove(tab)

    app.message = "Notification message..."
    app.progress = 3, 4

    return app.run()