Use list for GoogleNoiseProperties.readout_errors values#7392
Merged
pavoljuhas merged 5 commits intoquantumlib:mainfrom Jun 2, 2025
Merged
Conversation
GoogleNoiseProperties from `calibration_to_noise_properties()` cannot be serialized. Here is a test for that failure.
Problem: The values in `SuperconductingQubitsNoiseProperties.readout_errors` and `GoogleNoiseProperties.readout_errors` dictionary are declared as both `list[float]` and `np.ndarray` and can be set with either type. JSON serialization fails when assigned list type. Solution: Always convert to a `list[float]` type. This fixes serialization failure for object constructed with `noise_properties_from_calibration`.
Collaborator
Author
|
Question @dstrain115 - The json_test_data/GoogleNoiseProperties.repr file expresses This passes tests because Should we leave it as is or is it better to update GoogleNoiseProperties.repr? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7392 +/- ##
==========================================
- Coverage 98.68% 98.68% -0.01%
==========================================
Files 1112 1112
Lines 97737 97755 +18
==========================================
+ Hits 96454 96471 +17
- Misses 1283 1284 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dstrain115
approved these changes
Jun 2, 2025
BichengYing
pushed a commit
to BichengYing/Cirq
that referenced
this pull request
Jun 20, 2025
…7392) Problem: The values in `SuperconductingQubitsNoiseProperties.readout_errors` and `GoogleNoiseProperties.readout_errors` dictionaries are declared as `np.ndarray` in docstrings, but annotated as`list[float]` in the code, and can be set to either type. JSON serialization fails when assigned a list. Solution: Always convert to `list[float]` following the type annotation. This fixes serialization failure for `GoogleNoiseProperties` objects created with `noise_properties_from_calibration`.
This was referenced Aug 5, 2025
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.
Problem: The values in
SuperconductingQubitsNoiseProperties.readout_errorsand
GoogleNoiseProperties.readout_errorsdictionaries are declared asnp.ndarrayin docstrings, but annotated aslist[float]in the code,and can be set to either type. JSON serialization fails when assigned a list.
Solution: Always convert to
list[float]following the type annotation.This fixes serialization failure for
GoogleNoisePropertiesobjects createdwith
noise_properties_from_calibration.