Skip to content

Commit 4b9a1f9

Browse files
Cleanup
1 parent 558eb9a commit 4b9a1f9

10 files changed

Lines changed: 1006 additions & 1302 deletions

File tree

.github/workflows/joss_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
4040
4141
echo "STEP 2: Checking for code style warnings..."
42-
flake8 . --count --exit-zero --max-complexity=18 --max-line-length=127 --statistics
42+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4343
4444
# ------------------------------------------------------------------------
4545
# PHASE 3: CUSTOM TESTS (The "Three Pillars")

Keithley_2400_Keithley_2182/IV_K2400_K2182_GUI_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def shutdown(self):
162162
self.k2182.close()
163163
except BaseException:
164164
pass
165-
print(" Instruments shut down and disconnected.") # type: ignore
165+
print(" Instruments shut down and disconnected.")
166166

167167
# -------------------------------------------------------------------------------
168168
# --- FRONT END (GUI) ---

Keithley_6517B/High_Resistance/Backends/IV_K6517B_Simple_Backend_v10.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def plot_results(data):
102102
print("\nStarting zero correction procedure...")
103103
time.sleep(5)
104104
print("Step 1: Enabling Zero Check mode...")
105-
keithley.write(':SYSTem:ZCHeck ON') # type: ignore
105+
keithley.write(':SYSTem:ZCHeck ON')
106106
time.sleep(5)
107107
print("Step 2: Acquiring zero correction value...")
108108
# keithley.write(':SYSTem:ZCORrect:ACQuire')

Keithley_6517B/High_Resistance/IV_K6517B_GUI_v11.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,22 @@ def initialize_instruments(self, parameters):
148148

149149
# 1. Enable Zero Check
150150
print(" Step 1/4: Enabling Zero Check mode...")
151-
self.keithley.write(':SYSTem:ZCHeck ON') # type: ignore
151+
self.keithley.write(':SYSTem:ZCHeck ON')
152152
time.sleep(2)
153153

154154
# 2. Acquire the zero measurement
155155
print(" Step 2/4: Acquiring zero correction value...")
156-
self.keithley.write(':SYSTem:ZCORrect:ACQuire') # type: ignore
156+
self.keithley.write(':SYSTem:ZCORrect:ACQuire')
157157
time.sleep(2) # Allow time for acquisition
158158

159159
# 3. Disable Zero Check
160160
print(" Step 3/4: Disabling Zero Check mode...")
161-
self.keithley.write(':SYSTem:ZCHeck OFF') # type: ignore
161+
self.keithley.write(':SYSTem:ZCHeck OFF')
162162
time.sleep(1)
163163

164164
# 4. Enable Zero Correct
165165
print(" Step 4/4: Enabling Zero Correction for all measurements.")
166-
self.keithley.write(':SYSTem:ZCORrect ON') # type: ignore
166+
self.keithley.write(':SYSTem:ZCORrect ON')
167167
time.sleep(1)
168168
print(" Zero Correction Complete.")
169169

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<p align="center">
2-
<img src="_assets/LOGO/PICA_LOGO_NBG.png" alt="PICA Logo" width="150"/>
2+
<img src="assets/LOGO/PICA_LOGO_NBG.png" alt="PICA Logo" width="150"/>
33
</p>
44
<h1 align="center">PICA: Python-based Instrument Control and Automation</h1>
55
<p align="center">
66
A modular software suite for automating laboratory measurements in physics research.
77
</p>
8-
98
<p align="center">
109
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
1110
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/Python-3.9+-brightgreen.svg" alt="Python 3.9+"></a>
@@ -25,7 +24,7 @@ A key architectural feature is the use of isolated process execution for each me
2524
PICA is designed with a clear separation between the user interface (GUI) and the instrument control logic (backend). This modular approach makes the system easy to maintain, extend, and debug.
2625

2726
<p align="center">
28-
<img src="_assets/Images/PICA_Launcher_v6.png" alt="PICA Launcher Screenshot" width="800"/>
27+
<img src="assets/Images/PICA_Launcher_v6.png" alt="PICA Launcher Screenshot" width="800"/>
2928
</p>
3029

