def run(): import sys import argparse from keithley2600 import Keithley2600 parser = argparse.ArgumentParser() parser.add_argument("-v", "--verbose", help="increase output verbosity", action="store_true") args = parser.parse_args() if args.verbose: import keithley2600 keithley2600.log_to_screen() keithley_address = CONF.get('Connection', 'VISA_ADDRESS') visa_library = CONF.get('Connection', 'VISA_LIBRARY') keithley = Keithley2600(keithley_address, visa_library) app = QtWidgets.QApplication(sys.argv) keithley_gui = KeithleyGuiApp(keithley) keithley_gui.show() app.exec_()
def load_defaults(self): self.t_int.setValue(CONF.get("Sweep", "tInt")) self.t_settling.setValue(CONF.get("Sweep", "delay")) self.sweep_type.setCurrentIndex(int(CONF.get("Sweep", "pulsed"))) self.smu_gate.setCurrentText(CONF.get("Sweep", "gate")) self.smu_drain.setCurrentText(CONF.get("Sweep", "drain"))
def restore_geometry(self): x = CONF.get('Window', 'x') y = CONF.get('Window', 'y') w = CONF.get('Window', 'width') h = CONF.get('Window', 'height') self.setGeometry(x, y, w, h)
def restore_geometry(self): x = CONF.get("Window", "x") y = CONF.get("Window", "y") w = CONF.get("Window", "width") h = CONF.get("Window", "height") self.setGeometry(x, y, w, h)
def __init__(self, keithley=None): super().__init__() # load user interface layout from .ui file uic.loadUi(MAIN_UI_PATH, self) if keithley: self.keithley = keithley else: address = CONF.get("Connection", "VISA_ADDRESS") lib = CONF.get("Connection", "VISA_LIBRARY") self.keithley = Keithley2600(address, lib) self.smu_list = _get_smus(self.keithley) self.sweep_data = None # create sweep settings panes self.transfer_sweep_settings = TransferSweepSettingsWidget() self.output_sweep_settings = OutputSweepSettingsWidget() self.iv_sweep_settings = IVSweepSettingsWidget(self.keithley) self.general_sweep_settings = SweepSettingsWidget(self.keithley) self.tabWidgetSweeps.widget(0).layout().addWidget(self.transfer_sweep_settings) self.tabWidgetSweeps.widget(1).layout().addWidget(self.output_sweep_settings) self.tabWidgetSweeps.widget(2).layout().addWidget(self.iv_sweep_settings) self.groupBoxSweepSettings.layout().addWidget(self.general_sweep_settings) # create tabs for smu settings self.smu_tabs = [] for smu_name in self.smu_list: tab = SMUSettingsWidget(smu_name) self.tabWidgetSettings.addTab(tab, smu_name) self.smu_tabs.append(tab) # create plot widget self.canvas = SweepDataPlot() self.gridLayout2.addWidget(self.canvas) # create LED indicator self.led = LedIndicator(self) self.statusBar.addPermanentWidget(self.led) self.led.setChecked(False) # create connection dialog self.connectionDialog = ConnectionDialog(self, self.keithley, CONF) # restore last position and size self.restore_geometry() # update GUI status and connect callbacks self.actionSaveSweepData.setEnabled(False) self.connect_ui_callbacks() self.on_load_default() self.update_gui_connection() # connection update timer: check periodically if keithley is connected self.connection_status_update = QtCore.QTimer() self.connection_status_update.timeout.connect(self.update_gui_connection) self.connection_status_update.start(10000) # 10 sec
def load_defaults(self): if CONF.get(self.smu_name, "sense") == "SENSE_LOCAL": self.sense_type.setCurrentIndex(self.SENSE_LOCAL) elif CONF.get(self.smu_name, "sense") == "SENSE_REMOTE": self.sense_type.setCurrentIndex(self.SENSE_REMOTE) self.limit_i.setValue(CONF.get(self.smu_name, "limiti")) self.limit_v.setValue(CONF.get(self.smu_name, "limitv")) self.high_c.setChecked(CONF.get(self.smu_name, "highc"))
def __init__(self, smu_name): super(self.__class__, self).__init__() self.smu_name = smu_name self.setObjectName('tab_%s' % self.smu_name) self.gridLayouts = QtWidgets.QGridLayout(self) self.gridLayouts.setObjectName('gridLayout') self.labelComboBox = QtWidgets.QLabel(self) self.labelComboBox.setObjectName('labelComboBox') self.labelComboBox.setAlignment(QtCore.Qt.AlignRight) self.labelComboBox.setText('Sense type:') self.gridLayouts.addWidget(self.labelComboBox, 0, 0, 1, 1) self.comboBox = QtWidgets.QComboBox(self) self.comboBox.setObjectName('comboBox') self.comboBox.setMinimumWidth(150) self.comboBox.setMaximumWidth(150) self.comboBox.addItems(['local (2-wire)', 'remote (4-wire)']) if CONF.get(self.smu_name, 'sense') == 'SENSE_LOCAL': self.comboBox.setCurrentIndex(0) elif CONF.get(self.smu_name, 'sense') == 'SENSE_REMOTE': self.comboBox.setCurrentIndex(1) self.gridLayouts.addWidget(self.comboBox, 0, 1, 1, 2) self.labelLimI = QtWidgets.QLabel(self) self.labelLimI.setObjectName('labelLimI') self.labelLimI.setAlignment(QtCore.Qt.AlignRight) self.labelLimI.setText('Current limit:') self.gridLayouts.addWidget(self.labelLimI, 1, 0, 1, 1) self.scienceSpinBoxLimI = ScienDSpinBox(self) self.scienceSpinBoxLimI.setObjectName('scienceSpinBoxLimI') self.scienceSpinBoxLimI.setMinimumWidth(90) self.scienceSpinBoxLimI.setMaximumWidth(90) self.scienceSpinBoxLimI.setAlignment(QtCore.Qt.AlignRight) self.scienceSpinBoxLimI.setValue(CONF.get(self.smu_name, 'limiti')) self.scienceSpinBoxLimI.setSuffix("A") self.gridLayouts.addWidget(self.scienceSpinBoxLimI, 1, 1, 1, 1) self.labelLimV = QtWidgets.QLabel(self) self.labelLimV.setObjectName('labelLimV') self.labelLimV.setAlignment(QtCore.Qt.AlignRight) self.labelLimV.setText('Voltage limit:') self.gridLayouts.addWidget(self.labelLimV, 2, 0, 1, 1) self.scienceSpinBoxLimV = ScienDSpinBox(self) self.scienceSpinBoxLimV.setObjectName('scienceSpinBoxLimV') self.scienceSpinBoxLimV.setMinimumWidth(90) self.scienceSpinBoxLimV.setMaximumWidth(90) self.scienceSpinBoxLimV.setAlignment(QtCore.Qt.AlignRight) self.scienceSpinBoxLimV.setValue(CONF.get(self.smu_name, 'limitv')) self.scienceSpinBoxLimV.setSuffix("V") self.gridLayouts.addWidget(self.scienceSpinBoxLimV, 2, 1, 1, 1)
def load_defaults(self): if self.smu_name != "--": try: sense_mode = CONF.get(self.smu_name, "sense") if sense_mode == "SENSE_LOCAL": self.sense_type.setCurrentIndex(self.SENSE_LOCAL) elif sense_mode == "SENSE_REMOTE": self.sense_type.setCurrentIndex(self.SENSE_REMOTE) self.limit_i.setValue(CONF.get(self.smu_name, "limiti")) self.limit_v.setValue(CONF.get(self.smu_name, "limitv")) self.high_c.setChecked(CONF.get(self.smu_name, "highc")) except cp.NoSectionError: pass
def connect_to_instruments(): """ Tries to connect to Keithley, Mercury and Xepr. Uses the visa addresses saved in the respective configuration files. :returns: Tuple containing instrument instances. :rtype: tuple """ from keithley2600 import Keithley2600 from keithleygui.config.main import CONF as KCONF from mercuryitc import MercuryITC from mercurygui.config.main import CONF as MCONF keithley_address = KCONF.get("Connection", "VISA_ADDRESS") keithley_visa_lib = KCONF.get("Connection", "VISA_LIBRARY") mercury_address = MCONF.get("Connection", "VISA_ADDRESS") mercury_visa_lib = MCONF.get("Connection", "VISA_LIBRARY") try: # Search for the XeprAPI in the following locations, use the first match: # 1) path from environment variable, if given # 2) installed python package # 3) pre-installed version with Xepr sys.path.insert(0, ENVIRON_XEPR_API_PATH) sys.path.insert(-1, BRUKER_XEPR_API_PATH) from XeprAPI import Xepr xepr = Xepr() except ImportError: logging.info("XeprAPI could not be located.") xepr = None except IOError: logging.info("No running Xepr instance could be found.") xepr = None mercury = MercuryITC(mercury_address, mercury_visa_lib, open_timeout=1, timeout=5000) keithley = Keithley2600(keithley_address, keithley_visa_lib, open_timeout=1, timeout=5000) return xepr, mercury, keithley
def load_defaults(self): self.v_start.setValue(CONF.get("Sweep", "VStart")) self.v_stop.setValue(CONF.get("Sweep", "VStop")) self.v_step.setValue(CONF.get("Sweep", "VStep")) self.smu_sweep.setCurrentText(CONF.get("Sweep", "smu_sweep"))
def load_defaults(self): self.vd_start.setValue(CONF.get("Sweep", "VdStart")) self.vd_stop.setValue(CONF.get("Sweep", "VdStop")) self.vd_step.setValue(CONF.get("Sweep", "VdStep")) self.vg_list.setValue(CONF.get("Sweep", "VgList"))
def _on_load_default(self): """Load default settings to interface.""" # Set SMU selection comboBox status cmb_list = list(self.smu_list) # get list of all SMUs # transfer curve settings self.scienDSpinBoxVgStart.setValue(CONF.get('Sweep', 'VgStart')) self.scienDSpinBoxVgStop.setValue(CONF.get('Sweep', 'VgStop')) self.scienDSpinBoxVgStep.setValue(CONF.get('Sweep', 'VgStep')) txt = str(CONF.get('Sweep', 'VdList')).strip('[]') self.lineEditVdList.setText(txt) # output curve settings self.scienDSpinBoxVdStart.setValue(CONF.get('Sweep', 'VdStart')) self.scienDSpinBoxVdStop.setValue(CONF.get('Sweep', 'VdStop')) self.scienDSpinBoxVdStep.setValue(CONF.get('Sweep', 'VdStep')) txt = str(CONF.get('Sweep', 'VgList')).strip('[]') self.lineEditVgList.setText(txt) # iv curve settings self.scienDSpinBoxVStart.setValue(CONF.get('Sweep', 'VStart')) self.scienDSpinBoxVStop.setValue(CONF.get('Sweep', 'VStop')) self.scienDSpinBoxVStep.setValue(CONF.get('Sweep', 'VStep')) try: idx_sweep = cmb_list.index(CONF.get('Sweep', 'smu_sweep')) except ValueError: idx_sweep = 0 msg = 'Could not find last used SMUs in Keithley driver.' QtWidgets.QMessageBox.information(self, str('error'), msg) self.comboBoxGateSMU.setCurrentIndex(idx_sweep) # other self.scienDSpinBoxInt.setValue(CONF.get('Sweep', 'tInt')) self.scienDSpinBoxSettling.setValue(CONF.get('Sweep', 'delay')) # set PULSED comboBox index (0 if pulsed == False, 1 if pulsed == True) pulsed = CONF.get('Sweep', 'pulsed') self.comboBoxSweepType.setCurrentIndex(int(pulsed)) # We have two comboBoxes. If there are less SMU's, extend list. while len(cmb_list) < 2: cmb_list.append('--') self.comboBoxGateSMU.clear() self.comboBoxDrainSMU.clear() self.comboBoxSweepSMU.clear() self.comboBoxGateSMU.addItems(cmb_list) self.comboBoxDrainSMU.addItems(cmb_list) self.comboBoxSweepSMU.addItems(self.smu_list) try: idx_gate = cmb_list.index(CONF.get('Sweep', 'gate')) idx_drain = cmb_list.index(CONF.get('Sweep', 'drain')) self.comboBoxGateSMU.setCurrentIndex(idx_gate) self.comboBoxDrainSMU.setCurrentIndex(idx_drain) except ValueError: self.comboBoxGateSMU.setCurrentIndex(0) self.comboBoxDrainSMU.setCurrentIndex(1) msg = 'Could not find last used SMUs in Keithley driver.' QtWidgets.QMessageBox.information(self, str('error'), msg) for tab in self.smu_tabs: sense = CONF.get(tab.smu_name, 'sense') if sense == 'SENSE_LOCAL': tab.comboBox.setCurrentIndex(0) elif sense == 'SENSE_REMOTE': tab.comboBox.setCurrentIndex(1) tab.scienceSpinBoxLimI.setValue(CONF.get(tab.smu_name, 'limiti')) tab.scienceSpinBoxLimV.setValue(CONF.get(tab.smu_name, 'limitv'))