cunqa.result.Result
- class cunqa.result.Result(result: dict, circ_id: str, registers: dict)
Bases:
object
Class to describe the result of a simulation.
It has two main attributes:
Result.counts
: returns the distribution of counts from the sampling of the simulation.>>> result.counts {'000':34, '111':66}
Note
If the circuit sent has more than one classical register, bit strings corresponding to each one of them will be separated by blank spaces in the order they were added:
>>> result.counts {'001 11':23, '110 10':77}
Result.time_taken
: the time that the simulation took.>>> result.time_taken 0.056
Nevertheless, depending on the simulator used, more output data is provided. For checking all the information from the simulation as a
dict
, one can access the attributeResult.result
.If an error occurs at the simulation, an exception will be raised at the pyhton program,
ResultError
.
Attributes
|
Counts distribution from the sampling of the simulation, format is |
|
Raw output of the simulation, the |
|
Time that the simulation took in seconds, since it is recieved at the virtual QPU until it is finished. |
Methods
- Result.__init__(result: dict, circ_id: str, registers: dict)
Initializes the Result class.
- Parameters:
result (
dict
) – dictionary given as the output of the simulation.circ_id (
str
) – circuit identificator.registers (
dict
) – dictionary specifying the classical registers defined for the circuit. This is neccessary for the correct formating of the counts bit strings.