-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathtest_randomized_benchmarking.py
600 lines (499 loc) · 22.4 KB
/
test_randomized_benchmarking.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
# This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""Test for randomized benchmarking experiments."""
from test.base import QiskitExperimentsTestCase
import numpy as np
from ddt import ddt, data, unpack
from qiskit.circuit import Delay, QuantumCircuit
from qiskit.circuit.library import SXGate, CXGate, TGate, XGate
from qiskit.exceptions import QiskitError
from qiskit.providers.aer import AerSimulator
from qiskit.providers.aer.noise import NoiseModel, depolarizing_error
from qiskit.quantum_info import Clifford
from qiskit_experiments.library import randomized_benchmarking as rb
from qiskit_experiments.database_service.exceptions import ExperimentEntryNotFound
class RBTestCase(QiskitExperimentsTestCase):
"""Base test case for randomized benchmarking defining a common noise model."""
def setUp(self):
"""Setup the tests."""
super().setUp()
# depolarizing error
self.p1q = 0.02
self.p2q = 0.10
self.pvz = 0.0
# basis gates
self.basis_gates = ["sx", "rz", "cx"]
# setup noise model
sx_error = depolarizing_error(self.p1q, 1)
rz_error = depolarizing_error(self.pvz, 1)
cx_error = depolarizing_error(self.p2q, 2)
noise_model = NoiseModel()
noise_model.add_all_qubit_quantum_error(sx_error, "sx")
noise_model.add_all_qubit_quantum_error(rz_error, "rz")
noise_model.add_all_qubit_quantum_error(cx_error, "cx")
self.noise_model = noise_model
# Need level1 for consecutive gate cancellation for reference EPC value calculation
self.transpiler_options = {
"basis_gates": self.basis_gates,
"optimization_level": 1,
}
# Aer simulator
self.backend = AerSimulator(noise_model=noise_model, seed_simulator=123)
def assertAllIdentity(self, circuits):
"""Test if all experiment circuits are identity."""
for circ in circuits:
num_qubits = circ.num_qubits
iden = Clifford(np.eye(2 * num_qubits, dtype=bool))
circ.remove_final_measurements()
self.assertEqual(
Clifford(circ), iden, f"Circuit {circ.name} doesn't result in the identity matrix."
)
@ddt
class TestStandardRB(RBTestCase):
"""Test for standard RB."""
def test_single_qubit(self):
"""Test single qubit RB."""
exp = rb.StandardRB(
qubits=(0,),
lengths=list(range(1, 300, 30)),
seed=123,
backend=self.backend,
)
exp.analysis.set_options(gate_error_ratio=None)
exp.set_transpile_options(**self.transpiler_options)
self.assertAllIdentity(exp.circuits())
expdata = exp.run()
self.assertExperimentDone(expdata)
# Given we have gate number per Clifford n_gpc, we can compute EPC as
# EPC = 1 - (1 - r)^n_gpc
# where r is gate error of SX gate, i.e. dep-parameter divided by 2.
# We let transpiler use SX and RZ.
# The number of physical gate per Clifford will distribute
# from 0 to 2, i.e. arbitrary U gate can be decomposed into up to 2 SX with RZs.
# We may want to expect the average number of SX is (0 + 1 + 2) / 3 = 1.0.
epc = expdata.analysis_results("EPC")
epc_expected = 1 - (1 - 1 / 2 * self.p1q) ** 1.0
self.assertAlmostEqual(epc.value.n, epc_expected, delta=0.1 * epc_expected)
def test_two_qubit(self):
"""Test two qubit RB."""
exp = rb.StandardRB(
qubits=(0, 1),
lengths=list(range(1, 30, 3)),
seed=123,
backend=self.backend,
)
exp.analysis.set_options(gate_error_ratio=None)
exp.set_transpile_options(**self.transpiler_options)
self.assertAllIdentity(exp.circuits())
expdata = exp.run()
self.assertExperimentDone(expdata)
# Given CX error is dominant and 1q error can be negligible.
# Arbitrary SU(4) can be decomposed with (0, 1, 2, 3) CX gates, the expected
# average number of CX gate per Clifford is 1.5.
# Since this is two qubit RB, the dep-parameter is factored by 3/4.
epc = expdata.analysis_results("EPC")
# Allow for 50 percent tolerance since we ignore 1q gate contribution
epc_expected = 1 - (1 - 3 / 4 * self.p2q) ** 1.5
self.assertAlmostEqual(epc.value.n, epc_expected, delta=0.5 * epc_expected)
def test_add_more_circuit_yields_lower_variance(self):
"""Test variance reduction with larger number of sampling."""
exp1 = rb.StandardRB(
qubits=(0, 1),
lengths=list(range(1, 30, 3)),
seed=123,
backend=self.backend,
num_samples=3,
)
exp1.analysis.set_options(gate_error_ratio=None)
exp1.set_transpile_options(**self.transpiler_options)
expdata1 = exp1.run()
self.assertExperimentDone(expdata1)
exp2 = rb.StandardRB(
qubits=(0, 1),
lengths=list(range(1, 30, 3)),
seed=456,
backend=self.backend,
num_samples=5,
)
exp2.analysis.set_options(gate_error_ratio=None)
exp2.set_transpile_options(**self.transpiler_options)
expdata2 = exp2.run()
self.assertExperimentDone(expdata2)
self.assertLess(
expdata2.analysis_results("EPC").value.s,
expdata1.analysis_results("EPC").value.s,
)
def test_poor_experiment_result(self):
"""Test edge case that tail of decay is not sampled.
This is a special case that fit outcome is very sensitive to initial guess.
Perhaps generated initial guess is close to a local minima.
"""
from qiskit.providers.fake_provider import FakeVigoV2
backend = FakeVigoV2()
exp = rb.StandardRB(
qubits=(0,),
lengths=[100, 200, 300, 400],
seed=123,
backend=backend,
num_samples=5,
)
exp.set_transpile_options(basis_gates=["x", "sx", "rz"], optimization_level=1)
# Simulator seed must be fixed. This can be set via run option with FakeBackend.
# pylint: disable=no-member
exp.set_run_options(seed_simulator=456)
expdata = exp.run()
self.assertExperimentDone(expdata)
overview = expdata.analysis_results(0).value
# This yields bad fit due to poor data points, but still fit is not completely off.
self.assertLess(overview.reduced_chisq, 10)
def test_return_same_circuit(self):
"""Test if setting the same seed returns the same circuits."""
exp1 = rb.StandardRB(
qubits=(0, 1),
lengths=[10, 20, 30],
seed=123,
backend=self.backend,
)
exp2 = rb.StandardRB(
qubits=(0, 1),
lengths=[10, 20, 30],
seed=123,
backend=self.backend,
)
circs1 = exp1.circuits()
circs2 = exp2.circuits()
self.assertEqual(circs1[0].decompose(), circs2[0].decompose())
self.assertEqual(circs1[1].decompose(), circs2[1].decompose())
self.assertEqual(circs1[2].decompose(), circs2[2].decompose())
def test_full_sampling(self):
"""Test if full sampling generates different circuits."""
exp1 = rb.StandardRB(
qubits=(0, 1),
lengths=[10, 20, 30],
seed=123,
backend=self.backend,
full_sampling=False,
)
exp2 = rb.StandardRB(
qubits=(0, 1),
lengths=[10, 20, 30],
seed=123,
backend=self.backend,
full_sampling=True,
)
circs1 = exp1.circuits()
circs2 = exp2.circuits()
self.assertEqual(circs1[0].decompose(), circs2[0].decompose())
# fully sampled circuits are regenerated while other is just built on top of previous length
self.assertNotEqual(circs1[1].decompose(), circs2[1].decompose())
self.assertNotEqual(circs1[2].decompose(), circs2[2].decompose())
@data(
{"qubits": [3, 3], "lengths": [1, 3, 5, 7, 9], "num_samples": 1, "seed": 100},
{"qubits": [0, 1], "lengths": [1, 3, 5, -7, 9], "num_samples": 1, "seed": 100},
{"qubits": [0, 1], "lengths": [1, 3, 5, 7, 9], "num_samples": -4, "seed": 100},
{"qubits": [0, 1], "lengths": [1, 3, 5, 7, 9], "num_samples": 0, "seed": 100},
{"qubits": [0, 1], "lengths": [1, 5, 5, 5, 9], "num_samples": 2, "seed": 100},
)
def test_invalid_configuration(self, configs):
"""Test raise error when creating experiment with invalid configs."""
self.assertRaises(QiskitError, rb.StandardRB, **configs)
def test_experiment_config(self):
"""Test converting to and from config works"""
exp = rb.StandardRB(qubits=(0,), lengths=[10, 20, 30], seed=123)
loaded_exp = rb.StandardRB.from_config(exp.config())
self.assertNotEqual(exp, loaded_exp)
self.assertTrue(self.json_equiv(exp, loaded_exp))
def test_roundtrip_serializable(self):
"""Test round trip JSON serialization"""
exp = rb.StandardRB(qubits=(0,), lengths=[10, 20, 30], seed=123)
self.assertRoundTripSerializable(exp, self.json_equiv)
def test_analysis_config(self):
""" "Test converting analysis to and from config works"""
analysis = rb.RBAnalysis()
loaded = rb.RBAnalysis.from_config(analysis.config())
self.assertNotEqual(analysis, loaded)
self.assertEqual(analysis.config(), loaded.config())
def test_expdata_serialization(self):
"""Test serializing experiment data works."""
exp = rb.StandardRB(
qubits=(0,),
lengths=list(range(1, 200, 50)),
seed=123,
backend=self.backend,
)
exp.set_transpile_options(**self.transpiler_options)
expdata = exp.run()
self.assertExperimentDone(expdata)
self.assertRoundTripSerializable(expdata, check_func=self.experiment_data_equiv)
self.assertRoundTripPickle(expdata, check_func=self.experiment_data_equiv)
@ddt
class TestInterleavedRB(RBTestCase):
"""Test for interleaved RB."""
@data([XGate(), [3], 4], [CXGate(), [4, 7], 5])
@unpack
def test_interleaved_structure(self, interleaved_element, qubits, length):
"""Verifies that when generating an interleaved circuit, it will be
identical to the original circuit up to additions of
barrier and interleaved element between any two Cliffords.
"""
exp = rb.InterleavedRB(
interleaved_element=interleaved_element, qubits=qubits, lengths=[length], num_samples=1
)
circuits = exp.circuits()
c_std = circuits[0]
c_int = circuits[1]
if c_std.metadata["interleaved"]:
c_std, c_int = c_int, c_std
num_cliffords = c_std.metadata["xval"]
std_idx = 0
int_idx = 0
for _ in range(num_cliffords):
# barrier
self.assertEqual(c_std[std_idx][0].name, "barrier")
self.assertEqual(c_int[int_idx][0].name, "barrier")
# clifford
self.assertEqual(c_std[std_idx + 1], c_int[int_idx + 1])
# for interleaved circuit: barrier + interleaved element
self.assertEqual(c_int[int_idx + 2][0].name, "barrier")
self.assertEqual(c_int[int_idx + 3][0].name, interleaved_element.name)
std_idx += 2
int_idx += 4
def test_single_qubit(self):
"""Test single qubit IRB."""
exp = rb.InterleavedRB(
interleaved_element=SXGate(),
qubits=(0,),
lengths=list(range(1, 300, 30)),
seed=123,
backend=self.backend,
)
exp.set_transpile_options(**self.transpiler_options)
self.assertAllIdentity(exp.circuits())
expdata = exp.run()
self.assertExperimentDone(expdata)
# Since this is interleaved, we can directly compare values, i.e. n_gpc = 1
epc = expdata.analysis_results("EPC")
epc_expected = 1 / 2 * self.p1q
self.assertAlmostEqual(epc.value.n, epc_expected, delta=0.1 * epc_expected)
def test_two_qubit(self):
"""Test two qubit IRB."""
exp = rb.InterleavedRB(
interleaved_element=CXGate(),
qubits=(0, 1),
lengths=list(range(1, 30, 3)),
seed=123,
backend=self.backend,
)
exp.set_transpile_options(**self.transpiler_options)
self.assertAllIdentity(exp.circuits())
expdata = exp.run()
self.assertExperimentDone(expdata)
# Since this is interleaved, we can directly compare values, i.e. n_gpc = 1
epc = expdata.analysis_results("EPC")
epc_expected = 3 / 4 * self.p2q
self.assertAlmostEqual(epc.value.n, epc_expected, delta=0.1 * epc_expected)
def test_non_clifford_interleaved_element(self):
"""Verifies trying to run interleaved RB with non Clifford element throws an exception"""
qubits = 1
lengths = [1, 4, 6, 9, 13, 16]
interleaved_element = TGate() # T gate is not Clifford, this should fail
self.assertRaises(
QiskitError,
rb.InterleavedRB,
interleaved_element=interleaved_element,
qubits=qubits,
lengths=lengths,
)
def test_interleaving_delay(self):
"""Test delay instruction can be interleaved."""
# See qiskit-experiments/#727 for details
interleaved_element = Delay(10, unit="us")
exp = rb.InterleavedRB(
interleaved_element,
qubits=[0],
lengths=[1],
num_samples=1,
)
# Not raises an error
_, int_circ = exp.circuits()
# barrier, clifford, barrier, "delay", barrier, ...
self.assertEqual(int_circ.data[3][0], interleaved_element)
def test_interleaving_circuit_with_delay(self):
"""Test circuit with delay can be interleaved."""
delay_qc = QuantumCircuit(2)
delay_qc.delay(10, [0], unit="us")
delay_qc.x(1)
exp = rb.InterleavedRB(
interleaved_element=delay_qc, qubits=[1, 2], lengths=[1], seed=123, num_samples=1
)
_, int_circ = exp.circuits()
qc = QuantumCircuit(2)
qc.x(1)
expected_inversion = Clifford(int_circ.data[1][0]).compose(qc).adjoint()
# barrier, clifford, barrier, "interleaved circuit", barrier, inversion, ...
self.assertEqual(expected_inversion, Clifford(int_circ.data[5][0]))
def test_experiment_config(self):
"""Test converting to and from config works"""
exp = rb.InterleavedRB(
interleaved_element=SXGate(), qubits=(0,), lengths=[10, 20, 30], seed=123
)
loaded_exp = rb.InterleavedRB.from_config(exp.config())
self.assertNotEqual(exp, loaded_exp)
self.assertTrue(self.json_equiv(exp, loaded_exp))
def test_roundtrip_serializable(self):
"""Test round trip JSON serialization"""
exp = rb.InterleavedRB(
interleaved_element=SXGate(), qubits=(0,), lengths=[10, 20, 30], seed=123
)
self.assertRoundTripSerializable(exp, self.json_equiv)
def test_analysis_config(self):
""" "Test converting analysis to and from config works"""
analysis = rb.InterleavedRBAnalysis()
loaded = rb.InterleavedRBAnalysis.from_config(analysis.config())
self.assertNotEqual(analysis, loaded)
self.assertEqual(analysis.config(), loaded.config())
def test_expdata_serialization(self):
"""Test serializing experiment data works."""
exp = rb.InterleavedRB(
interleaved_element=SXGate(),
qubits=(0,),
lengths=list(range(1, 200, 50)),
seed=123,
backend=self.backend,
)
exp.set_transpile_options(**self.transpiler_options)
expdata = exp.run()
self.assertExperimentDone(expdata)
self.assertRoundTripSerializable(expdata, check_func=self.experiment_data_equiv)
self.assertRoundTripPickle(expdata, check_func=self.experiment_data_equiv)
class TestEPGAnalysis(QiskitExperimentsTestCase):
"""Test case for EPG calculation from EPC.
EPG and depolarizing probability p are assumed to have following relationship
EPG = (2^n - 1) / 2^n · p
This p is provided to the Aer noise model, thus we verify EPG computation
by comparing the value with the depolarizing probability.
"""
def setUp(self):
"""Setup the tests."""
super().setUp()
# Setup noise model, including more gate for complicated EPG computation
# Note that 1Q channel error is amplified to check 1q channel correction mechanism
x_error = depolarizing_error(0.04, 1)
h_error = depolarizing_error(0.02, 1)
s_error = depolarizing_error(0.00, 1)
cx_error = depolarizing_error(0.08, 2)
noise_model = NoiseModel()
noise_model.add_all_qubit_quantum_error(x_error, "x")
noise_model.add_all_qubit_quantum_error(h_error, "h")
noise_model.add_all_qubit_quantum_error(s_error, "s")
noise_model.add_all_qubit_quantum_error(cx_error, "cx")
# Need level1 for consecutive gate cancellation for reference EPC value calculation
transpiler_options = {
"basis_gates": ["x", "h", "s", "cx"],
"optimization_level": 1,
}
# Aer simulator
backend = AerSimulator(noise_model=noise_model, seed_simulator=123)
# Prepare experiment data and cache for analysis
exp_1qrb_q0 = rb.StandardRB(
qubits=(0,),
lengths=[1, 10, 30, 50, 80, 120, 150, 200],
seed=123,
backend=backend,
)
exp_1qrb_q0.set_transpile_options(**transpiler_options)
expdata_1qrb_q0 = exp_1qrb_q0.run(analysis=None).block_for_results(timeout=300)
exp_1qrb_q1 = rb.StandardRB(
qubits=(1,),
lengths=[1, 10, 30, 50, 80, 120, 150, 200],
seed=123,
backend=backend,
)
exp_1qrb_q1.set_transpile_options(**transpiler_options)
expdata_1qrb_q1 = exp_1qrb_q1.run(analysis=None).block_for_results(timeout=300)
exp_2qrb = rb.StandardRB(
qubits=(0, 1),
lengths=[1, 3, 5, 10, 15, 20, 30, 50],
seed=123,
backend=backend,
)
exp_2qrb.set_transpile_options(**transpiler_options)
expdata_2qrb = exp_2qrb.run(analysis=None).block_for_results(timeout=300)
self.expdata_1qrb_q0 = expdata_1qrb_q0
self.expdata_1qrb_q1 = expdata_1qrb_q1
self.expdata_2qrb = expdata_2qrb
def test_default_epg_ratio(self):
"""Calculate EPG with default ratio dictionary. H and X have the same ratio."""
analysis = rb.RBAnalysis()
analysis.set_options(outcome="0")
result = analysis.run(self.expdata_1qrb_q0, replace_results=False)
self.assertExperimentDone(result)
s_epg = result.analysis_results("EPG_s")
h_epg = result.analysis_results("EPG_h")
x_epg = result.analysis_results("EPG_x")
self.assertEqual(s_epg.value.n, 0.0)
# H and X gate EPG are assumed to be the same, so this underestimate X and overestimate H
self.assertEqual(h_epg.value.n, x_epg.value.n)
self.assertLess(x_epg.value.n, 0.04 * 0.5)
self.assertGreater(h_epg.value.n, 0.02 * 0.5)
def test_no_epg(self):
"""Calculate no EPGs."""
analysis = rb.RBAnalysis()
analysis.set_options(outcome="0", gate_error_ratio=None)
result = analysis.run(self.expdata_1qrb_q0, replace_results=False)
self.assertExperimentDone(result)
with self.assertRaises(ExperimentEntryNotFound):
result.analysis_results("EPG_s")
with self.assertRaises(ExperimentEntryNotFound):
result.analysis_results("EPG_h")
with self.assertRaises(ExperimentEntryNotFound):
result.analysis_results("EPG_x")
def test_with_custom_epg_ratio(self):
"""Calculate no EPGs with custom EPG ratio dictionary."""
analysis = rb.RBAnalysis()
analysis.set_options(outcome="0", gate_error_ratio={"x": 2, "h": 1, "s": 0})
result = analysis.run(self.expdata_1qrb_q0, replace_results=False)
self.assertExperimentDone(result)
h_epg = result.analysis_results("EPG_h")
x_epg = result.analysis_results("EPG_x")
self.assertAlmostEqual(x_epg.value.n, 0.04 * 0.5, delta=0.005)
self.assertAlmostEqual(h_epg.value.n, 0.02 * 0.5, delta=0.005)
def test_2q_epg(self):
"""Compute 2Q EPG without correction.
Since 1Q gates are designed to have comparable EPG with CX gate,
this will overestimate the error of CX gate.
"""
analysis = rb.RBAnalysis()
analysis.set_options(outcome="00")
result = analysis.run(self.expdata_2qrb, replace_results=False)
self.assertExperimentDone(result)
cx_epg = result.analysis_results("EPG_cx")
self.assertGreater(cx_epg.value.n, 0.08 * 0.75)
def test_correct_1q_depolarization(self):
"""Compute 2Q EPG with 1Q depolarization correction."""
analysis_1qrb_q0 = rb.RBAnalysis()
analysis_1qrb_q0.set_options(outcome="0", gate_error_ratio={"x": 2, "h": 1, "s": 0})
result_q0 = analysis_1qrb_q0.run(self.expdata_1qrb_q0, replace_results=False)
self.assertExperimentDone(result_q0)
analysis_1qrb_q1 = rb.RBAnalysis()
analysis_1qrb_q1.set_options(outcome="0", gate_error_ratio={"x": 2, "h": 1, "s": 0})
result_q1 = analysis_1qrb_q1.run(self.expdata_1qrb_q1, replace_results=False)
self.assertExperimentDone(result_q1)
analysis_2qrb = rb.RBAnalysis()
analysis_2qrb.set_options(
outcome="00",
epg_1_qubit=result_q0.analysis_results() + result_q1.analysis_results(),
)
result_2qrb = analysis_2qrb.run(self.expdata_2qrb)
self.assertExperimentDone(result_2qrb)
cx_epg = result_2qrb.analysis_results("EPG_cx")
self.assertAlmostEqual(cx_epg.value.n, 0.08 * 0.75, delta=0.006)