Skip to content

Commit ce761cd

Browse files
major flask8 issue fix 1
1 parent 431a22e commit ce761cd

4 files changed

Lines changed: 34 additions & 81 deletions

File tree

Keithley_6517B/High_Resistance/Backends/IV_K6517B_Simple_Backend_v10.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ def get_sweep_parameters():
4949
delay = float(input("Enter Settling Delay between points (s): "))
5050
filename = input(
5151
"Enter the filename to save data (e.g., SampleA_IV.csv): ")
52-
52+
5353
if not filename.lower().endswith('.csv'):
5454
filename += '.csv'
5555
return start_v, stop_v, steps, delay, filename
5656

57+
5758
def plot_results(data):
5859
"""Plots the I-V curve from the collected data."""
5960
if not data:

Utilities/PlotterUtil_GUI_v3.py

Lines changed: 30 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -954,50 +954,27 @@ def _finalize_plot(self, x_col, y_col, selected_filepaths):
954954
else:
955955
legend_title = "Multiple Files"
956956
leg = self.ax_main.legend(title=legend_title,
957-
labelcolor=self.CLR_CONSOLE_BG)
958-
if leg:
959-
960-
leg.get_title().set_color(self.CLR_CONSOLE_BG)
961-
962-
963-
964-
self.ax_main.set_xscale(
965-
966-
'log' if self.x_log_var.get() else 'linear') # type: ignore
967-
968-
self.ax_main.set_yscale(
969-
970-
'log' if self.y_log_var.get() else 'linear')
971-
972-
self.ax_main.set_xlabel(x_col)
973-
974-
self.ax_main.set_ylabel(y_col)
975-
976-
977-
978-
if len(selected_filepaths) == 1:
979-
980-
self.ax_main.set_title(
981-
982-
os.path.basename(
983-
984-
selected_filepaths[0]),
985-
986-
fontweight='bold')
987-
988-
else:
989-
990-
self.ax_main.set_title(
991-
992-
f"{y_col} vs. {x_col}",
993-
994-
fontweight='bold')
995-
996-
self.figure.tight_layout()
997-
998-
999-
1000-
def _handle_load_error(self, filepath, e):
957+
labelcolor=self.CLR_FG)
958+
if leg:
959+
leg.get_title().set_color(self.CLR_FG)
960+
961+
self.ax_main.set_xscale('log' if self.x_log_var.get() else 'linear') # type: ignore
962+
self.ax_main.set_yscale('log' if self.y_log_var.get() else 'linear')
963+
self.ax_main.set_xlabel(x_col)
964+
self.ax_main.set_ylabel(y_col)
965+
966+
if len(selected_filepaths) == 1:
967+
self.ax_main.set_title(
968+
os.path.basename(
969+
selected_filepaths[0]),
970+
fontweight='bold')
971+
else:
972+
self.ax_main.set_title(
973+
f"{y_col} vs. {x_col}",
974+
fontweight='bold')
975+
self.figure.tight_layout()
976+
977+
def _handle_load_error(self, filepath, e):
1001978

1002979
"""Handles errors during file loading."""
1003980

@@ -1027,15 +1004,15 @@ def _handle_load_error(self, filepath, e):
10271004

10281005
self.log(f"Error loading file: {traceback.format_exc()}")
10291006

1030-
messagebox.showerror(
1007+
messagebox.showerror(
10311008

1032-
"File Load Error",
1009+
"File Load Error",
10331010

1034-
f"Could not read the data file. It may be empty, malformed, or in use.\n\nDetails: {e}")
1011+
f"Could not read the data file. It may be empty, malformed, or in use.\n\nDetails: {e}")
10351012

1036-
1013+
10371014

1038-
def toggle_live_update(self):
1015+
def toggle_live_update(self):
10391016

10401017
if self.live_update_var.get():
10411018

@@ -1045,9 +1022,7 @@ def toggle_live_update(self):
10451022

10461023
self.stop_file_watcher()
10471024

1048-
1049-
1050-
def start_file_watcher(self):
1025+
def start_file_watcher(self):
10511026

10521027
self.stop_file_watcher() # Ensure no multiple watchers are running
10531028

@@ -1056,12 +1031,9 @@ def start_file_watcher(self):
10561031
self.log("Live update enabled. Watching for file changes...")
10571032

10581033
self.file_watcher_job = self.root.after(
1059-
10601034
1000, self.check_for_updates)
1061-
1062-
1063-
1064-
def stop_file_watcher(self):
1035+
1036+
def stop_file_watcher(self):
10651037

10661038
if self.file_watcher_job:
10671039

@@ -1071,9 +1043,7 @@ def stop_file_watcher(self):
10711043

10721044
self.log("Live update disabled.")
10731045

1074-
1075-
1076-
def check_for_updates(self):
1046+
def check_for_updates(self):
10771047

10781048
if not self.active_filepath or not self.live_update_var.get(
10791049

@@ -1135,23 +1105,6 @@ def check_for_updates(self):
11351105

11361106

11371107

1138-
1139-
1140-
if __name__ == '__main__':
1141-
1142-
# This is ESSENTIAL for multiprocessing to work in a bundled executable
1143-
1144-
# and to prevent pickling errors with 'spawn' start method on Windows.
1145-
1146-
multiprocessing.freeze_support()
1147-
1148-
1149-
1150-
root = tk.Tk()
1151-
1152-
app = PlotterApp(root)
1153-
1154-
root.mainloop()
11551108

11561109

11571110
if __name__ == '__main__':

deployment/Picachu.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,6 @@ def _on_mousewheel_linux_macos(event):
532532
row=0, column=1, sticky='new', padx=(
533533
10, 15), pady=(
534534
0, 15))
535-
536-
537535
# --- Left Column Suites ---
538536
self._create_suite_frame(left_col,
539537
'Low Resistance (~10 nΩ to 200 MΩ)',
@@ -1153,6 +1151,6 @@ def main():
11531151
# and ensures a consistent, stable process creation method across platforms.
11541152
# 'spawn' is the most robust method for GUI apps, though it is the default
11551153
# on Windows and macOS.
1156-
multiprocessing.set_start_method('spawn', force=True)
1154+
multiprocessing.set_start_method('spawn', force=True)
11571155
multiprocessing.freeze_support()
11581156
main()

tests/test_live_plotter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from unittest import mock
1010
import pytest
1111

12+
1213
@pytest.fixture
1314
def dummy_csv_file(tmp_path):
1415
# Create a dummy CSV file for testing

0 commit comments

Comments
 (0)