Skip to content

Commit 3647f32

Browse files
updated 2400 IV backend and ran autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables
1 parent 52d6e81 commit 3647f32

24 files changed

Lines changed: 95 additions & 205 deletions

Delta_mode_Keithley_6221_2182/Delta_RT_K6221_K2182_L350_Sensing_GUI_v5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ def _on_closing(self):
946946

947947
def main():
948948
root = tk.Tk()
949-
app = MeasurementAppGUI(root)
949+
MeasurementAppGUI(root)
950950
root.mainloop()
951951

952952

Delta_mode_Keithley_6221_2182/Delta_RT_K6221_K2182_L350_T_Control_GUI_v5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ def _on_closing(self):
10111011

10121012
def main():
10131013
root = tk.Tk()
1014-
app = Advanced_Delta_GUI(root)
1014+
Advanced_Delta_GUI(root)
10151015
root.mainloop()
10161016

10171017

Delta_mode_Keithley_6221_2182/IV_K6221_DC_Sweep_GUI_V10.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,17 @@
77
# -------------------------------------------------------------------------------
88

99
import tkinter as tk
10-
from tkinter import ttk, Label, Entry, LabelFrame, filedialog, messagebox, scrolledtext, Canvas
10+
from tkinter import ttk, Label, Entry, LabelFrame, scrolledtext
1111
import numpy as np
1212
import os
1313
import sys
1414
import time
15-
import traceback
16-
from datetime import datetime
17-
import csv
1815
from matplotlib.figure import Figure
1916
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
20-
import matplotlib.gridspec as gridspec
21-
import matplotlib as mpl
2217
import threading
2318
import queue
2419

2520
try:
26-
from PIL import Image, ImageTk
2721
PIL_AVAILABLE = True
2822
except ImportError:
2923
PIL_AVAILABLE = False

Keithley_2400/Backends/IV_K2400_Loop_Backend_v10.py

Lines changed: 66 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -42,165 +42,76 @@
4242
# Changes_done:Working
4343
# ------------------------------------------------------------------------
4444

45-
import pymeasure
4645
import numpy as np
4746
import matplotlib.pyplot as plt
4847
from time import sleep
4948
# import pyvisa
5049
from pymeasure.instruments.keithley import Keithley2400
5150
import pandas as pd
5251

