Skip to content

Commit

Permalink
wrap relevant results in np.array (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
timmysilv authored Apr 17, 2023
1 parent e693d46 commit b818d34
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions demonstrations/tutorial_learning_from_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ def circuit(ts=False):

# the measurement outcomes for the first 3 shots
circuit = generate_circuit(n_shots)
print(circuit(ts=True)[:, 0:3])
print(np.array(circuit(ts=True))[:, 0:3])
print("\n")
print(circuit(ts=False)[:, 0:3])
print(np.array(circuit(ts=False))[:, 0:3])


######################################################################
Expand Down Expand Up @@ -231,6 +231,7 @@ def circuit(ts=False):
def process_data(raw_data):
"convert raw data to vectors of means and variances of each qubit"

raw_data = np.array(raw_data)
nc = len(raw_data) # the number of circuits used to generate the data
nq = len(raw_data[0]) # the number of qubits in each circuit
new_data = np.zeros([nc, 2 * nq])
Expand Down Expand Up @@ -437,7 +438,7 @@ def enhanced_circuit(ts=False):
# If we look at the raw measurement data for the T-symmetric unitaries:
#

raw_data[0][:, 0:5] # outcomes of first 5 shots of the first T-symmetric circuit
np.array(raw_data[0])[:, 0:5] # outcomes of first 5 shots of the first T-symmetric circuit


######################################################################
Expand Down

0 comments on commit b818d34

Please sign in to comment.