qiskit.ignis.measurement.DiscriminationFilter
class DiscriminationFilter(discriminator, base=None)
Implements a filter based on a discriminator that takes level 1 data to level 2 data.
Usage:
my_filter = DiscriminationFilter(my_discriminator) new_result = filter.apply(level_1_data)
Parameters
- discriminator (BaseDiscriminationFitter) – a discriminator that maps level 1 data to level 2 data. - Level 1 data may correspond to, e. g., IQ data. - Level 2 data is the state counts.
- base (
Optional
[int
]) – the base of the expected states. If it is not given the base is inferred from the expected_state instance of discriminator.
__init__
__init__(discriminator, base=None)
Parameters
- discriminator (BaseDiscriminationFitter) – a discriminator that maps level 1 data to level 2 data. - Level 1 data may correspond to, e. g., IQ data. - Level 2 data is the state counts.
- base (
Optional
[int
]) – the base of the expected states. If it is not given the base is inferred from the expected_state instance of discriminator.
Methods
__init__ (discriminator[, base]) | type discriminatorBaseDiscriminationFitter |
apply (raw_data) | Create a new result from the raw_data by converting level 1 data to level 2 data. |
count (y_data) | Converts discriminated results into raw counts. |
get_base (expected_states) | Returns the base inferred from expected_states. |
apply
apply(raw_data)
Create a new result from the raw_data by converting level 1 data to level 2 data.
Parameters
raw_data (Result
) – list of qiskit.Result or qiskit.Result.
Return type
Result
Returns
A list of qiskit.Result or qiskit.Result.
count
count(y_data)
Converts discriminated results into raw counts.
Parameters
y_data (List
[str
]) – result of a discrimination.
Return type
dict
Returns
A dict of raw counts.
get_base
static get_base(expected_states)
Returns the base inferred from expected_states.
The intent is to allow users to discriminate states higher than 0/1.
DiscriminationFilter infers the basis from the expected states to allow users to discriminate states outside of the computational sub-space. For example, if the discriminated states are 00, 01, 02, 10, 11, …, 22 the basis will be 3.
With this implementation the basis can be at most 10.
Parameters
expected_states (dict
) –
Returns
the base inferred from the expected states
Return type
int
Raises
QiskitError – if there is an invalid input in the expected states