Skip to content
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
536c8dd
Added EG_ATTEMPT and EG_SUCCESS record instances to SingleHeralded
Tw1ZZLER Jun 16, 2026
c5d7e45
MVP of metrics.py
Tw1ZZLER Jun 16, 2026
b8d3f6d
Timeline will register itself as the metrics time provider
Tw1ZZLER Jun 16, 2026
4e8163c
Added tests for metrics (passed)
Tw1ZZLER Jun 16, 2026
1ffd8b1
Changed EG_ATTEMPT to EG_FAILURE
Tw1ZZLER Jun 16, 2026
9118746
Edited metric tests to reflect change to EG_FAILURE
Tw1ZZLER Jun 16, 2026
4f30c4f
Initial entanglement generation experiment to test metrics
Tw1ZZLER Jun 16, 2026
9566e01
Helpful experiment instructions
Tw1ZZLER Jun 16, 2026
a22b1d3
Added support for directly recording throughput from RequestApp
Tw1ZZLER Jun 16, 2026
abb435b
Implemented collect and aggregate trial metrics methods
Tw1ZZLER Jun 16, 2026
0b35df5
Metrics tests for throughput
Tw1ZZLER Jun 16, 2026
a5b4466
Updated experiment to use new collect and aggregate trial metrics met…
Tw1ZZLER Jun 16, 2026
2a9d19c
Adjust throughput to only be recorded by responder
Tw1ZZLER Jun 17, 2026
d7ede60
Avoid NaN values getting returned as throughput
Tw1ZZLER Jun 17, 2026
dfbf1b5
Metrics throughput tests
Tw1ZZLER Jun 17, 2026
01b26c4
Use isfinite to filter out non-finite values such as NaN
Tw1ZZLER Jun 17, 2026
93853c5
Fix for events that are exactly at prep_time + collect_time
Tw1ZZLER Jun 17, 2026
e8fcb12
Extra comments for counters
Tw1ZZLER Jun 17, 2026
9c9d90d
Added EP successes and failures
Tw1ZZLER Jun 18, 2026
118247e
Adjusted test functions for EP
Tw1ZZLER Jun 18, 2026
9a42caf
Metrics logging for BBPSSW
Tw1ZZLER Jun 18, 2026
05089c8
Multiprocessing for eg_experiment
Tw1ZZLER Jun 18, 2026
f74f7bf
Purified delivery metrics
Tw1ZZLER Jun 18, 2026
de2282e
Tests for purified delivery metrics
Tw1ZZLER Jun 18, 2026
efee584
Remove eg_experiment from examples
Tw1ZZLER Jun 18, 2026
773bb1f
Revert "Avoid NaN values getting returned as throughput"
Tw1ZZLER Jun 18, 2026
7093f4b
Reworked Event Types, new file for interface
Tw1ZZLER Jun 19, 2026
3945fb4
Metric registry to make public facing interface for adding new metric…
Tw1ZZLER Jun 19, 2026
bdb9676
Public interface now in __init__ of package
Tw1ZZLER Jun 19, 2026
d52bf43
Update tests for new metrics features
Tw1ZZLER Jun 19, 2026
414707f
Removed EventRecordsMetric
Tw1ZZLER Jun 22, 2026
928fc19
Moved entanglement fail to superclass
Tw1ZZLER Jun 22, 2026
ae75886
Support for BarretKok
Tw1ZZLER Jun 22, 2026
cbd5b00
Revert changes to request_app
Tw1ZZLER Jun 22, 2026
84e5a18
Removed __all__
Tw1ZZLER Jun 22, 2026
3fab5bc
Renamed app ep time to delivery time
Tw1ZZLER Jun 22, 2026
b841a60
Remove throughput related tests
Tw1ZZLER Jun 22, 2026
297bd9e
Added TODO comment to DeliveryTimeMetric
Tw1ZZLER Jun 22, 2026
9f31187
Potential fix for pull request finding 'Unused import'
Tw1ZZLER Jun 22, 2026
864e297
More unused imports
Tw1ZZLER Jun 22, 2026
6ef03a6
Added Swapping equivalents of failures, successes, fidelities metrics
Tw1ZZLER Jun 24, 2026
b11ffb7
Equivalent test functions for new swapping metrics
Tw1ZZLER Jun 24, 2026
2c2bebb
Finish metrics recording for purification
Tw1ZZLER Jun 24, 2026
22b1b28
Implemented metrics recording for swapping
Tw1ZZLER Jun 24, 2026
a3a4c5f
Merge branch 'master' into metrics
hayekr Jun 26, 2026
ea6e172
Changed ruff formatter line length to 120
Tw1ZZLER Jun 29, 2026
25a87a8
Reformatted metrics files with line length 120
Tw1ZZLER Jun 29, 2026
ac36b98
Removed some trailing commas and reformatted so args fit on one line
Tw1ZZLER Jun 29, 2026
f58c12f
Renamed most of the metrics to better names
Tw1ZZLER Jun 29, 2026
1a075a7
Throughput is now collected only on collect_trial_metrics
Tw1ZZLER Jun 29, 2026
c4dac30
Moved and updated EventTypes to its own namespaces
Tw1ZZLER Jun 29, 2026
e635e7a
Updated tests with new names and events
Tw1ZZLER Jun 29, 2026
638e4d8
Circuit swapping updated to include more node information
Tw1ZZLER Jun 29, 2026
af2ac51
BDS swapping updated with more information
Tw1ZZLER Jun 29, 2026
1afcc44
Circuit BBPSSW updated with more information and new names
Tw1ZZLER Jun 29, 2026
07402e5
BDS BBPSSW updated with more information
Tw1ZZLER Jun 29, 2026
316207b
Generation updated to include more information and new names
Tw1ZZLER Jun 29, 2026
4fe3d68
Added doc strings for storage methods
Tw1ZZLER Jun 30, 2026
ef41a9c
Added docstrings for registry methods
Tw1ZZLER Jun 30, 2026
b1585ff
Added docstrings for metric types methods
Tw1ZZLER Jun 30, 2026
f53194b
Added docstrings for event types methods
Tw1ZZLER Jun 30, 2026
954b87f
Added doc strings for builtins methods
Tw1ZZLER Jun 30, 2026
9697bd1
Added docstrings for init methods
Tw1ZZLER Jun 30, 2026
552ae76
Improve system time provider (now returns picoseconds properly)
Tw1ZZLER Jul 1, 2026
b89ffb9
Replace ellipsis with exception
Tw1ZZLER Jul 1, 2026
0e98bf7
Remove TimeProvider abstraction, provide Timeline directly
Tw1ZZLER Jul 1, 2026
91b3e63
Fix test metrics to use timeline time provider
Tw1ZZLER Jul 1, 2026
79c0fbc
Potential fix for pull request finding 'Unused local variable'
Tw1ZZLER Jul 1, 2026
c3830c1
Type checking guard
Tw1ZZLER Jul 1, 2026
9ccfa8d
Revert "Changed ruff formatter line length to 120"
Tw1ZZLER Jul 1, 2026
7169459
Target pairs defaults to None
Tw1ZZLER Jul 1, 2026
93c420a
Target pairs defaults to None
Tw1ZZLER Jul 1, 2026
861502f
Create a better dummy timeline for the tests
Tw1ZZLER Jul 1, 2026
695b960
Fixed target pairs logic check in DeliveryTimeMetric
Tw1ZZLER Jul 1, 2026
a9fe29a
Better descriptions for optional metric methods (+pass)
Tw1ZZLER Jul 1, 2026
ad15cd6
Mean and STD method provided to clean up aggregation code
Tw1ZZLER Jul 1, 2026
28eb062
Moved BUILTIN_METRICS scope
Tw1ZZLER Jul 1, 2026
e08ef9d
Converted `is` keyword to == to prevent missed matches
Tw1ZZLER Jul 1, 2026
2a0af52
Converted `is` keyword to == to prevent missed matches
Tw1ZZLER Jul 1, 2026
c9b7913
Converted `is` keyword to == to prevent missed matches
Tw1ZZLER Jul 1, 2026
34f40ba
Converted `is` keyword to == to prevent missed matches
Tw1ZZLER Jul 1, 2026
53daeec
Added error for missing storage types
Tw1ZZLER Jul 1, 2026
a93ce16
Fixed typing for storage attribute
Tw1ZZLER Jul 1, 2026
eed31a1
Return of the __all__ list of exported symbols
Tw1ZZLER Jul 2, 2026
9ead73c
Merge branch 'master' into metrics
Tw1ZZLER Jul 6, 2026
5507e57
Replace double backtick to single backtick in docstrings
Tw1ZZLER Jul 6, 2026
e1852f7
Update CollectContext docstring for incorrect default
Tw1ZZLER Jul 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion sequence/entanglement_management/generation/barret_kok.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

from ...kernel.event import Event
from ...kernel.process import Process
from ...utils import log
from ...utils import log, metrics
from ...utils.metrics.event_types import EventTypes


@EntanglementGenerationA.register(BARRET_KOK)
Expand Down Expand Up @@ -225,6 +226,12 @@ def _entanglement_succeed(self):
self.memory.entangled_memory['node_id'] = self.remote_node_name
self.memory.entangled_memory['memo_id'] = self.remote_memo_id
self.memory.fidelity = self.memory.raw_fidelity
metrics.record(
EventTypes.EG_SUCCESS,
self.owner.name,
remote_node=self.remote_node_name,
fidelity=self.fidelity,
)
self.update_resource_manager(self.memory, MemoryInfo.ENTANGLED)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

from ..entanglement_protocol import EntanglementProtocol
from ...components.circuit import Circuit
from ...utils import log
from ...utils import log, metrics
from ...utils.metrics.event_types import EventTypes


class QuantumCircuitMixin:
Expand Down Expand Up @@ -180,6 +181,12 @@ def _entanglement_succeed(self):
def _entanglement_fail(self):
for event in self.scheduled_events:
self.owner.timeline.remove_event(event)
metrics.record(
EventTypes.EG_FAILURE,
self.owner.name,
remote_node=self.remote_node_name,
fidelity=self.fidelity,
)
log.logger.info(f'{self.owner.name} failed entanglement of memory {self.memory}')

self.update_resource_manager(self.memory, MemoryInfo.RAW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from ...kernel.process import Process
from ...kernel.quantum_manager import QuantumManager
from ...resource_management.memory_manager import MemoryInfo
from ...utils import log
from ...utils import log, metrics
from ...utils.metrics.event_types import EventTypes

if TYPE_CHECKING:
from ...components.memory import Memory
Expand Down Expand Up @@ -230,6 +231,12 @@ def _entanglement_succeed(self):
log.logger.info(f'{self.owner.name} successful entanglement of memory {self.memory}')
self.memory.entangled_memory['node_id'] = self.remote_node_name
self.memory.entangled_memory['memo_id'] = self.remote_memo_id
metrics.record(
EventTypes.EG_SUCCESS,
self.owner.name,
remote_node=self.remote_node_name,
fidelity=self.raw_fidelity,
)
self.memory.fidelity = self.raw_fidelity

self.update_resource_manager(self.memory, MemoryInfo.ENTANGLED)
Expand Down
10 changes: 9 additions & 1 deletion sequence/entanglement_management/purification/bbpssw_bds.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from ...topology.node import Node

from ...constants import BELL_DIAGONAL_STATE_FORMALISM
from ...utils import log
from ...utils import log, metrics
from ...utils.metrics.event_types import EventTypes
from .bbpssw_protocol import BBPSSWProtocol, BBPSSWMessage, BBPSSWMsgType

@BBPSSWProtocol.register(BELL_DIAGONAL_STATE_FORMALISM)
Expand Down Expand Up @@ -137,9 +138,16 @@ def received_message(self, src: str, msg: BBPSSWMessage) -> None:
remote_kept_memory.bds_decohere()
self.kept_memo.bds_decohere()
self.kept_memo.fidelity = self.kept_memo.get_bds_fidelity()
metrics.record(
EventTypes.EP_SUCCESS,
self.owner.name,
remote_node=self.remote_node_name,
fidelity=self.kept_memo.fidelity,
)
self.update_resource_manager(self.kept_memo, state="PURIFIED")
else:
log.logger.info(f'Purification failed because measure results: {self.meas_res}, {msg.meas_res}')
metrics.record(EventTypes.EP_FAILURE, self.owner.name, remote_node=self.remote_node_name)
self.update_resource_manager(self.kept_memo, state="RAW")

else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from ...components.memory import Memory
from ...topology.node import Node

from ...utils import log
from ...utils import log, metrics
from ...utils.metrics.event_types import EventTypes
from ...constants import KET_VECTOR_FORMALISM, DENSITY_MATRIX_FORMALISM
from .bbpssw_protocol import BBPSSWProtocol, BBPSSWMessage, BBPSSWMsgType

Expand Down Expand Up @@ -117,8 +118,15 @@ def received_message(self, src: str, msg: BBPSSWMessage) -> None:
self.update_resource_manager(self.meas_memo, "RAW")
if self.meas_res == msg.meas_res:
self.kept_memo.fidelity = self.improved_fidelity(self.kept_memo.fidelity)
metrics.record(
EventTypes.EP_SUCCESS,
self.owner.name,
remote_node=self.remote_node_name,
fidelity=self.kept_memo.fidelity,
)
self.update_resource_manager(self.kept_memo, state="PURIFIED")
else:
metrics.record(EventTypes.EP_FAILURE, self.owner.name, remote_node=self.remote_node_name)
self.update_resource_manager(self.kept_memo, state="RAW")

@staticmethod
Expand Down
16 changes: 15 additions & 1 deletion sequence/entanglement_management/swapping/swapping_bds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from typing import TYPE_CHECKING

from .swapping_base import EntanglementSwappingA, EntanglementSwappingB, SwappingMsgType, EntanglementSwappingMessage
from ...utils import log
from ...utils import log, metrics
from ...utils.metrics.event_types import EventTypes
from ...constants import BELL_DIAGONAL_STATE_FORMALISM
from ...resource_management.memory_manager import MemoryInfo

Expand Down Expand Up @@ -88,6 +89,13 @@ def start(self) -> None:
# get BDS conditioned on success, fidelity is the first diagonal element
new_bds = self.swapping_res()
fidelity = new_bds[0]
metrics.record(
EventTypes.ES_SUCCESS,
self.owner.name,
left_node=self.left_node,
right_node=self.right_node,
fidelity=fidelity,
)
keys = [left_remote_memory.qstate_key, right_remote_memory.qstate_key]
self.owner.timeline.quantum_manager.set(keys, new_bds)

Expand All @@ -107,6 +115,12 @@ def start(self) -> None:
meas_res=[])
else:
log.logger.info(f'swapping failed!')
metrics.record(
EventTypes.ES_FAILURE,
self.owner.name,
left_node=self.left_node,
right_node=self.right_node,
)
msg_l = EntanglementSwappingMessage(SwappingMsgType.SWAP_RES, self.left_protocol_name, fidelity=0)
msg_r = EntanglementSwappingMessage(SwappingMsgType.SWAP_RES, self.right_protocol_name, fidelity=0)

