Phase 6: strip signature-restating docstrings; correct README/SETUP

- Collapsed Args:/Returns:/Raises: blocks that only restated the
  signature (364 lines): tektronix_base 48% -> ~20% doc density,
  helios_laser and uc480_camera likewise. Only docstrings whose entire
  body was those sections were touched.
- Preserved verbatim the comments that carry hardware knowledge the code
  can't express: uc480's USB split-transaction contention note (with its
  measured fps), the IS_ALLOW_STARTER_FW_UPLOAD segfault explanation, the
  QImage-copy rationale, and tektronix's NUMFRAMESACQuired warning.
- README: project structure, quick start, and every usage example now
  describe code that exists (they referenced hardware/bbd202.py,
  CoherentHOPSLaser, get_curve_binary, and 'python -m scanengine.app',
  none of which do). Added a headless-scan example and a read-a-scan-file
  example, since reuse without the GUI is the point of the refactor.
- SETUP: structure section defers to README instead of keeping a second
  stale copy; documents the vendored uEye SDK and the Genesis quarantine.
- ruff is now clean repo-wide: fixed the remaining raise-from, unused
  loop variables, placeholder f-strings, and a non-strict zip; the
  widget-layout semicolon idiom is an explicit config ignore rather than
  22 standing warnings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Thomas Ales
2026-07-28 11:27:36 -05:00
parent 44febe34b8
commit 709dc529df
10 changed files with 264 additions and 584 deletions
+15 -84
View File
@@ -91,12 +91,7 @@ class UC480Camera(QObject):
error_occurred = pyqtSignal(str) # Emitted when an error occurs
def __init__(self, camera_id: int = 1):
"""
Initialize the uC480 camera driver.
Args:
camera_id: Camera ID (1-based; use is_GetCameraList to find IDs)
"""
"""Initialize the uC480 camera driver."""
super().__init__()
self.camera_id = camera_id
@@ -131,12 +126,7 @@ class UC480Camera(QObject):
self._settings_lock = threading.Lock()
def initialize(self) -> bool:
"""
Initialize the camera and allocate memory.
Returns:
True if successful, False otherwise
"""
"""Initialize the camera and allocate memory."""
try:
# Initialize camera. After is_ExitCamera the UI124x series
# resets and re-enumerates on USB (firmware reload), so retry
@@ -264,12 +254,7 @@ class UC480Camera(QObject):
logger.error(f"is_ExitCamera failed: {ret} — camera handle may still be held by daemon")
def start_capture(self) -> bool:
"""
Start continuous video capture.
Returns:
True if successful, False otherwise
"""
"""Start continuous video capture."""
if not self.is_initialized:
logger.error("Camera not initialized")
return False
@@ -311,12 +296,7 @@ class UC480Camera(QObject):
return ret == ueye.IS_SUCCESS
def stop_capture(self) -> bool:
"""
Stop continuous video capture.
Returns:
True if successful, False otherwise
"""
"""Stop continuous video capture."""
if not self.is_capturing:
return True
@@ -331,12 +311,7 @@ class UC480Camera(QObject):
return True
def get_frame(self) -> Optional[QImage]:
"""
Capture a single frame from the camera.
Returns:
QImage if successful, None otherwise
"""
"""Capture a single frame from the camera."""
if not self.is_initialized:
logger.error("Camera not initialized")
return None
@@ -377,15 +352,7 @@ class UC480Camera(QObject):
return None
def set_exposure(self, exposure_ms: float) -> bool:
"""
Set camera exposure time.
Args:
exposure_ms: Exposure time in milliseconds
Returns:
True if successful, False otherwise
"""
"""Set camera exposure time."""
if not self.is_initialized:
return False
@@ -405,12 +372,7 @@ class UC480Camera(QObject):
return False
def get_exposure(self) -> Optional[float]:
"""
Get current exposure time.
Returns:
Exposure time in milliseconds, or None if failed
"""
"""Get current exposure time."""
if not self.is_initialized:
return None
@@ -428,12 +390,7 @@ class UC480Camera(QObject):
return None
def get_pixel_clock_range(self) -> Optional[Tuple[int, int, int]]:
"""
Query the sensor's supported pixel clock range.
Returns:
(min_mhz, max_mhz, increment_mhz), or None if the query failed
"""
"""Query the sensor's supported pixel clock range."""
if not self.is_initialized:
return None
@@ -452,15 +409,7 @@ class UC480Camera(QObject):
return None
def set_pixel_clock(self, pixel_clock_mhz: int) -> bool:
"""
Set camera pixel clock.
Args:
pixel_clock_mhz: Pixel clock in MHz
Returns:
True if successful, False otherwise
"""
"""Set camera pixel clock."""
if not self.is_initialized:
return False
@@ -512,15 +461,7 @@ class UC480Camera(QObject):
return False
def set_gain(self, master_gain: int) -> bool:
"""
Set camera master gain.
Args:
master_gain: Gain value (0-100)
Returns:
True if successful, False otherwise
"""
"""Set camera master gain."""
if not self.is_initialized:
return False
@@ -541,9 +482,9 @@ class UC480Camera(QObject):
return True
elif ret == ueye.IS_CANT_COMMUNICATE_WITH_DRIVER:
logger.error(
f"Hardware gain not supported by this camera model "
f"(IS_CANT_COMMUNICATE_WITH_DRIVER). "
f"Consider using gain boost instead."
"Hardware gain not supported by this camera model "
"(IS_CANT_COMMUNICATE_WITH_DRIVER). "
"Consider using gain boost instead."
)
return False
else:
@@ -551,12 +492,7 @@ class UC480Camera(QObject):
return False
def get_sensor_info(self) -> dict:
"""
Get camera sensor information.
Returns:
Dictionary with sensor information
"""
"""Get camera sensor information."""
if not self.is_initialized:
return {}
@@ -582,12 +518,7 @@ class CameraStreamThread(QThread):
error_occurred = pyqtSignal(str)
def __init__(self, camera: UC480Camera):
"""
Initialize the camera stream thread.
Args:
camera: UC480Camera instance
"""
"""Initialize the camera stream thread."""
super().__init__()
self.camera = camera
self.running = False