-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Measurement Results Refactor #3868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A third option to toss into the hat: just use arrays or bitarrays everywhere until as late as possible.
Pros:
Cons:
|
Feedback on Cirq Cynque:
Quick sketch:
Then we'll figure out how default implementations will be layed out. |
CC @MichaelBroughton to flag for possible cleanup before Cirq 1.0. |
This converts cirq.Result into an abstract base class which defines the interface provided by measurement result objects. We introduce a new class cirq.ResultDict which is the default implementation of this result type, based on a dict mapping string keys to array data. This will allow us to provide alternate implementations as needed, for example a result type that is based on a DataFrame and only converts to measurement dict on demand (cf #4774), or a result type that is based on experimental data (such as raw IQ data) and allows accessing this raw data while also converting to the standard measurements dict on demand (see #3868 for other possible Result implementations). Making this separation will also simplify the implementation of repeated measurement keys (#4274), since it will allow us to define the new interface for accessing data from repeated keys separately from the implementation of how this data is stored. Review: @95-martin-orion
cc @maffoo I think we've made the critical change of moving |
cc #5152 Do we actually want all the other types of results? I think not really. What do folks think about closing this issue and opening specific issues for specific result types or functionality that is missing? |
+1 from me to close this and file separate issues for additional specialized result types if needed. |
…lib#4806) This converts cirq.Result into an abstract base class which defines the interface provided by measurement result objects. We introduce a new class cirq.ResultDict which is the default implementation of this result type, based on a dict mapping string keys to array data. This will allow us to provide alternate implementations as needed, for example a result type that is based on a DataFrame and only converts to measurement dict on demand (cf quantumlib#4774), or a result type that is based on experimental data (such as raw IQ data) and allows accessing this raw data while also converting to the standard measurements dict on demand (see quantumlib#3868 for other possible Result implementations). Making this separation will also simplify the implementation of repeated measurement keys (quantumlib#4274), since it will allow us to define the new interface for accessing data from repeated keys separately from the implementation of how this data is stored. Review: @95-martin-orion
…lib#4806) This converts cirq.Result into an abstract base class which defines the interface provided by measurement result objects. We introduce a new class cirq.ResultDict which is the default implementation of this result type, based on a dict mapping string keys to array data. This will allow us to provide alternate implementations as needed, for example a result type that is based on a DataFrame and only converts to measurement dict on demand (cf quantumlib#4774), or a result type that is based on experimental data (such as raw IQ data) and allows accessing this raw data while also converting to the standard measurements dict on demand (see quantumlib#3868 for other possible Result implementations). Making this separation will also simplify the implementation of repeated measurement keys (quantumlib#4274), since it will allow us to define the new interface for accessing data from repeated keys separately from the implementation of how this data is stored. Review: @95-martin-orion
Is your design idea/issue related to a use case or problem? Please describe.
Based on the #3808, #3233, #3785 and other discussion around changing the measurement Results, proposing some high-level design ideas below for discussion. Once a consensus is reached, this will be developed into an RFC.
Names below are only descriptive, final names might be better.
Describe your design idea/issue
Proposal based on inheritance (inheritance was decided in Cirq Cynque):
measurement_dict
,flat_measurements
,dataframe
(notdata
) accessors.from_flat_measurements
method that also needskey -> index_list
mapping (can be computed from the circuit)from_iq_points
method that also needs some form of distribution/separation boundaries in IQ-space.Dict
will change considering nested and repeatedCircuitOperations
. We will add tuple measurement keysDict
might evolve into a more hierarchical tree structure if we want to automatically group at higherCircuitOperation
levelsStrategy pattern (built on another suggestion in #3808 and much simpler):
MeasurementStorageStrategy
enumResults
classResults
will use this enum to determine what data structure to use for native measurement storage[Future work/Classical data] Take in MeasurementKey->ClassicalRegister mapping to populate classical data during the run in addition to populating the native data structure. FlatMeasurementResults might take an Index->ClassicalRegister mapping
The text was updated successfully, but these errors were encountered: