[wip] Add structured parameter#8095
Open
jenshnielsen wants to merge 4 commits intomicrosoft:mainfrom
Open
Conversation
Introduce StructParameter, a new parameter type that returns structured data as a Python dataclass or Pydantic v2 BaseModel. Each field of the struct is automatically unpacked into a separate dataset column when used with Measurement. Key features: - Subclass of ParameterBase (get-only, read-only) - Introspects struct fields and creates synthetic child parameters - Maps field types to QCoDeS paramtypes (numeric, text, complex, array) - Dedicated registration path in Measurement.register_parameter() - Pydantic support is optional (lazy import) - snapshot_value defaults to False Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Demonstrates: - Defining struct types with dataclasses - Creating StructParameter subclasses with get_raw - Using StructParameter with Measurement for dataset recording - Customising field labels, units, and paramtypes - Using get_cmd callable instead of subclassing - Snapshot behaviour Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add get_cmd parameter to StructParameter so users can pass a callable instead of subclassing. This mirrors the Pattern from Parameter. Also adds the StructParameter example notebook covering struct type definition, subclassing, get_cmd usage, Measurement integration, mixed field types, and snapshot behaviour. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8095 +/- ##
==========================================
- Coverage 70.61% 69.72% -0.89%
==========================================
Files 333 334 +1
Lines 32533 32678 +145
==========================================
- Hits 22972 22786 -186
- Misses 9561 9892 +331 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an idea to implement something like multi parameter but with a more modern and structured interface.
This pr currently is an early prototype for comments mostly.