Skip to content
Pasqal Documentation

Results are limited to the current section : pulser

QutipResult

class pulser_simulation.qutip_result.QutipResult(atom_order, meas_basis, state, matching_meas_basis, evaluation_time=1.0)

Bases: Result

Represents the result of a run as a Qutip QObj.

Parameters:
  • atom_order (tuple[str, ...]) – The order of the atoms in the bitstrings that represent the measured states.

  • meas_basis (str) – The measurement basis.

  • state (Qobj) – The Qobj representing the state. Can be a statevector or a density matrix.

  • matching_meas_basis (bool) – Whether the measurement basis is the same as the state’s basis.

Attributes

evaluation_time

final_bitstrings

The bitstrings at the end of the sequence, if available.

final_state

The state at the end of the sequence, if available.

sampling_dist

Sampling distribution of the measured bitstring.

sampling_errors

The sampling error associated to each bitstring's sampling rate.

total_duration

The total duration of the sequence, in ns.

state

matching_meas_basis

meas_basis

atom_order

The order of the atoms/qudits in the results.

Methods

aggregate

Aggregate a Sequence of Results objects into a single Results.

from_abstract_repr

Deserializes a Results object from json.

get_result

Get the a specific result at a given time.

get_result_tags

Get a list of results tags present in this object.

get_result_times

Get a list of times for which the given result has been stored.

get_samples

Takes multiple samples from the sampling distribution.

get_state

Gets the state with some optional post-processing.

get_tagged_results

Gets the results for every tag.

plot_histogram

Plots the result in an histogram.

to_abstract_repr

Serializes this object into a json string.

Signatures

classmethod aggregate(results_to_aggregate, **aggregation_functions)

Aggregate a Sequence of Results objects into a single Results.

This is meant to accumulate the results of several runs with different noise trajectories into a single averaged Results. By default, results are averaged, with the exception of BitStrings, where the counters are joined. StateResult and EnergyVariance are not supported by default.

Warning

The ability to access a result from an observable instance (e.g. via Results.get_result(obs)) is only preserved if all aggregated results originated from the same observable instance. When that is not the case, the aggregated result can still be accessed via the observable’s tag.

Parameters:

results_to_aggregate (Sequence[Results]) – The list of Results to aggregate

Keyword Arguments:

observable_tag – Overrides the default aggregator. The argument name should be the tag of the Observable. The value is a Callable taking a list of the type to aggregate. Note that this does not override the default aggregation behaviour of the aggregated results.

Return type:

Results

Returns:

The averaged Results object

classmethod from_abstract_repr(repr)

Deserializes a Results object from json.

Return type:

Results

Returns:

The deserialized Results object.

get_result(observable, time)

Get the a specific result at a given time.

Parameters:
  • observable (Observable | str) – The observable instance used to calculate the result or its tag.

  • time (float) – Relative time at which to get the result.

Return type:

Any

Returns:

The result.

get_result_tags()

Get a list of results tags present in this object.

Return type:

list[str]

get_result_times(observable)

Get a list of times for which the given result has been stored.

Parameters:

observable (Observable | str) – The observable instance used to calculate the result or its tag.

Return type:

list[float]

Returns:

List of relative times.

get_samples(n_samples)

Takes multiple samples from the sampling distribution.

Parameters:

n_samples (int) – Number of samples to return.

Return type:

Counter[str]

Returns:

Samples of bitstrings corresponding to measured quantum states.

get_state(reduce_to_basis=None, ignore_global_phase=True, tol=1e-06, normalize=True)

Gets the state with some optional post-processing.

Parameters:
  • reduce_to_basis (str | None, default: None) – Reduces the full state vector to the given basis (“ground-rydberg”, “digital” or “XY”), if the population of the states to be ignored is negligible.

  • ignore_global_phase (bool, default: True) – If True and if the final state is a vector, changes the final state’s global phase such that the largest term (in absolute value) is real.

  • tol (float, default: 1e-06) – Maximum allowed population of each eliminated state.

  • normalize (bool, default: True) – Whether to normalize the reduced state.

Return type:

Qobj

Returns:

The resulting state.

Raises:

TypeError – If trying to reduce to a basis that would eliminate states with significant occupation probabilites.

get_tagged_results()

Gets the results for every tag.

Return type:

dict[str, list[Any]]

Returns:

A mapping between a tag and the results associated to it, at every evaluation time.

plot_histogram(min_rate=0.001, max_n_bitstrings=None, show=True)

Plots the result in an histogram.

Parameters:
  • min_rate (float, default: 0.001) – The minimum sampling rate a bitstring must have to be displayed.

  • max_n_bitstrings (int | None, default: None) – An optional limit on the number of bitrstrings displayed.

  • show (bool, default: True) – Whether or not to call plt.show() before returning.

Return type:

None

to_abstract_repr(skip_validation=False)

Serializes this object into a json string.

Numpy arrays and torch Tensors are converted into lists, and their original class is lost forever.

Parameters:

skip_validation (bool, default: False) – Whether to skip validating the json against the schema used for deserialization.

Return type:

str

Returns:

The json string

atom_order: tuple[str, ...]

The order of the atoms/qudits in the results.

property final_bitstrings: dict[str, int]

The bitstrings at the end of the sequence, if available.

property final_state: State

The state at the end of the sequence, if available.

property sampling_dist: dict[str, float]

Sampling distribution of the measured bitstring.

Parameters:
  • atom_order – The order of the atoms in the bitstrings that represent the measured states.

  • meas_basis – The measurement basis.

property sampling_errors: dict[str, float]

The sampling error associated to each bitstring’s sampling rate.

Uses the standard error of the mean as a quantifier for sampling error.

total_duration: int = 0

The total duration of the sequence, in ns.