File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
qiskit_experiments/framework Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1099,11 +1099,19 @@ def _add_result_data(
10991099 if testres .data :
11001100 joined_data = testres .join_data ()
11011101 outer_shape = testres .data .shape
1102- if outer_shape :
1102+ average_params = (
1103+ result [i ]
1104+ .metadata .get ("circuit_metadata" , {})
1105+ .get ("average_params" , False )
1106+ )
1107+ if outer_shape and not (
1108+ average_params and isinstance (joined_data , BitArray )
1109+ ):
11031110 raise QiskitError (
11041111 f"Outer PUB dimensions { outer_shape } found in result. "
11051112 "Only unparameterized PUBs are currently supported by "
1106- "qiskit-experiments."
1113+ "qiskit-experiments unless the circuit metadata "
1114+ "indicates to average them and it used meas_level=2."
11071115 )
11081116 else :
11091117 joined_data = None
@@ -1124,7 +1132,7 @@ def _add_result_data(
11241132 data ["counts" ] = testres .join_data (testres .data .keys ()).get_counts ()
11251133 data ["memory" ] = testres .join_data (testres .data .keys ()).get_bitstrings ()
11261134 # number of shots
1127- data ["shots" ] = joined_data . num_shots
1135+ data ["shots" ] = len ( data [ "memory" ])
11281136 elif isinstance (joined_data , np .ndarray ):
11291137 data ["meas_level" ] = 1
11301138 if joined_data .ndim == 1 :
Original file line number Diff line number Diff line change 1+ ---
2+
3+ features :
4+ - |
5+ Enable averaging PUB parameters in :class:`~.ExperimentData` when
6+ the circuit metadata contain "average_params".
You can’t perform that action at this time.
0 commit comments