Skip to content

Commit

Permalink
Add Results.get_tagged_results()
Browse files Browse the repository at this point in the history
  • Loading branch information
HGSilveri committed Dec 13, 2024
1 parent 28c9c57 commit 67da4ae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pulser-core/pulser/backend/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ def get_result(self, observable: Observable | str, time: float) -> Any:
f"{observable!r} is not available at time {time}."
)

def get_tagged_results(self) -> dict[str, dict[float, Any]]:
"""Gets the results for every tag.
Returns:
A mapping between a tag and the results associated to it,
at every evaluation time.
"""
return {
tag: dict(self._results[uuid_])
for tag, uuid_ in self._tagmap.items()
}

def _find_uuid(self, observable: Observable | str) -> uuid.UUID:
if isinstance(observable, Observable):
return observable.uuid
Expand Down

0 comments on commit 67da4ae

Please sign in to comment.