Pre-scan angle inspection: park the rig per angle, read the response on the scope
A 9-angle scan takes hours, and an angle that responds poorly still produces rows that look structurally fine in the file — the SAW packet is just not there. This lets the operator walk the angles first, parking the rig at a random point in each, and judge the response before committing to the run. Nothing reads the scope. The operator inspects the instrument directly, so there is no transfer path, no plotting, and no waveform crossing the module boundary — test_inspection_never_reads_a_waveform_back pins that, since it is the kind of premise a later change erodes without noticing. core/scope_inspect.py — the scope state worth looking at, which is not the scan's state: - plain rising-edge trigger on CH2 at 2.0 V, not the scan's logic AND of the laser pulse and the stage gate, so a stationary stage still triggers - FastFrame off, SAMPLE (no averaging) — a weak or intermittent response is exactly what is being looked for, and averaging would hide it - free-running (STOPAfter RUNSTop + STATE RUN) so the trace keeps updating while the operator looks at it - CH1 keeps the acquisition front-end verbatim, so what is on screen is what a scan would record - CH3/CH4 become bias monitors sharing one scale and position, since the comparison is by eye and only works if a division means the same on each. 100 mV/div with ground 3.5 divisions below centre puts 0–700 mV on screen with headroom on an 8- or 10-division graticule (the signal never goes negative, hence moving the trace down). core/angle_inspect.py — AngleInspector, headless and Qt-free like ScanEngine. Points are drawn from the angle's own bounding box: Y from its actual row positions and X uniformly across its data window, so the point is somewhere the scan would really sample rather than merely inside the box. New Point re-rolls without rotating, which is what separates a bad spot on the sample from a bad angle. The stage gate is held off throughout, and the rotator goes home on stop. gui/inspect_bridge.py — QtAngleInspector on the existing QueueWorker base. Inspection is click-driven rather than one long run, so the worker blocks on its queue between commands and an open window costs nothing. BBD position polling is suppressed while inspecting, for the same reason the scan does it: the shared TX queue. sc3_aui_app.py — AngleInspectWindow (angle list, prev/next, New Point) driven off the plan currently entered in the scan panel, so it inspects exactly the scan about to be run. Navigation locks while the stage moves. The list syncs via itemClicked rather than currentRowChanged, so echoing the worker's position back does not re-trigger the move it is reporting. README picks up the new modules, and scope_burst.py which the previous merge left out of the structure listing. 114 tests passing, ruff clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
"""Oscilloscope configuration for pre-scan angle inspection.
|
||||
|
||||
Inspection is read-on-the-instrument: nothing in this module transfers or
|
||||
plots waveform data. The app puts the scope into a free-running, edge-
|
||||
triggered state and drives the stage to the point being inspected; the
|
||||
operator judges the SAW response and the bias levels on the scope screen.
|
||||
|
||||
That split is deliberate. A scan's acquisition trigger is the logic AND of
|
||||
the laser pulse and the stage's max-velocity gate, and its transfers are
|
||||
FastFrame blocks — neither is useful for looking at one point by eye. Here
|
||||
the trigger is a plain edge on the laser pulse, FastFrame is off, and the
|
||||
acquisition free-runs, so the display updates continuously while the stage
|
||||
sits still.
|
||||
|
||||
CH1 keeps the acquisition front-end so what is on screen is what a scan would
|
||||
record. CH3 and CH4 are rescaled as DC bias monitors (see BIAS_* below).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from dataclasses import replace
|
||||
|
||||
from core.scope_sras import SAMPLE_RATE_HZ, SRAS_CHANNELS, configure_channels
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# CH2 carries the laser pulse. The scan triggers it at 0.5 V as one term of a
|
||||
# logic AND; inspection triggers well above that so a slow edge or a noisy
|
||||
# baseline cannot free-run the display.
|
||||
INSPECT_TRIG_LEVEL_V = 2.0
|
||||
|
||||
# CH3/CH4 are the DC bias monitors during inspection. The signal never goes
|
||||
# negative and spans roughly 0–700 mV, so both channels get the *same* scale
|
||||
# and position — the point of inspecting them is comparing the two by eye, and
|
||||
# that only works if a division means the same thing on each.
|
||||
#
|
||||
# Ground sits BIAS_POSITION_DIV divisions below centre, which puts the whole
|
||||
# 0–700 mV range above the centre line with a little room underneath for
|
||||
# undershoot. With 100 mV/div and ground 3.5 divisions low, the visible window
|
||||
# runs from about -50 mV to +750 mV on an 8-division display and wider on a
|
||||
# 10-division one, so 0–700 mV sits comfortably inside either.
|
||||
BIAS_CHANNELS = (3, 4)
|
||||
BIAS_WINDOW_V = 0.700
|
||||
BIAS_SCALE_V_DIV = 0.100
|
||||
BIAS_POSITION_DIV = -3.5
|
||||
|
||||
BIAS_LABELS = {3: "Bias - A", 4: "Bias - B"}
|
||||
|
||||
|
||||
def inspect_channel_profiles() -> dict:
|
||||
"""Channel front-end config for inspection.
|
||||
|
||||
CH1 and CH2 are the acquisition profiles verbatim. CH3 and CH4 differ
|
||||
only in label, scale and position — termination, coupling and bandwidth
|
||||
stay as the scan sets them, so the bias reading is the same measurement
|
||||
the scan records, just displayed usefully.
|
||||
"""
|
||||
profiles = dict(SRAS_CHANNELS)
|
||||
for ch in BIAS_CHANNELS:
|
||||
profiles[ch] = replace(
|
||||
SRAS_CHANNELS[ch],
|
||||
label=BIAS_LABELS[ch],
|
||||
scale_v_div=BIAS_SCALE_V_DIV,
|
||||
position_div=BIAS_POSITION_DIV,
|
||||
)
|
||||
return profiles
|
||||
|
||||
|
||||
def configure_inspection(scope) -> None:
|
||||
"""Put the scope into free-running inspection mode.
|
||||
|
||||
Leaves the acquisition running, so the display stays live while the
|
||||
operator moves between angles and points.
|
||||
"""
|
||||
configure_channels(scope, inspect_channel_profiles())
|
||||
|
||||
# Plain edge trigger on the laser pulse — no logic pattern, so the stage
|
||||
# gate plays no part and a stationary stage still triggers.
|
||||
scope.write("TRIGger:A:TYPe EDGE")
|
||||
scope.set_trigger_source(2)
|
||||
scope.set_trigger_slope("RISE")
|
||||
scope.set_trigger_level(2, INSPECT_TRIG_LEVEL_V)
|
||||
scope.set_trigger_mode("NORMAL")
|
||||
|
||||
# No averaging: a weak or intermittent SAW response is exactly what the
|
||||
# operator is looking for, and averaging would hide it.
|
||||
scope.set_acquire_mode("SAMPLE")
|
||||
scope.set_fastframe_state(False)
|
||||
|
||||
scope.set_sample_rate(SAMPLE_RATE_HZ)
|
||||
scope.write("HORizontal:POSition 30")
|
||||
|
||||
# Free-run rather than single-sequence, so the trace keeps updating.
|
||||
scope.write("ACQuire:STOPAfter RUNSTop")
|
||||
scope.write("ACQuire:STATE RUN")
|
||||
|
||||
|
||||
def stop_inspection(scope) -> None:
|
||||
"""Halt the free-running acquisition.
|
||||
|
||||
The next scan reconfigures the scope from scratch, so this only needs to
|
||||
stop the sweep — it does not try to restore the acquisition profile.
|
||||
"""
|
||||
scope.write("ACQuire:STATE STOP")
|
||||
Reference in New Issue
Block a user