33Purpose: GUI module for Delta RT K6221 K2182 L350 T Control GUI v5.
44"""
55
6- # -------------------------------------------------------------------------------
7- # Name: Advanced Delta Mode R-T Measurement
8- # Purpose: Perform a temperature-dependent Delta mode measurement with a
9- # Keithley 6221/2182 and Lakeshore 350, using an advanced GUI
10- # and temperature control logic.
11- #
12- # Author: Prathamesh K. Deshmukh
13- # Created: 03/10/2025
14- #
15- # Version: 2.1 (JOSS Cleaned)
16- # -------------------------------------------------------------------------------
17-
18- # --- Packages ---
196import tkinter as tk
207from tkinter import ttk , Label , Entry , LabelFrame , messagebox , scrolledtext , Canvas , filedialog
218import os
4633
4734
4835def run_script_process (script_path ):
49- """
50- Wrapper function to execute a script using runpy in its own directory.
51- This becomes the target for the new, isolated process.
52- """
36+
5337 try :
5438 os .chdir (os .path .dirname (script_path ))
5539 runpy .run_path (script_path , run_name = "__main__" )
@@ -60,9 +44,7 @@ def run_script_process(script_path):
6044
6145
6246def launch_plotter_utility ():
63- """Finds and launches the plotter utility script in a new process."""
6447 try :
65- # Assumes the plotter is in a standard location relative to this script
6648 script_dir = os .path .dirname (os .path .abspath (__file__ ))
6749 plotter_path = os .path .join (
6850 script_dir ,
@@ -81,9 +63,7 @@ def launch_plotter_utility():
8163
8264
8365def launch_gpib_scanner ():
84- """Finds and launches the GPIB scanner utility in a new process."""
8566 try :
86- # Assumes the scanner is in a standard location relative to this script
8767 script_dir = os .path .dirname (os .path .abspath (__file__ ))
8868 scanner_path = os .path .join (
8969 script_dir ,
@@ -103,7 +83,6 @@ def launch_gpib_scanner():
10383
10484
10585def resource_path (relative_path ):
106- """ Get absolute path to resource, works for dev and for PyInstaller """
10786 try :
10887 base_path = sys ._MEIPASS
10988 except Exception :
@@ -116,7 +95,6 @@ def resource_path(relative_path):
11695# -------------------------------------------------------------------------------
11796
11897class Active_Delta_Backend :
119- """ Manages both Keithley 6221 and Lakeshore 350 for active measurements. """
12098
12199 def __init__ (self ):
122100 self .keithley = None
@@ -195,7 +173,6 @@ def get_delta_measurement(self):
195173 return voltage
196174
197175 def close_instruments (self ):
198- """ CRITICAL: Turns off heater and closes all connections. """
199176 print ("--- [Backend] Closing instrument connections. ---" )
200177 try :
201178 if self .lakeshore :
@@ -226,7 +203,6 @@ class Advanced_Delta_GUI:
226203 PROGRAM_VERSION = "2.1"
227204 LOGO_SIZE = 110
228205 try :
229- # Robust path finding for assets relative to the script's location
230206 SCRIPT_DIR = os .path .dirname (os .path .abspath (__file__ ))
231207 LOGO_FILE_PATH = os .path .join (
232208 SCRIPT_DIR ,
@@ -878,7 +854,6 @@ def _start_hardware_ramp(self):
878854 self .start_time = time .time ()
879855 self .root .after (1000 , self ._update_measurement_loop )
880856
881- # --- Performance Improvement: Capture static background for blitting ---
882857 self .canvas .draw ()
883858 self .plot_backgrounds = [
884859 self .canvas .copy_from_bbox (
@@ -911,7 +886,6 @@ def _update_measurement_loop(self):
911886 self .data_storage ['voltage' ].append (voltage )
912887 self .data_storage ['resistance' ].append (res )
913888
914- # --- Performance Improvement: Use blitting for fast graph updates if background is captured ---
915889 if self .plot_backgrounds :
916890 # Restore the clean background
917891 self .canvas .restore_region (self .plot_backgrounds [0 ])
@@ -995,8 +969,7 @@ def _process_visa_queue(self):
995969 self .scan_button .config (state = 'normal' )
996970
997971 except queue .Empty :
998- # If the queue is empty, it means the worker is still running.
999- # We schedule another check.
972+
1000973 self .root .after (100 , self ._process_visa_queue )
1001974
1002975 def _browse_file_location (self ):
0 commit comments