SampledResult
- class pulser.result.SampledResult(atom_order, meas_basis, bitstring_counts, evaluation_time=1.0)
Bases:
Result
Represents the result of a run from a series of samples.
- Parameters:
atom_order (
tuple
[str
,...
]) – The order of the atoms in the bitstrings that represent the measured states.meas_basis (
str
) – The measurement basis.bitstring_counts (
dict
[str
,int
]) – The number of times each bitstring was measured.evaluation_time (
float
, default:1.0
) – Relative time at which the samples were taken.
Attributes
evaluation_time
Sampling distribution of the measured bitstring.
The sampling error associated to each bitstring's sampling rate.
total_duration
bitstring_counts
meas_basis
atom_order
Methods
Deserializes a Results object from json.
Get the a specific result at a given time.
Get a list of results tags present in this object.
Get a list of times for which the given result has been stored.
Takes multiple samples from the sampling distribution.
Gets the quantum state associated with the result.
Gets the results for every tag.
Plots the result in an histogram.
Serializes this object into a json string.
Signatures
- classmethod from_abstract_repr(repr)
Deserializes a Results object from json.
- Return type:
- 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()
Gets the quantum state associated with the result.
Can only be defined for emulation results that don’t resort to sampling a quantum state (which is the case for certain types of noise).
- Return type:
Any
- 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
- 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.