simulation module

simulation.batch_proc(batch_size, switch_routing, dampening_parameter, visibility, max_attempts, max_distillations, ideal_switch, ideal_qpu, run_id)[source]

Worker function for executing a batch of single_run simulations for a given parameter set.

Parameters:
  • batch_size (int) – Number of independent runs to perform.

  • switch_routing (dict) – Switch configuration (e.g. {“qin0”: “qout0”, “qin1”: “qout1”, “qin2”: “qout2”}).

  • dampening_parameter (float) – Photon state amplitude dampening parameter applied to FSO channels.

  • visibility (float) – Photon indistinguishability (HOM visibility) parameters.

  • max_attempts (int) – Maximum number of entanglement generation attempts.

  • max_distillations (int) – Maximum number of distillation rounds attempted.

  • ideal_switch (bool) – If True, use an ideal switch model (no loss, no noise).

  • ideal_qpu (bool) – If True, use ideal QPU nodes.

  • run_id (int) – Identifier for the parameter set.

Returns:

  • list[pd.DataFrame] – List of event-level dataframes for all runs in the batch.

  • list[pd.DataFrame] – List of metadata dataframes for all runs in the batch.

Examples

>>> event_dfs, metadata_dfs = batch_proc(
...     batch_size=2,
...     switch_routing={"qin0": "qout0", "qin1": "qout1", "qin2": "qout2"},
...     dampening_parameter=0.1,
...     max_attempts=50,
...     max_distillations=10,
...     ideal_switch=False,
...     ideal_qpu=True,
...     visibility=0.9,
...     run_id=0
... )
simulation.batch_run(switch_routing, batch_size, ideal_switch, ideal_qpu, dampening_parameters, visibilities, max_attempts, max_distillations)[source]

Run multiple simulations across batches of parameter combinations.

Parameters:
  • switch_routing (dict) – Switch configuration (e.g. {“qin0”: “qout0”, “qin1”: “qout1”, “qin2”: “qout2”}).

  • batch_size (int) – Number of independent runs per parameter combination.

  • dampening_parameters (list[float]) – List of photon state amplitude dampening parameter applied to FSO channels.

  • visibilities (list[float]) – List of photon indistinguishability (HOM visibility) parameters.

  • ideal_switch (bool) – If True, use an ideal switch model (no loss, no noise).

  • ideal_qpu (bool) – If True, use ideal QPU nodes.

  • max_attempts (int) – Maximum number of entanglement generation attempts.

  • max_distillations (int) – Maximum number of distillation rounds attempted.

Returns:

  • pd.DataFrame – Combined metadata dataframe across all runs.

  • pd.DataFrame – Combined event dataframe across all runs.

Examples

>>> metadata_df, events_df = batch_run(
...     switch_routing={"qin0": "qout0", "qin1": "qout1", "qin2": "qout2"},
...     batch_size=3,
...     ideal_switch=False,
...     ideal_qpu=False,
...     dampening_parameters=[0.05, 0.1],
...     visibilities=[0.8, 0.9],
...     max_attempts=100,
...     max_distillations=20
... )
simulation.setup_ring_network(dampening_parameter, routing, ideal_switch, ideal_qpu, visibility, idx_1, idx_2, qpu_count=8)[source]

Setup a ring topology network of FSO switches and QPUs.

Parameters:
  • dampening_parameter (float) – Photon state amplitude dampening parameter applied to FSO channels.

  • routing (dict) – Switch configuration (e.g. {“qin0”: “qout0”, “qin1”: “qout1”, “qin2”: “qout2”}).

  • ideal_switch (bool) – If True, use an ideal switch model (no loss, no noise).

  • ideal_qpu (bool) – If True, use ideal QPU nodes.

  • visibility (float) – Photon indistinguishability (HOM visibility) (0–1).

  • idx_1 (int) – Index of the first QPU to include in the network (memory optimization).

  • idx_2 (int) – Index of the second QPU to include in the network (memory optimization).

  • qpu_count (int, optional) – Total number of QPUs (default is 8).

Returns:

  • Network – The constructed ring network.

  • ControlNode – The control node managing the network.

  • list of QPUNode – The selected QPU nodes corresponding to idx_1 and idx_2.

Examples

