-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevices.py
80 lines (57 loc) · 1.67 KB
/
devices.py
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
68
69
70
71
72
73
74
75
76
77
78
79
80
import numpy as np
def eopm(E_in, V_pi, V_drive):
"""
Electro-optic phase modulator.
Parameters:
-----------
E_in : scalar or np.array
Input electric field of the optical carrier.
V_pi : float
Voltage required to achieve a phase shift of pi.
V_drive : np.array
Driving voltage signal (baseband/RF/etc.).
Returns:
--------
E_out : np.array
Output electric field of the optical carrier.
"""
return E_in * np.exp(1j * np.pi * V_drive / V_pi)
def mzm(E_in, V_pi, V_bias, V_drive):
"""
Mach-Zehnder modulator in push-pull configuration.
Parameters:
-----------
E_in : scalar or np.array
Input electric field of the optical carrier.
V_pi : float
Voltage required to achieve a phase shift of pi.
V_bias : float
Bias voltage applied to the modulator.
V_drive : np.array
Driving voltage signal (baseband/RF/etc.).
Returns:
--------
E_out : np.array
Output electric field of the optical carrier.
"""
return E_in * np.cos(np.pi * (V_drive + V_bias) / V_pi)
def iqm(E_in, format, V_i, V_q):
"""
IQ modulator.
Parameters:
-----------
E_in : scalar or np.array
Input electric field of the optical carrier.
format : str
Modulation format. Can be 'QPSK', '8QAM', '16QAM', '32QAM', '64QAM' or
'128QAM'.
V_i : np.array
Driving voltage signal for the in-phase component.
V_q : np.array
Driving voltage signal for the quadrature component.
Returns:
--------
E_out : np.array
Output electric field of the optical carrier.
"""
pass