better ordered formatting of results
This commit is contained in:
parent
53f4c3e628
commit
82889436bb
@ -57,12 +57,16 @@ def test_krisi_measurement_2():
|
||||
|
||||
|
||||
def test_krisi_measurement_3():
|
||||
iterations = 400
|
||||
beta = np.pi * 0.62
|
||||
|
||||
CASE_ID_ID = "id_id"
|
||||
CASE_ID_ORT = "id_ort"
|
||||
CASE_ORT_ID = "ort_id"
|
||||
CASE_ORT_ORT = "ort_ort"
|
||||
|
||||
beta = 0
|
||||
case_choices = [CASE_ID_ID, CASE_ID_ORT, CASE_ORT_ID, CASE_ORT_ORT]
|
||||
|
||||
b_0 = State(1 / np.sqrt(2) * (s("|100>") - s("|010>")))
|
||||
b_1 = State(1 / np.sqrt(2) * (s("|011>") - s("|101>")))
|
||||
basis = [
|
||||
@ -112,7 +116,8 @@ def test_krisi_measurement_3():
|
||||
def krisi_3_format_results(results):
|
||||
all_pos = generate_bins(8)
|
||||
print("Results:")
|
||||
for case, rv in results.items():
|
||||
for case in case_choices:
|
||||
rv = results.get(case)
|
||||
print("{}:".format(case))
|
||||
print(" raw : {}".format(sorted(rv.items())))
|
||||
case_total = sum(rv.values())
|
||||
@ -123,8 +128,8 @@ def test_krisi_measurement_3():
|
||||
print(" {} : {:3d} ({:.2f}%)".format(pos, value, percent))
|
||||
|
||||
results = defaultdict(lambda: defaultdict(int))
|
||||
for i in range(1000):
|
||||
case = random.choice([CASE_ID_ID, CASE_ID_ORT, CASE_ORT_ID, CASE_ORT_ORT])
|
||||
for i in range(iterations):
|
||||
case = random.choice(case_choices)
|
||||
result = perform_exp(case=case)
|
||||
results[case][result] += 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user