53-
# object creation ----------------------------------
54-
# rm1 = pyvisa.ResourceManager()
55-
# keithley_2182= rm1.open_resource("GPIB::7")
56-
# keithley_2182.write("*rst; status:preset; *cls")
57-
keithley_2400 = Keithley2400("GPIB::4")
58-
keithley_2400.disable_buffer()
59-
60-
sleep(10)
61-
62-
I = []
63-
# I1=[]
64-
Volt = []
65-
# interval = 1
66-
# number_of_readings = 2
67-
68-
i = 0
69-
# user input ----------------------------------
70-
I_range = float(input(
71-
"Enter value of I: (in micro A , Highest value of Current fror -I to I) "))
72-
I_step = float(input("Enter steps: (The step size , in micro A) "))
73-
filename = input("Enter filename:")
74-
75-
76-
print("Current (A) || Voltage(V) ")
77-
78-
keithley_2400.apply_current() # Sets up to source current
79-
# Sets the source current range to 1 mA
80-
keithley_2400.source_current_range = 1e-6
81-
keithley_2400.compliance_voltage = 210 # Sets the compliance voltage to 210 V
82-
keithley_2400.source_current = 0 # Sets the source current to 0 mA
83-
keithley_2400.enable_source() # Enables the source output
84-
keithley_2400.measure_voltage()
85-
'''
86-
87-
88-
#initial set up keithley_2400
89-
keithley_2400.apply_current() # Sets up to source current
90-
keithley_2400.source_current_range = 1e-3 # Sets the source current range to 1 mA
91-
sleep(10)
92-
keithley_2400.compliance_voltage = 210 # Sets the compliance voltage to 210 V
93-
keithley_2400.source_current = 0 # Sets the source current to 0 mA
94-
keithley_2400.enable_source() # Enables the source output
95-
sleep(15)
96-
keithley_2400.measure_voltage()
97-
sleep(1)
98-
# current loop voltage measured ------------------------------
99-
100-
'''
101-
102-
103-
def IV_Measure(cur):
104-
105-
keithley_2400.ramp_to_current(cur * 1e-6)
106-
107-
sleep(1.5)
108-
v_meas = keithley_2400.voltage
109-
sleep(1)
110-
# I.append(keithley_2400.current) # actual current in 2400 (in Amps)
111-
I.append(cur * 1e-3)
112-
113-
Volt.append(v_meas) # voltage
114-
115-
print(str(cur * 1e-6) + " " + str(Volt[i]))
116-
117-
'''
118-
keithley_2182.write("status:measurement:enable 512; *sre 1")
119-
keithley_2182.write("sample:count %d" % number_of_readings)
120-
keithley_2182.write("trigger:source bus")
121-
keithley_2182.write("trigger:delay %f" % (interval))
122-
keithley_2182.write("trace:points %d" % number_of_readings)
123-
keithley_2182.write("trace:feed sense1; feed:control next")
124-
keithley_2182.write("initiate")
125-
keithley_2182.assert_trigger()
126-
sleep(1)
127-
keithley_2182.wait_for_srq()
128-
sleep(1)
129-
voltages = keithley_2182.query_ascii_values("trace:data?")
130-
keithley_2182.query("status:measurement?")
131-
keithley_2182.write("trace:clear; feed:control next")
132-
133-
v_avr=sum(voltages) / len(voltages)
134-
135-
sleep(1)
136-
#I.append(keithley_2400.current) # actual current in 2400 (in Amps)
137-
I.append(cur*1e-3)
138-
Volt.append(v_avr) #voltage avg list
139-
print(str(cur*1e-3)+" "+str(v_avr))
140-
keithley_2182.write("*rst; status:preset; *cls")
141-
142-
keithley_2182.clear()
143-
144-
'''
145-
sleep(1)
146-
147-
148-
# loop1---------------------------------------------
149-
print("In loop 1")
150-
for i1 in np.arange(0, I_range + I_step, I_step):
151-
IV_Measure(i1)
152-
i = i + 1
153-
# --------------------------------------------------
154-
155-
'''
156-
#loop2---------------------------------------------
157-
print("In loop 2")
158-
for i2 in np.arange(I_range,0-I_step,-I_step):
159-
IV_Measure(i2)
160-
#--------------------------------------------------
161-
#loop3---------------------------------------------
162-
print("In loop 3")
163-
for i3 in np.arange(0,-I_range-I_step,-I_step):
164-
IV_Measure(i3)
165-
#--------------------------------------------------
166-
#loop4---------------------------------------------
167-
print("In loop 4")
168-
for i4 in np.arange(-I_range,0+I_step,I_step):
169-
IV_Measure(i4)
170-
#--------------------------------------------------
171-
#loop5---------------------------------------------
172-
print("In loop 5")
173-
for i5 in np.arange(0,I_range+I_step,I_step):
174-
IV_Measure(i5)
175-
#--------------------------------------------------
176-
'''
177-
# data saving in file ----------------------------
178-
179-
df = pd.DataFrame()
180-
df['I'] = pd.DataFrame(I)
181-
df['V'] = pd.DataFrame(Volt)
182-
print("Current (A) || Voltage(V) \n")
183-
184-
print(df)
185-
186-
# df.to_csv(r'E:\Prathamesh\Python Stuff\IV Only 2400\'str(filename)+str(filename)'+'.txt', index=None, sep=' ', mode='w')
187-
df.to_csv(r'C:/Users/Instrument-DSL/Desktop/LED_IV/' +
188-
str(filename) + '.txt', index=None, sep=' ', mode='w')
189-
190-
191-
# turning of instrument ----------------------------
192-
sleep(0.5)
193-
keithley_2400.shutdown()
194-
print("keithley_2400.shutdown")
195-
sleep(0.5) # Ramps the current to 0 mA and disables output
196-
# keithley_2182.clear()
197-
# keithley_2182.close()
198-
199-
# graph ploting ----------------------------
200-
201-
plt.plot(I, Volt, marker='o', linestyle='-', color='g', label='Square')
202-
plt.xlabel('I')
203-
plt.ylabel('V')
204-
plt.title('IV curve')
205-
plt.legend('I')
206-
plt.show()
52+
53+
def main():
54+
"""
55+
Main function to run the I-V sweep measurement.
56+
"""
57+
# object creation ----------------------------------
58+
keithley_2400 = Keithley2400("GPIB::4")
59+
keithley_2400.disable_buffer()
60+
sleep(2)
61+
62+
i = 0
63+
I = []
64+
Volt = []
65+
66+
# user input ----------------------------------
67+
I_range = float(input("Enter value of I: (in micro A, Highest value of Current from -I to I) "))
68+
I_step = float(input("Enter steps: (The step size, in micro A) "))
69+
filename = input("Enter filename:")
70+
71+
print("Current (A) || Voltage(V) ")
72+
73+
keithley_2400.apply_current()
74+
keithley_2400.source_current_range = 1e-6
75+
keithley_2400.compliance_voltage = 210
76+
keithley_2400.source_current = 0
77+
keithley_2400.enable_source()
78+
keithley_2400.measure_voltage()
79+
80+
def IV_Measure(cur):
81+
nonlocal i
82+
keithley_2400.ramp_to_current(cur * 1e-6)
83+
sleep(1.5)
84+
v_meas = keithley_2400.voltage
85+
sleep(1)
86+
I.append(cur * 1e-6) # Use the actual sourced value
87+
Volt.append(v_meas)
88+
print(f"{cur * 1e-6:.3e} A {v_meas:.4f} V")
89+
i += 1
90+
91+
print("In loop 1")
92+
for i1 in np.arange(0, I_range + I_step, I_step):
93+
IV_Measure(i1)
94+
95+
df = pd.DataFrame({'I': I, 'V': Volt})
96+
print("\n--- Measurement Complete ---")
97+
print(df)
98+
99+
save_path = os.path.join('C:/Users/Instrument-DSL/Desktop/LED_IV/', f"{filename}.txt")
100+
df.to_csv(save_path, index=None, sep='\t', mode='w')
101+
print(f"Data saved to {save_path}")
102+
103+
sleep(0.5)
104+
keithley_2400.shutdown()
105+
print("Keithley 2400 shutdown complete.")
106+
107+
plt.plot(I, Volt, marker='o', linestyle='-', color='g', label='I-V Data')
108+
plt.xlabel('Current (A)')
109+
plt.ylabel('Voltage (V)')
110+
plt.title('I-V Curve')
111+
plt.legend()
112+
plt.grid(True)
113+
plt.show()
114+
115+
116+
if __name__ == "__main__":
117+
main()

