qermit.spectral_filtering¶
- qermit.spectral_filtering.spectral_filtering.gen_spectral_filtering_MitEx(backend, n_vals, **kwargs)[source]¶
Generator function for the spectral filtering MitEx. This method acts on symbolic circuits, evaluating the circuit on a grid of symbol values and performing mitigation on the resulting landscape.
- Parameters:
backend (
Backend
) – Backend on which all experiments are run.n_vals (
int
) – The number of values each symbol should take. Each symbol will take n_vals equally spaced values in the range \([0, 2 U+03C0]\). The circuit will be evaluate at every permutation of the symbols evaluated at these points, giving a grid of circuit evaluations.
- Key signal_filter:
Method for filtering the landscape of circuit evaluations. Defaults to SmallCoefficientSignalFilter.
- Return type:
- Returns:
MitEx implementing spectral filtering.
- qermit.spectral_filtering.spectral_filtering.gen_result_extraction_task()[source]¶
Generates task which extracts a result at coordinates specified by symbol values from grid of results.
- Return type:
- Returns:
Task interpolating results.
- qermit.spectral_filtering.spectral_filtering.gen_mitigation_task(signal_filter)[source]¶
Generates task acting signal_filter on the fourier coefficients of a grid of results.
- Parameters:
signal_filter (
SignalFilter
) – Method of filtering the signal.- Return type:
- Returns:
Task performing filtering.
- qermit.spectral_filtering.spectral_filtering.gen_fft_task()[source]¶
Generates task which performs Fast Fourier Transform of grids of values.
- Return type:
- Returns:
Task performing Fast Fourier Transform
- qermit.spectral_filtering.spectral_filtering.gen_ndarray_to_dict_task()[source]¶
Generates task reshaping an array of QubitPauliOperator into a dictionary with QubitPauliStrings as keys and an array of the appropriate coefficients as values.
- Return type:
- Returns:
Task reshaping QubitPauliOperator into a dictionary with QubitPauliStrings as keys and an array of the appropriate coefficients as values.
- qermit.spectral_filtering.spectral_filtering.gen_inv_fft_task()[source]¶
Generates task performing the inverse Fast Fourier Transform on each value in the list of dictionaries.
- Return type:
- Returns:
Task performing Fast Fourier Transform.
- qermit.spectral_filtering.spectral_filtering.gen_flatten_task()[source]¶
Generates task which transforms a list of ndarrays of ObservableExperiments into a list of ObservableExperiments. These ObservableExperiments can then be run in sequence.
- Return type:
- Returns:
Generates task which transforms a list of ndarrays of ObservableExperiments into a list of ObservableExperiments
- qermit.spectral_filtering.spectral_filtering.gen_reshape_task()[source]¶
Generates task which reshapes a list of QubitPauliOperator into a list of ndarrays of QubitPauliOperator. This can be used to have the effect for reversing the task generated by gen_flatten_task.
- Return type:
- Returns:
Task which reshapes a list of QubitPauliOperator into a list of ndarrays of QubitPauliOperator.
- qermit.spectral_filtering.spectral_filtering.gen_obs_exp_grid_gen_task()[source]¶
Generates task creating an ObservableExperiment for each point in the input meshgrid.
- Return type:
- Returns:
Task generating grid of experiments.
- qermit.spectral_filtering.spectral_filtering.gen_symbol_val_gen_task(n_sym_vals)[source]¶
Generates task which produces a grid of values. The values are generated uniformly in the interval [0,2] (factors of pi give full coverage of the Bloch sphere) for each symbol. The points on the grid are equally spaces, and the number of values is the same in each dimension. In the context of the spectral filtering MitEx, the given circuit will be evaluated at each point in the grid. This is to say that the symbols in the circuit will be substituted for the values at each point in the grid.
- qermit.spectral_filtering.spectral_filtering.gen_wire_copy_task(n_in_wires, n_wire_copies)[source]¶
Generates task which copies each of the input wires n_wire_copies times. The output wires are repeated in the same order as the input wires. This is to say that input wires 1,2,…n will be outputted as 1,2,…,n,…,1,2,…n.
- qermit.spectral_filtering.spectral_filtering.gen_param_grid_gen_task()[source]¶
Generates task converting lists of symbol values into a meshgrid.
- Return type:
- Returns:
Task converting list of symbol values into a meshgrid.
- class qermit.spectral_filtering.signal_filter.SmallCoefficientSignalFilter(tol)[source]¶
Child class of SignalFilter which filters results by reducing small Fourier coefficients to 0.
Initialisation method.
- Parameters:
tol (
float
) – Value below which coefficients should be reduced to 0