Commit 163e202
Uniformize capability mixins: single *Capability convention, single module, single base (#114)
* Rename DAQ capability mixins from *Device to *Capability
Problem: The DAQ family named its interface-segregated capability mixins
with a *Device suffix (AnalogInputDevice, TriggerableDevice, ...), while
the same objects are features a device *has*, not devices themselves.
This collided conceptually with instantiable hardware drivers, which are
also named *Device (LabjackDevice, SR830Device), making it unclear from
a name whether a class is a mixin or a real device.
Solution: Rename all nine DAQ mixins to the *Capability suffix, reserving
*Device for instantiable hardware drivers. Public methods and behavior are
unchanged; only the mixin class names change.
AnalogInputDevice -> AnalogInputCapability
AnalogOutputDevice -> AnalogOutputCapability
AnalogIODevice -> AnalogIOCapability
AnalogInputStreamDevice -> AnalogInputStreamCapability
DigitalInputDevice -> DigitalInputCapability
DigitalOutputDevice -> DigitalOutputCapability
DigitalIODevice -> DigitalIOCapability
PhaseLockedDetectionDevice -> PhaseLockedDetectionCapability
TriggerableDevice -> TriggerCapability
Updates the LabjackDevice and SR830Device base-class lists and imports,
the daq package exports, and the SR830 tests. Documents the rename in
CHANGELOG (Unreleased, marked Breaking) and the *Capability/*Device rule
in CLAUDE.md and the skill doc.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Rename source and power-meter capability mixins to *Capability
Problem: After the DAQ rename, two families still used their own
conventions for capability mixins: laser sources used a *Control suffix
(OnOffControl, PowerControl, ...) and power meters used adjective forms
(WavelengthCalibratable, AutoScalable, ScaleAdjustable). This left three
naming styles for the same concept -- a feature a device may have -- and
made it inconsistent which classes are mixins versus instantiable
devices.
Solution: Rename these mixins to the same *Capability suffix adopted for
DAQ, completing the uniform rule: *Capability for mixins, *Device for
instantiable hardware. Public methods and behavior are unchanged.
Laser sources (sources/capabilities.py):
OnOffControl -> OnOffCapability
ShutterControl -> ShutterCapability
PowerControl -> PowerCapability
InterlockControl -> InterlockCapability
AutostartControl -> AutostartCapability
WavelengthControl -> WavelengthCapability
DispersionControl -> DispersionCapability
Power meters (powermeters/capabilities.py):
WavelengthCalibratable -> WavelengthCalibrationCapability
AutoScalable -> AutoScaleCapability
ScaleAdjustable -> ScaleCapability
Updates the CoboltDevice, MillenniaEv25Device, MatisseDevice,
VerdiGDevice, FieldMasterDevice, and IntegraDevice base-class lists and
imports, the sources/powermeters package exports, the source/powermeter
tests, and the physicaldevice.py doc comment. Documents the rename in
CHANGELOG (Unreleased, folded into the Breaking capability-rename entry)
and CLAUDE.md / the skill doc, and aligns the HOPS and Millennia manuals.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Consolidate capability mixins into one module with a single Capability base
Problem: Capability mixins were spread across three modules with two
independent Capability base classes: sources/capabilities.py and
powermeters/capabilities.py each defined their own Capability(ABC), while
the DAQ mixins in daq/daqdevice.py inherited bare ABC with no shared base
at all. Capability introspection (capabilities() / hasCapability()) was
duplicated verbatim on LaserSourceDevice and PowerMeterDevice, each bound
to its family's local Capability, and DAQ devices had no introspection.
Solution: Move every capability mixin into a single top-level module,
hardwarelibrary/capabilities.py, all subclassing one Capability base. The
DAQ enums (InputSource, TriggerSource, SampleClock, DAQNotification) move
with their mixins. Hoist capabilities() / hasCapability() onto
PhysicalDevice, bound to the single Capability, so every device -- DAQ
included -- gets capability introspection, and the duplicated methods are
removed (LaserSourceDevice becomes a pure marker; PowerMeterDevice keeps
only its power hooks).
The per-family capabilities.py / daqdevice.py files are deleted. All
internal imports point at hardwarelibrary.capabilities; the family package
__init__s still re-export their own mixins, so existing consumers such as
`from hardwarelibrary.daq import AnalogIOCapability` keep working.
Docs updated: capabilities are documented once on the Core page; the
per-family automodule sections and their file-path references are removed.
Full suite: 470 passed, 247 skipped, no regressions.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Nest the acquisition notification inside AnalogInputStreamCapability
Problem: DAQNotification (willAcquire/didAcquire) sat as a free-floating
module-level enum in capabilities.py, unattached to the capability that
posts it.
Solution: Nest it as AnalogInputStreamCapability.Notification, inside the
acquisition capability it belongs to, so the notification is discoverable
from the capability that raises it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ce03dde commit 163e202
31 files changed
Lines changed: 472 additions & 418 deletions
File tree
- .claude/skills/pyhardwarelibrary
- docs/source/api
- hardwarelibrary
- daq
- manuals
- powermeters
- sources
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
31 | 64 | | |
32 | 65 | | |
33 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
12 | 21 | | |
13 | 22 | | |
14 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
10 | 7 | | |
11 | 8 | | |
12 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
| 12 | + | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
| |||
0 commit comments