Skip to content
Pasqal Documentation

CoherentResults

class pulser_simulation.simresults.CoherentResults(run_output, size, basis_name, sim_times, meas_basis, meas_errors=None)

Bases: SimulationResults[QutipResult]

Results of a coherent simulation run of a pulse sequence.

Contains methods for studying the states and extracting useful information from them.

Attributes

states

List of qutip.Qobj for each state in the simulation.

Methods

count

expect

Returns the expectation values of operators in obs_list.

get_final_state

Returns the final state of the simulation.

get_state

Get the state at time t of the simulation.

index

Raises ValueError if the value is not present.

plot

Plots the expectation value of a given operator op.

sample_final_state

Returns the result of multiple measurements of the final state.

sample_state

Returns the result of multiple measurements at time t.

Signatures

count(value) integer -- return number of occurrences of value
expect(obs_list)

Returns the expectation values of operators in obs_list.

Parameters:

obs_list (Sequence[Qobj | ArrayLike]) – Input observable list. ArrayLike objects will be converted to qutip.Qobj.

Return type:

list[float | complex | ArrayLike]

Returns:

Expectation values of obs_list.

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

Returns the final state of the simulation.

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, 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 final state.

Raises:
  • If trying to reduce to a basis that would eliminate states with

  • significant occupation probabilites.

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

Get the state at time t of the simulation.

Parameters:
  • t (float) – Time (in µs) at which to return the state.

  • 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.

  • t_tol (float, default: 0.001) – Tolerance for the difference between t and closest time.

Return type:

Qobj

Returns:

The resulting state at time t.

Raises:

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

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

plot(op, fmt='', label='')

Plots the expectation value of a given operator op.

Parameters:
  • op (Qobj) – Operator whose expectation value is wanted.

  • fmt (str, default: '') – Curve plot format.

  • label (str, default: '') – Curve label.

Return type:

None

sample_final_state(N_samples=1000)

Returns the result of multiple measurements of the final state.

Parameters:

N_samples (int, default: 1000) – Number of samples to return.

Return type:

Counter

Returns:

Sample distribution of bitstrings corresponding to measured quantum states at the end of the simulation.

sample_state(t, n_samples=1000, t_tol=0.001)

Returns the result of multiple measurements at time t.

Parameters:
  • t (float) – Time (in µs) at which the state is sampled.

  • n_samples (int, default: 1000) – Number of samples to return.

  • t_tol (float, default: 0.001) – Tolerance for the difference between t and closest time.

Return type:

Counter

Returns:

Sample distribution of bitstrings corresponding to measured quantum states at time t.

property states: list[Qobj]

List of qutip.Qobj for each state in the simulation.