feat(instrodaq): unified read and write functions - #303
Conversation
Implement the branch's typed configure_* methods on _RecordingDriver and migrate the unified read/write tests to the typed configure_*_input/output HAL methods. Adds one-of-each analog input coverage to the read-all test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a scaler field to AnalogThermocoupleChannel and a scaler parameter to configure_thermocouple_input, matching the voltage and current input types. This also fixes an AttributeError in _scale_analog_measurement, which reads ch_config.scaler on every AI channel. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…01-unified-read-and-write
Add the scaler parameter to the configure_thermocouple_input signature in the typed-configuration table, matching the voltage and current input entries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…01-unified-read-and-write
|
| Filename | Overview |
|---|---|
| instro/daq/daq.py | Adds unified read/write dispatch while preserving requested alias order in read results. |
| tests/daq/test_daq_drivers.py | Adds unit tests for unified analog and digital routing, scalar returns, and invalid inputs. |
| docs/guides/instrumentation/daq.mdx | Documents unified reads and writes, examples, published channel names, and method references. |
Reviews (2): Last reviewed commit: "Merge branch 'instro-500-explicit-input-..." | Re-trigger Greptile
…01-unified-read-and-write
…01-unified-read-and-write
| measurement.channel_data[f"{self.name}.{ch_name}"] = scaled_values | ||
| return measurements | ||
|
|
||
| def read( |
There was a problem hiding this comment.
I now have our read returning a dict instead of just a list of measurements. To me this is much more usable than having the user find their measurements in a list. Was there a reason we were just returning a list of measurements from read_analog()?
read() already rejected unknown input aliases before touching hardware; write() checked each alias inside the dispatch loop, so a bad alias in a multi-channel write raised only after earlier channels had already been driven. Hoist the check to match read(), and cover both with a test that asserts no driver I/O happened. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Work for #223 |
…unified-read-and-write # Conflicts: # instro/daq/daq.py # tests/daq/test_daq_drivers.py
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
…unified-read-and-write
…unified-read-and-write
Summary
This PR adds unified
readandwritefunctions toInstroDAQthat route to eitherread_analog/digitalorwrite_analog/digitaldepending on the type of channel it's operating on. This cleans up the surface a ton and makes reading and writing data with anInstroDAQmuch easier.Closes INSTRO-501
Type of change
fix)feat)feat!/fix!)refactor)docs)chore)Verification
Tests
Checklist
feat(driver): add support for Keysight E36300)Notes for reviewers
The new
read()function wraps the existingread_analog()function that still raises an error when trying to read samples when the background daemon is running. We need to fix this functionality.