- class Counts(data, time_taken=None, creg_sizes=None, memory_slots=None)[código fonte]¶
A class to store a counts result from a circuit execution.
Build a counts object
data (dict) –
The dictionary input for the counts. Where the keys represent a measured classical value and the value is an integer the number of shots with that result. The keys can be one of several formats:
A hexadecimal string of the form
A bit string prefixed with
A bit string formatted across register and memory slots. For example,
A dit string, for example
'02'. Note for objects created with dit strings the
memory_slotskwargs don’t work and
int_outcomes()also do not work.
time_taken (float) – The duration of the experiment that generated the counts in seconds.
creg_sizes (list) – a nested list where the inner element is a list of tuples containing both the classical register name and classical register size. For example,
[('c_reg', 2), ('my_creg', 4)].
memory_slots (int) – The number of total
memory_slotsin the experiment.
TypeError – If the input key type is not an
QiskitError – If a dit string key is input with
Create a new dictionary with keys from iterable and values set to value.
Return the value for key if key is in the dictionary, else default.
Return a counts dictionary with hexadecimal string keys
Build a counts dictionary with integer keys instead of count strings
Return the most frequent count
If key is not found, d is returned if given, otherwise KeyError is raised
Remove and return a (key, value) pair as a 2-tuple.
Insert key with a value of default if key is not in the dictionary.
Return the number of shots
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- bitstring_regex = re.compile('^[01\\s]+$')¶