Skip to content

Commit

Permalink
add config generation file for experiment 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Naphann committed Jul 26, 2024
1 parent a0da5e6 commit c95c38d
Show file tree
Hide file tree
Showing 5 changed files with 531 additions and 0 deletions.
110 changes: 110 additions & 0 deletions quisp/simulations/cross_validation_config_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/python3

import numpy as np
import os


def generate_mim_exp_config(num_memories: int, alice_to_bsa: int, bob_to_bsa: int):
# [Config mim_imbalanced_10_10]
# network = networks.cross_validation_mim_link_imbalanced_10_10
# **.qrsa.hm.link_tomography = true
# **.qrsa.hm.initial_purification = 0
# **.qrsa.hm.purification_type = ""
# **.buffers = 1
pass
# config_name = f"[Config swapping_validation_cnot_only_{cnot_error_prob}]"
# network_name = f"networks.cross_validation_swapping"
# error_params = [
# f"**.cnot_gate_error_rate = {cnot_error_prob}",
# f"**.cnot_gate_iz_error_ratio = {1/9}",
# f"**.cnot_gate_zi_error_ratio = {1/9}",
# f"**.cnot_gate_zz_error_ratio = {1/9}",
# f"**.cnot_gate_ix_error_ratio = {1/9}",
# f"**.cnot_gate_xi_error_ratio = {1/9}",
# f"**.cnot_gate_xx_error_ratio = {1/9}",
# f"**.cnot_gate_iy_error_ratio = {1/9}",
# f"**.cnot_gate_yi_error_ratio = {1/9}",
# f"**.cnot_gate_yy_error_ratio = {1/9}",
# ]
# return [config_name, network_name, *error_params]


def generate_swapping_config(
cnot_error_prob: float, measurement_error_prob: float, with_depolarizing: bool
):
# [Config mim_imbalanced_10_10]
# network = networks.cross_validation_mim_link_imbalanced_10_10
# **.qrsa.hm.link_tomography = true
# **.qrsa.hm.initial_purification = 0
# **.qrsa.hm.purification_type = ""
# **.buffers = 1
if with_depolarizing:
config_name = f"[Config swapping_validation_cnot_{cnot_error_prob}_meas_{measurement_error_prob}_with_1ms_decoherence]"
# p = 0.0004623208506703652 --> resulting in P_I = 0.36781054 after 1ms
p_decoherence = 0.0004623208506703652
else:
config_name = f"[Config swapping_validation_cnot_{cnot_error_prob}_meas_{measurement_error_prob}_without_decoherence]"
p_decoherence = 0
network_name = f"network = networks.cross_validation_swapping"
error_params = [
f"**.cnot_gate_error_rate = {cnot_error_prob}",
f"**.cnot_gate_iz_error_ratio = {1/9}",
f"**.cnot_gate_zi_error_ratio = {1/9}",
f"**.cnot_gate_zz_error_ratio = {1/9}",
f"**.cnot_gate_ix_error_ratio = {1/9}",
f"**.cnot_gate_xi_error_ratio = {1/9}",
f"**.cnot_gate_xx_error_ratio = {1/9}",
f"**.cnot_gate_iy_error_ratio = {1/9}",
f"**.cnot_gate_yi_error_ratio = {1/9}",
f"**.cnot_gate_yy_error_ratio = {1/9}",
#
f"**.x_measurement_error_rate = {measurement_error_prob}",
f"**.y_measurement_error_rate = {measurement_error_prob}",
f"**.z_measurement_error_rate = {measurement_error_prob}",
#
f"**.memory_x_error_rate = {p_decoherence}",
f"**.memory_y_error_rate = {p_decoherence}",
f"**.memory_z_error_rate = {p_decoherence}",
]
return [config_name, network_name, *error_params]


def write_config(filename: str, configs: list[list[str]]):
# config relative path inside simulation folder
dirname = os.path.dirname(__file__)
general_ini_file = os.path.join(dirname, "general_config.ini")

with open(filename, "w") as the_file:
with open(general_ini_file) as f:
for line in f:
the_file.write(line)
for config in configs:
the_file.write("\n".join(config))
the_file.write("\n\n\n")


# exp 3: gate error
# exp 3: measurement error
# exp 3: with decoherence
swapping_configs_gate_error = [
generate_swapping_config(gp, 0, False) for gp in np.arange(0, 0.5, 0.025)
]
swapping_configs_gate_error_with_depo = [
generate_swapping_config(gp, 0, True) for gp in np.arange(0, 0.5, 0.025)
]
swapping_configs_meas_error = [
generate_swapping_config(0, gp, False) for gp in np.arange(0, 0.5, 0.025)
]
swapping_configs_meas_error_with_depo = [
generate_swapping_config(0, gp, True) for gp in np.arange(0, 0.5, 0.025)
]

write_config(
"cross_validation_config_generated.ini",
[
*swapping_configs_gate_error,
*swapping_configs_gate_error_with_depo,
*swapping_configs_meas_error,
*swapping_configs_meas_error_with_depo,
],
)
137 changes: 137 additions & 0 deletions quisp/simulations/cross_validation_link_varying_distance.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
[General]
repeat = 50
seed-set = ${repetition}
sim-time-limit = 20s
**.initial_notification_timing_buffer = 10s # when to start the BSA timing notification.
**.app.request_generation_interval = 2s
**.logger.enabled_log = false
**.logger.log_filename = "${resultdir}/${configname}-${runnumber}.jsonl"
**.tomography_output_filename = "${resultdir}/${configname}.output"
**.statistic-recording = false
**.scalar-recording = false
**.vector-recording = false
**.speed_of_light_in_fiber = 208189.206944km

**.channel_loss_rate = 0.04500741397 # per km. 1 - 10^(-0.2/10)
**.channel_x_error_rate = 0
**.channel_z_error_rate = 0
**.channel_y_error_rate = 0

**.collection_efficiency = 1
**.darkcount_probability = 0
**.detection_efficiency = 1
**.indistinguishable_time_window = 1.5ns
**.photon_detection_per_second = 1000000000 # 1GHz

**.x_gate_error_rate = 0
**.x_gate_x_error_ratio = 0
**.x_gate_y_error_ratio = 0
**.x_gate_z_error_ratio = 0

**.z_gate_error_rate = 0
**.z_gate_x_error_ratio = 0
**.z_gate_y_error_ratio = 0
**.z_gate_z_error_ratio = 0

**.cnot_gate_error_rate = 0
**.cnot_gate_iz_error_ratio = 0
**.cnot_gate_zi_error_ratio = 0
**.cnot_gate_zz_error_ratio = 0
**.cnot_gate_ix_error_ratio = 0
**.cnot_gate_xi_error_ratio = 0
**.cnot_gate_xx_error_ratio = 0
**.cnot_gate_iy_error_ratio = 0
**.cnot_gate_yi_error_ratio = 0
**.cnot_gate_yy_error_ratio = 0

**.memory_x_error_rate = 0
**.memory_y_error_rate = 0
**.memory_z_error_rate = 0
**.memory_energy_excitation_rate = 0
**.memory_energy_relaxation_rate = 0
**.memory_completely_mixed_rate = 0

**.x_measurement_error_rate = 0
**.z_measurement_error_rate = 0
**.y_measurement_error_rate = 0

**.app.number_of_bellpair = 1000
**.buffers = 1
**.qrsa.hm.num_measure = 1000

[Config mim_imbalanced_10_10]
network = networks.cross_validation_mim_link_imbalanced_10_10
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_11_9]
network = networks.cross_validation_mim_link_imbalanced_11_9
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_12_8]
network = networks.cross_validation_mim_link_imbalanced_12_8
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_13_7]
network = networks.cross_validation_mim_link_imbalanced_13_7
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_14_6]
network = networks.cross_validation_mim_link_imbalanced_14_6
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_15_5]
network = networks.cross_validation_mim_link_imbalanced_15_5
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_16_4]
network = networks.cross_validation_mim_link_imbalanced_16_4
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_17_3]
network = networks.cross_validation_mim_link_imbalanced_17_3
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_18_2]
network = networks.cross_validation_mim_link_imbalanced_18_2
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_19_1]
network = networks.cross_validation_mim_link_imbalanced_19_1
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config mim_imbalanced_20_0]
network = networks.cross_validation_mim_link_imbalanced_20_0
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1
108 changes: 108 additions & 0 deletions quisp/simulations/cross_validation_link_varying_memories.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
[General]
seed-set = ${0..49}
sim-time-limit = 20s
**.initial_notification_timing_buffer = 10s # when to start the BSA timing notification.
**.app.request_generation_interval = 2s
**.logger.enabled_log = false
**.logger.log_filename = "${resultdir}/${configname}-${runnumber}.jsonl"
**.tomography_output_filename = "${resultdir}/${configname}.output"
**.statistic-recording = false
**.scalar-recording = false
**.vector-recording = false
**.speed_of_light_in_fiber = 208189.206944km

**.channel_loss_rate = 0.04500741397 # per km. 1 - 10^(-0.2/10)
**.channel_x_error_rate = 0
**.channel_z_error_rate = 0
**.channel_y_error_rate = 0

**.collection_efficiency = 1
**.darkcount_probability = 0
**.detection_efficiency = 1
**.indistinguishable_time_window = 1.5ns
**.photon_detection_per_second = 1000000

**.x_gate_error_rate = 0
**.x_gate_x_error_ratio = 0
**.x_gate_y_error_ratio = 0
**.x_gate_z_error_ratio = 0

**.z_gate_error_rate = 0
**.z_gate_x_error_ratio = 0
**.z_gate_y_error_ratio = 0
**.z_gate_z_error_ratio = 0

**.cnot_gate_error_rate = 0
**.cnot_gate_iz_error_ratio = 0
**.cnot_gate_zi_error_ratio = 0
**.cnot_gate_zz_error_ratio = 0
**.cnot_gate_ix_error_ratio = 0
**.cnot_gate_xi_error_ratio = 0
**.cnot_gate_xx_error_ratio = 0
**.cnot_gate_iy_error_ratio = 0
**.cnot_gate_yi_error_ratio = 0
**.cnot_gate_yy_error_ratio = 0

**.memory_x_error_rate = 0
**.memory_y_error_rate = 0
**.memory_z_error_rate = 0
**.memory_energy_excitation_rate = 0
**.memory_energy_relaxation_rate = 0
**.memory_completely_mixed_rate = 0

**.x_measurement_error_rate = 0
**.z_measurement_error_rate = 0
**.y_measurement_error_rate = 0

**.app.number_of_bellpair = 1000
**.qrsa.hm.num_measure = 1000

[Config memory_1]
network = networks.cross_validation_mim_link_middle
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 1

[Config memory_2]
network = networks.cross_validation_mim_link_middle
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 2

[Config memory_4]
network = networks.cross_validation_mim_link_middle
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 4

[Config memory_8]
network = networks.cross_validation_mim_link_middle
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 8

[Config memory_16]
network = networks.cross_validation_mim_link_middle
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 16

[Config memory_32]
network = networks.cross_validation_mim_link_middle
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 32

[Config memory_64]
network = networks.cross_validation_mim_link_middle
**.qrsa.hm.link_tomography = true
**.qrsa.hm.initial_purification = 0
**.qrsa.hm.purification_type = ""
**.buffers = 64

Loading

0 comments on commit c95c38d

Please sign in to comment.