Expand Down
16 changes: 15 additions & 1 deletion sequence/entanglement_management/swapping/swapping_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from ...components.circuit import Circuit
from ...constants import KET_VECTOR_FORMALISM, DENSITY_MATRIX_FORMALISM
from ...resource_management.memory_manager import MemoryInfo
from ...utils import log
from ...utils import log, metrics
from ...utils.metrics.event_types import EventTypes


@EntanglementSwappingA.register(KET_VECTOR_FORMALISM)
Expand Down Expand Up @@ -84,6 +85,13 @@ def start(self) -> None:
if self.owner.get_generator().random() < self.success_probability():
# swapping succeeded
fidelity = self.updated_fidelity(self.left_memo.fidelity, self.right_memo.fidelity)
metrics.record(
EventTypes.ES_SUCCESS,
self.owner.name,
left_node=self.left_node,
right_node=self.right_node,
fidelity=fidelity,
)
self.is_success = True

expire_time = min(self.left_memo.get_expire_time(), self.right_memo.get_expire_time())
Expand All @@ -108,6 +116,12 @@ def start(self) -> None:
else:
# swapping failed
log.logger.info(f"{self.name} swapping failed")
metrics.record(
EventTypes.ES_FAILURE,
self.owner.name,
left_node=self.left_node,
right_node=self.right_node,
)
msg_l = EntanglementSwappingMessage(SwappingMsgType.SWAP_RES,self.left_protocol_name, fidelity=0)
msg_r = EntanglementSwappingMessage(SwappingMsgType.SWAP_RES, self.right_protocol_name, fidelity=0)

Expand Down
3 changes: 2 additions & 1 deletion sequence/kernel/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from .eventlist import EventList
from .quantum_manager import QuantumManager
from ..utils import log
from ..utils import log, metrics

# for timeline formatting
NANOSECONDS_PER_MILLISECOND = 10**6
Expand Down Expand Up @@ -76,6 +76,7 @@ def __init__(self, stop_time: int = 10 ** 23, formalism: str = None, manager_kwa
if manager_kwargs is None:
manager_kwargs = {}
self.quantum_manager: QuantumManager = QuantumManager.create(**manager_kwargs)
metrics.register_time_provider(self)

def now(self) -> int:
"""Returns current simulation time."""
Expand Down
2 changes: 1 addition & 1 deletion sequence/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__all__ = ['encoding', 'log', 'config_generator_cli', 'graphs', 'nx_converter']
__all__ = ['encoding', 'log', 'config_generator_cli', 'graphs', 'nx_converter', 'metrics']
def __dir__():
return sorted(__all__)
Loading
Loading