Keithley_2400/IV_K2400_GUI_v5.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# --- Packages for Front end ---
1111
import tkinter as tk
12-
from tkinter import ttk, Label, Entry, LabelFrame, Button, filedialog, messagebox, scrolledtext, Canvas
12+
from tkinter import ttk, Label, Entry, LabelFrame, filedialog, messagebox, scrolledtext, Canvas
1313
import numpy as np
1414
import csv
1515
import os
@@ -893,7 +893,7 @@ def _on_closing(self):
893893

894894
def main():
895895
root = tk.Tk()
896-
app = MeasurementAppGUI(root)
896+
MeasurementAppGUI(root)
897897
root.mainloop()
898898

899899

Keithley_2400_Keithley_2182/RT_K2400_K2182_T_Control_GUI_v3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# --- GUI and Plotting Packages ---
1111
import tkinter as tk
1212
from tkinter import ttk, filedialog, messagebox, scrolledtext, Canvas
13-
import sys
1413
import os
1514
import time
1615
import traceback

Keithley_6517B/High_Resistance/IV_K6517B_GUI_v11.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# --- Packages for Front end ---
1212
import tkinter as tk
13-
from tkinter import ttk, Label, Entry, LabelFrame, Button, filedialog, messagebox, scrolledtext, Canvas
13+
from tkinter import ttk, Label, Entry, LabelFrame, filedialog, messagebox, scrolledtext, Canvas
1414
import threading
1515
import queue
1616
import numpy as np
@@ -959,7 +959,7 @@ def _on_closing(self):
959959

960960
def main():
961961
root = tk.Tk()
962-
app = HighResistanceIV_GUI(root)
962+
HighResistanceIV_GUI(root)
963963
root.mainloop()
964964

965965

Keithley_6517B/High_Resistance/RT_K6517B_L350_T_Control_GUI_v13.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# --- Packages for Front end ---
1212
import tkinter as tk
13-
from tkinter import ttk, Label, Entry, LabelFrame, Button, filedialog, messagebox, scrolledtext, Canvas
13+
from tkinter import ttk, Label, Entry, LabelFrame, filedialog, messagebox, scrolledtext, Canvas
1414
import threading
1515
import queue
1616
import os
@@ -1028,7 +1028,7 @@ def _on_closing(self):
10281028

10291029
def main():
10301030
root = tk.Tk()
1031-
app = Integrated_RT_GUI(root)
1031+
Integrated_RT_GUI(root)
10321032
root.mainloop()
10331033

10341034

Keithley_6517B/High_Resistance/RT_K6517B_L350_T_Sensing_GUI_v14.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# --- Packages for Front end ---
1313
import tkinter as tk
14-
from tkinter import ttk, Label, Entry, LabelFrame, Button, filedialog, messagebox, scrolledtext, Canvas
14+
from tkinter import ttk, Label, Entry, LabelFrame, filedialog, messagebox, scrolledtext, Canvas
1515
import threading
1616
import queue
1717
import os
@@ -967,7 +967,7 @@ def _on_closing(self):
967967

968968
def main():
969969
root = tk.Tk()
970-
app = Integrated_RT_GUI(root)
970+
Integrated_RT_GUI(root)
971971
root.mainloop()
972972

973973

Keithley_6517B/Pyroelectricity/Backends/Current_K6517B_Simple_Backend_v10.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
# -------------------------------------------------------------------------------
66

77
import time
8-
import numpy as np
98
import pandas as pd
10-
import pyvisa
119
from pymeasure.instruments.keithley import Keithley6517B
1210

1311
I = []

0 commit comments

Comments
 (0)