You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some analysis, say evaluation of stability of the HW, one needs to see the bistrings from all shots, presented as a list.
Currently you provide only the summary in the form of dictionary of all unique bistrings and the number of occurences. It is done by get_counts(): https://amazon-braket-sdk-python.readthedocs.io/en/latest/_modules/braket/tasks/analog_hamiltonian_simulation_quantum_task_result.html#AnalogHamiltonianSimulationQuantumTaskResult.get_counts
Can you provide also new function get_shots(), which would differ very little from get_counts(), namely instead of accumulating the dictionary:
state_counts = Counter()
for shot in self.measurements:
...
state_counts.update((state,))
return dict(state_counts)
it would append a list:
state_list = []
for shot in self.measurements:
...
state_list.append(state)
return state_list
I can hack it for now, but this type of functionality is of general use. E.g. it is available in Qiskit or TKet.
Thanks, Jan
The text was updated successfully, but these errors were encountered:
Thank you for raising this issue @balewski! We would be glad to include this functionality. Since you have already hacked it together, would you like to contribute it to the SDK?
I'm not that skilled with code commit. Here is my hacked version - use it as you like
Jan
#...!...!..................
def hacked_get_shots(measurements):
state_list=[]
states = ["e", "r", "g"]
for shot in measurements:
if shot.status == AnalogHamiltonianSimulationShotStatus.SUCCESS:
pre = shot.pre_sequence
post = shot.post_sequence
# converting presequence and postsequence measurements to state_idx
state_idx = [
0 if pre_i == 0 else 1 if post_i == 0 else 2 for pre_i, post_i in zip(pre, post)
]
state = "".join(map(lambda s_idx: states[s_idx], state_idx))
state_list.append(state)
return state_list
For some analysis, say evaluation of stability of the HW, one needs to see the bistrings from all shots, presented as a list.
Currently you provide only the summary in the form of dictionary of all unique bistrings and the number of occurences. It is done by get_counts():
https://amazon-braket-sdk-python.readthedocs.io/en/latest/_modules/braket/tasks/analog_hamiltonian_simulation_quantum_task_result.html#AnalogHamiltonianSimulationQuantumTaskResult.get_counts
Can you provide also new function get_shots(), which would differ very little from get_counts(), namely instead of accumulating the dictionary:
it would append a list:
I can hack it for now, but this type of functionality is of general use. E.g. it is available in Qiskit or TKet.
Thanks, Jan
The text was updated successfully, but these errors were encountered: