QsysShot#

class hugr.qsystem.result.QsysShot(entries: Iterable[TaggedResult] | None = None)[source]#

Bases: object

Results from a single shot execution.

Methods

append

as_dict

Convert results to a dictionary.

collate_tags

Collate all the entries with the same tag in to a dictionary with a list containing all the data for that tag.

to_register_bits

Convert results to a dictionary of register bit values.

Attributes

entries

as_dict() dict[str, int | float | bool | list[int | float | bool]][source]#

Convert results to a dictionary.

For duplicate tags, the last value is used.

Returns:

A dictionary where the keys are the tags and the values are the data.

Return type:

dict

Example

>>> results = QsysShot()
>>> results.append("tag1", 1)
>>> results.append("tag2", 2)
>>> results.append("tag2", 3)
>>> results.as_dict()
{'tag1': 1, 'tag2': 3}
collate_tags() dict[str, list[int | float | bool | list[int | float | bool]]][source]#

Collate all the entries with the same tag in to a dictionary with a list containing all the data for that tag.

to_register_bits() dict[str, str][source]#

Convert results to a dictionary of register bit values.