Return QuTiP backend results as OQD datastores#47
Open
glasses666 wants to merge 1 commit into
Open
Conversation
The QuTiP backend previously surfaced an ad hoc dictionary containing Qobj instances, which could not be saved through the shared OQD dataschema path. This wraps the existing VM result in a Datastore with numeric tspan, state trajectory, final state datasets, and scalar run metadata. Constraint: Depends on oqd-dataschema exposing TrICalEmulatorDataGroup for the shared schema Rejected: Keep returning the legacy dict alongside Datastore | issue OpenQuantumDesign#44 asks for backend.run to return dataschema output directly Confidence: medium Scope-risk: moderate Directive: Do not serialize QuTiP runtime objects into attrs; keep HDF5 payload numeric and scalar metadata only Tested: uv run --with-editable ../oqd-dataschema --extra tests pytest tests/ -q Tested: uv run --with-editable ../oqd-dataschema ruff check src tests Tested: git diff --check
Member
|
@glasses666 Thanks for the PR, this looks good and meets all the requirements for #44. The branch for the |
4 tasks
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.
Closes #44.
Feature: updates the QuTiP backend result API to return an
oqd_dataschema.Datastore.QutipBackend.run(...)currently returns an ad hoc dict containing QuTiP runtime objects (final_state,states,tspan,frame,hilbert_space), which cannot be saved through the shared OQD dataschema HDF5 path.QutipBackend.run(...)now returns aDatastorewith one"emulation"group containing:tspan: float timeline datasetstates: complex ket or density-matrix trajectory datasetfinal_state: complex final ket or density matrix datasetThe QuTiP VM execution path is unchanged; the old VM result is wrapped after execution. The QuTiP reference docs now show the new
Datastoreusage and HDF5 dump path.Yes. Code using
result["tspan"]/result["states"]now needs to access the datastore group, for exampleresult["emulation"].tspan.dataandresult["emulation"].states.data. This matches the requested issue behavior.Depends on OpenQuantumDesign/oqd-dataschema#12, which adds
TrICalEmulatorDataGroup. To keep this PR testable before that schema PR lands, the temporaryuvsource points atglasses666/oqd-dataschema:codex/unitaryhack-44-trical-group. After #12 is merged, I can update this PR to point back atOpenQuantumDesign/oqd-dataschemaand relock.AI-assisted with OpenAI Codex; the diff was reviewed and locally verified before submission.
Validation run locally: