JobResult#
- class JobResult(counts: Sequence[dict], **kwargs)[source]#
Wraps the outcome of one or more circuit executions.
Counts are stored as a list with one dictionary per input circuit, preserving the input order.
- Parameters:
- countslist[dict]
A list of measurement-outcome dictionaries, one per circuit. Keys and values can be of any type, as determined by the user.
- **kwargs
Optional backend-specific metadata associated with the execution.
Examples
Let’s start with a simple example of a single circuit result:
>>> from qrisp.interface.job import JobResult >>> result = JobResult([{"00": 512, "11": 512}]) >>> result.get_counts() {"00": 512, "11": 512}
For batch executions, we can store results for multiple circuits in a single object:
>>> result = JobResult([{"0": 800, "1": 224}, {"00": 500, "11": 524}]) >>> result.all_counts [{'0': 800, '1': 224}, {'00': 500, '11': 524}]
Even in this case, we can access individual circuit results using the
get_counts()method:>>> result.get_counts(1) {'00': 500, '11': 524}
Note that we can retrieve the number of circuits in the result using the
num_circuitsproperty:>>> result.num_circuits 2
Finally, we can print the result object to see a summary of its contents:
>>> print(result) JobResult(num_circuits=2, metadata={})
Properties#
All measurement-outcome counts, one dict per circuit. |
|
Number of circuits whose results are stored in this object. |
Methods#
|
Initialize a JobResult instance. |
|
Return the measurement-outcome counts for a single circuit. |