3130
---
@@ -187,7 +186,7 @@ This facility provides users with a comprehensive, modular system for characteri
187186
For detailed setup instructions, hardware interfacing guides, and troubleshooting, please refer to the **[PICA User Manual](docs/User_Manual.md)** located in the `docs/` directory.
188187
189188
**Instrument Manuals:**
190-
A collection of official instrument manuals is provided within the `_assets/Manuals/` directory for technical reference.
189+
A collection of official instrument manuals is provided within the `assets/Manuals/` directory for technical reference.
191190
192191
---
193192
@@ -230,7 +229,7 @@ Please open an issue first to discuss any major changes you would like to make.
230229
## Authors & Acknowledgments
231230
232231
<p align="center">
233-
<img src="_assets/LOGO/UGC_DAE_CSR_NBG.jpeg" alt="UGC DAE CSR Logo" width="150">
232+
<img src="assets/LOGO/UGC_DAE_CSR_NBG.jpeg" alt="UGC DAE CSR Logo" width="150">
234233
</p>
235234
236235
- **Lead Developer:** **[Prathamesh Deshmukh](https://prathameshdeshmukh.site/)**

Utilities/PlotterUtil_GUI_v3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class PlotterApp:
8585
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
8686
LOGO_FILE_PATH = os.path.join(
8787
SCRIPT_DIR,
88-
"..", # type: ignore
88+
"..",
8989
"assets",
9090
"LOGO",
9191
"UGC_DAE_CSR_NBG.jpeg")
@@ -958,7 +958,7 @@ def _finalize_plot(self, x_col, y_col, selected_filepaths):
958958
if leg:
959959
leg.get_title().set_color(self.CLR_CONSOLE_BG)
960960

961-
self.ax_main.set_xscale('log' if self.x_log_var.get() else 'linear') # type: ignore
961+
self.ax_main.set_xscale('log' if self.x_log_var.get() else 'linear')
962962
self.ax_main.set_yscale('log' if self.y_log_var.get() else 'linear')
963963
self.ax_main.set_xlabel(x_col)
964964
self.ax_main.set_ylabel(y_col)

deployment/build-exe.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ jobs:
7575
Lakeshore_350_340
7676
Lock_In_Amplifier
7777
Utilities
78-
# The icon path must be relative to the project root.
79-
windows-icon-from-ico: _assets/LOGO/UGC_DAE_CSR.ico
78+
79+
windows-icon-from-ico: assets/LOGO/UGC_DAE_CSR.ico
8080

8181
# --- COPY NON-PYTHON ASSETS ---
8282
# These directories contain assets like images, manuals, etc.
8383
include-data-dir: |
84-
_assets=_assets
84+
assets=assets
8585
include-data-files: |
8686
LICENSE=LICENSE
8787
PICA_README.md=PICA_README.md

tests/test_deep_simulation.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
sys.modules['tkinter.messagebox'] = MagicMock()
1515
sys.modules['tkinter.filedialog'] = MagicMock()
1616

17-
# Mock pymeasure to prevent real instrument calls, but do it carefully.
18-
# We mock the base 'instruments' module, not specific classes.
19-
sys.modules['pymeasure.instruments'] = MagicMock()
20-
2117
# Mock Multiprocessing to prevent Queue.get() hangs
2218
mock_mp = MagicMock()
2319
sys.modules['multiprocessing'] = mock_mp
@@ -109,7 +105,7 @@ def side_effect(*args, **kwargs):
109105

110106
def test_01_k2400_iv_backend(self):
111107
# GLOBAL PATCH for sleep is critical here
112-
with patch('pymeasure.instruments.keithley.Keithley2400') as MockInst, \
108+
with patch('pymeasure.instruments.keithley.Keithley2400', autospec=True) as MockInst, \
113109
patch('time.sleep', side_effect=self.get_circuit_breaker(5)):
114110

115111
spy = MockInst.return_value
@@ -198,7 +194,7 @@ def test_08_combined_2400_2182(self):
198194
# THIS WAS THE TEST CAUSING THE HANG
199195
# We suspect input mismatch or resource opening hang.
200196
with patch('pyvisa.ResourceManager') as MockRM, \
201-
patch('pymeasure.instruments.keithley.Keithley2400') as MockK2400, \
197+
patch('pymeasure.instruments.keithley.Keithley2400'), \
202198
patch('time.sleep', side_effect=self.get_circuit_breaker(10)):
203199

204200
rm = MockRM.return_value

tests/test_full_stack_simulation.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
sys.modules['matplotlib.backends'] = MagicMock()
2020
sys.modules['matplotlib.backends.backend_tkagg'] = MagicMock()
2121

22-
# Mock pymeasure to prevent real instrument calls, but do it carefully.
23-
# We mock the base 'instruments' module, not specific classes.
24-
sys.modules['pymeasure.instruments'] = MagicMock()
25-
2622

2723
class TestDeepSimulation(unittest.TestCase):
2824

@@ -72,7 +68,7 @@ def run_module_safely(self, module_name):
7268
def test_keithley2400_iv_protocol(self):
7369
print("\n[SIMULATION] Testing Keithley 2400 I-V Protocol...")
7470

75-
with patch('pymeasure.instruments.keithley.Keithley2400') as MockK2400:
71+
with patch('pymeasure.instruments.keithley.Keithley2400', autospec=True) as MockK2400:
7672
spy_inst = MockK2400.return_value
7773
spy_inst.voltage = 1.23
7874

0 commit comments

Comments
 (0)