-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBB84_QKD.py
More file actions
67 lines (48 loc) · 1.57 KB
/
BB84_QKD.py
File metadata and controls
67 lines (48 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from LaserPy_Quantum import Clock
from LaserPy_Quantum import Connection, Simulator
from LaserPy_Quantum import (
StaticWave, ArbitaryWaveGenerator
)
from LaserPy_Quantum import ModulationFunction, CurrentDriver
from LaserPy_Quantum import Laser
from LaserPy_Quantum import RandomNumSource
from LaserPy_Quantum import VariableOpticalAttenuator
from LaserPy_Quantum import AsymmetricMachZehnderInterferometer
from LaserPy_Quantum import (
display_class_instances_data,
get_time_delay_phase_correction
)
import numpy as np
# Control Constants (all in SI units)
modulation_bits = [0] * 10
dt = 1e-12
t_unit = 1e-11
t_final = t_unit * len(modulation_bits) / 2
sampling_rate = 2
RESET_MODE = True
# Current Constants
I_th = 0.0178
MASTER_BASE_DC = 1.4 * I_th
# Steady above lasing current
mBase = StaticWave("mBase", MASTER_BASE_DC)
AWG = ArbitaryWaveGenerator()
AWG.set(mBase)
############################################################################
current_driver1 = CurrentDriver(AWG)
current_driver1.set(mBase)
master_laser = Laser(name= "master_laser")
simulator_clock = Clock(dt, sampling_rate)
simulator_clock.set(t_final)
simulator = Simulator(simulator_clock)
VOA = VariableOpticalAttenuator(5)
simulator.set((
Connection(simulator_clock, current_driver1),
Connection(current_driver1, master_laser),
Connection(master_laser, VOA),
))
simulator.reset(True)
simulator.simulate()
time_data = simulator.get_data()
#display_class_instances_data((master_laser,), time_data)
print(np.mod(master_laser._simulation_data['phase'], np.pi * 2) - np.pi)
exit(code= 0)