>>> network, ctrl_node, [q1, q2] = setup_ring_network(
...     dampening_parameter=0.05,
...     routing={"qin0": "qout0", "qin1": "qout1", "qin2": "qout2"},
...     ideal_switch=True,
...     ideal_qpu=False,
...     visibility=0.85,
...     idx_1=2,
...     idx_2=6,
...     qpu_count=8
... )
simulation.setup_simple_network(dampening_parameter, routing, ideal_switch, ideal_qpu, visibility)[source]

Setup a simple 2-node network connected via a single FSO switch.

Parameters:
  • dampening_parameter (float) – Photon state amplitude dampening parameter applied to FSO channels.

  • routing (dict) – Switch configuration (e.g. {“qin0”: “qout0”, “qin1”: “qout1”, “qin2”: “qout2”}).

  • ideal_switch (bool) – If True, use an ideal switch model (no loss, no noise).

  • ideal_qpu (bool) – If True, use ideal QPU nodes.

  • visibility (float) – Photon indistinguishability (HOM visibility) (0–1).

Examples

>>> network, ctrl_node, [qnode_1, qnode_2] = setup_simple_network(
...     dampening_parameter=0.1,
...     routing={"qin0": "qout0", "qin1": "qout1", "qin2": "qout2"},
...     ideal_switch=False,
...     ideal_qpu=False,
...     visibility=0.9
... )
simulation.setup_tree_network(dampening_parameter, routing, ideal_switch, ideal_qpu, visibility, idx_1, idx_2, qpu_count=9)[source]

Setup a tree topology network of FSO switches and QPUs.

Parameters:
  • dampening_parameter (float) – Photon state amplitude dampening parameter applied to FSO channels.

  • routing (dict) – Switch configuration (e.g. {“qin0”: “qout0”, “qin1”: “qout1”, “qin2”: “qout2”}).

  • ideal_switch (bool) – If True, use an ideal switch model (no loss, no noise).

  • ideal_qpu (bool) – If True, use ideal QPU nodes.

  • visibility (float) – Photon indistinguishability (HOM visibility) (0–1).

  • idx_1 (int) – Index of the first QPU to include in the network (memory optimization).

  • idx_2 (int) – Index of the second QPU to include in the network (memory optimization).

  • qpu_count (int, optional) – Total number of QPUs (default is 9).

Returns:

  • Network – The constructed tree network.

  • ControlNode – The control node managing the network.

  • list of QPUNode – The selected QPU nodes corresponding to idx_1 and idx_2.

Examples

>>> network, ctrl_node, [q1, q2] = setup_tree_network(
...     dampening_parameter=0.1,
...     routing={"qin0": "qout0", "qin1": "qout1", "qin2": "qout2"},
...     ideal_switch=False,
...     ideal_qpu=True,
...     visibility=0.9,
...     idx_1=0,
...     idx_2=5,
...     qpu_count=9
... )
simulation.single_run(switch_routing, dampening_parameter, visibility, ideal_switch, ideal_qpu, max_attempts, max_distillations, run)[source]

Run a single simulation of the continuous distillation protocol over all QPU pairs in a given network topology.

Parameters:
  • switch_routing (dict) – Switch configuration (e.g. {“qin0”: “qout0”, “qin1”: “qout1”, “qin2”: “qout2”}).

  • dampening_parameter (float) – Photon state amplitude dampening parameter applied to FSO channels.

  • visibility (float) – Photon indistinguishability (HOM visibility) (0–1).

  • ideal_switch (bool) – If True, use an ideal switch model (no loss, no noise).

  • ideal_qpu (bool) – If True, use ideal QPU nodes.

  • max_attempts (int) – Maximum number of entanglement generation attempts.

  • max_distillations (int) – Maximum number of distillation rounds attempted.

  • run (int) – Run index identifier.

Returns:

  • pd.DataFrame – Metadata dataframe summarizing run statistics.

  • pd.DataFrame – Event-level dataframe with detailed protocol execution logs.

Examples

>>> metadata_df, events_df = single_run(
...     switch_routing={"qin0": "qout0", "qin1": "qout1", "qin2": "qout2"},
...     dampening_parameter=0.1,
...     max_attempts=50,
...     max_distillations=10,
...     ideal_switch=False,
...     ideal_qpu=False,
...     visibility=0.9,
...     run=0
... )