Ejemplo n.º 1
0
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_()
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
 def __init__(self, config):
     self.volt = Keithley2600(config["tcp_addr"])
     retry = 5
     while retry > 0:
         try:
             self.volt.connect()
             time.sleep(1)
             self.volt.smua.source.limitv  = 5.01
             self.volt.smua.source.rangev = 5
         except:
             retry -= 1
             print("init fail, retry")
             pass
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
 def __init__(self):
     print("Attempting to connect to the  Keithley sourcemeter...")
     try:
         # Opens device:
         self.sm = Keithley2600(
             keithly_string,
             raise_keithley_errors=True,
             visa_library=r'C:\Windows\System32\visa64.dll')
         # Reset both channels for consistancy:
         self.sm.smua.reset()
         self.sm.smub.reset()
         print("Done!")
     except:
         self.sm = None
         print('Could not initilise Keithley sourcemeter! ID given:',
               keithly_string)
     self.voltages = []
     self.currents = []
Ejemplo n.º 6
0
                    type=str,
                    help="Battery capacity, in Ah")
parser.add_argument('current',
                    metavar='I',
                    type=float,
                    help="Current, in amps")
args = parser.parse_args()

instrument_serial = 'USB0::1510::9746::4309410\x00::0::INSTR'
battery_capacity_Ah = float(args.capacity)
upper_voltage = 2.7
lower_voltage = 1.4
discharge_current = args.current
measurements = []

k = Keithley2600(instrument_serial)
k.smua.reset()
k.smua.sense = k.smua.SENSE_REMOTE
k.smua.source.func = k.smua.OUTPUT_DCVOLTS
k.smua.measure.autorangei = k.smua.AUTORANGE_ON
k.smua.measure.nplc = 5
k.smua.source.rangev = 20
k.smua.source.output = k.smua.OUTPUT_OFF
k.smua.source.limiti = 100E-3
k.smua.source.levelv = 2.7

k.smua.source.output = k.smua.OUTPUT_HIGH_Z
input("Connect battery to source meter and press a key to start...")
k.smua.source.output = k.smua.OUTPUT_ON

current = k.smua.measure.i()
Ejemplo n.º 7
0
# sudo chmod 666 /dev/ttyUSB0

import time
import numpy as np
from matplotlib import pyplot as plt
from keithley2600 import Keithley2600, ResultTable

k = Keithley2600('ASRL/dev/ttyUSB0::INSTR')
k.read_termination = '\r\n'
k.write_termination = '\r\n'
# create ResultTable with two columns
rt = ResultTable(column_titles=['Voltage', 'Current'],
                 units=['V', 'A'],
                 params={
                     'recorded': time.asctime(),
                     'sweep_type': 'iv'
                 })

# create live plot which updates as data is added
# rt.plot(live=True)

# measure some currents
for v in np.arange(-20, 1):
    k.applyVoltage(k.smua, v)
    i = k.smua.measure.i()
    rt.append_row([v, i])
k.smua.source.levelv = 0

for v in np.arange(-20, 1)[::-1]:
    k.applyVoltage(k.smua, v)
    i = k.smua.measure.i()