DiscriminationFilter
class DiscriminationFilter(discriminator, base=None)
Bases: object
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.
Methods
apply
DiscriminationFilter.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
DiscriminationFilter.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 DiscriminationFilter.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