-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
49 lines (45 loc) · 1.54 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Imports libraries needed
import serial
import numpy as np
import time
import lakeshore
from lakeshore.generic_instrument import GenericInstrument
import sys
from PyQt5.QtWidgets import (
QApplication, QDialog, QMainWindow, QMessageBox
)
from PyQt5.uic import loadUi
from CompiledGUI import Ui_LakeshoreGUI
from Lakeshore_Class import Lakeshore
from Keithley_Class import Keithley
from GUI_Class import Window
# Function that connects 321 and sets up a class.
def connect():
try:
# From the Model321_Setup.py, initializes my instrument
lakeshore = Lakeshore(comport='COM1', baudrate = 1200)
# From the Model321_Setup.py, identifies the ID number
ID = lakeshore.getID()
# Trims the ID to just be the useful characters
if len(ID) < 4:
# If no Lakeshore is found, raise an error.
raise Exception('Lakeshore device not found. Ensure device is plugged in and powered.')
else:
# If Lakeshore is found, print ID
print("Connected to Lakeshore: " + ID)
except:
raise Exception('Lakeshore device not found. Ensure device is plugged in and powered.')
try:
keithley = Keithley(0.000001)
IDN = str(keithley.getID())
print("Connected to Keithley: " + IDN)
except:
raise Exception('Keithley device not found. Ensure device is plugged in and powered.')
# Function that uses generic code to open and run the GUI
def run():
app = QApplication(sys.argv)
win = Window()
win.show()
sys.exit(app.exec())
connect()
run()