Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arne Striegler
pypho
Commits
6d53c91d
Commit
6d53c91d
authored
Jun 19, 2018
by
Arne Striegler
😁
Browse files
New example 6 and 7
parent
fb0d9add
Changes
6
Show whitespace changes
Inline
Side-by-side
examples/example_crossphasemodulation_6.py
View file @
6d53c91d
...
...
@@ -48,7 +48,7 @@ E_Tx = copy.deepcopy(E)
plt
.
figure
(
1
)
plt
.
subplot
(
2
,
1
,
1
)
plt
.
plot
((
gp
.
freqax
-
gp
.
f0
)
*
1e-9
,
np
.
log10
(
abs
(
fftshift
(
fft
(
E
[
0
][
'E'
][
0
]
)
**
2
))),
'r'
,
label
=
'X-Pol'
)
plt
.
plot
((
gp
.
freqax
-
gp
.
f0
)
*
1e-9
,
np
.
log10
(
abs
(
fftshift
(
fft
(
E
[
0
][
'E'
][
1
]
)
**
2
))),
'g
:
'
,
label
=
'Y-Pol'
)
plt
.
plot
((
gp
.
freqax
-
gp
.
f0
)
*
1e-9
,
np
.
log10
(
abs
(
fftshift
(
fft
(
E
[
0
][
'E'
][
1
]
)
**
2
))),
'g'
,
label
=
'Y-Pol'
)
plt
.
title
(
"Input spectrum"
,
loc
=
'left'
)
plt
.
ylabel
(
'Spec. density'
);
plt
.
grid
(
True
)
...
...
@@ -60,7 +60,7 @@ E = SSMF(E = E)
# Plot Spectrum Output signals
plt
.
subplot
(
2
,
1
,
2
)
plt
.
plot
((
gp
.
freqax
-
gp
.
f0
)
*
1e-9
,
np
.
log10
(
abs
(
fftshift
(
fft
(
E
[
0
][
'E'
][
0
]
)
**
2
))),
'r'
,
label
=
'X-Pol'
)
plt
.
plot
((
gp
.
freqax
-
gp
.
f0
)
*
1e-9
,
np
.
log10
(
abs
(
fftshift
(
fft
(
E
[
0
][
'E'
][
1
]
)
**
2
))),
'g
:
'
,
label
=
'Y-Pol'
)
plt
.
plot
((
gp
.
freqax
-
gp
.
f0
)
*
1e-9
,
np
.
log10
(
abs
(
fftshift
(
fft
(
E
[
0
][
'E'
][
1
]
)
**
2
))),
'g'
,
label
=
'Y-Pol'
)
plt
.
title
(
"Output spectrum"
,
loc
=
'left'
)
plt
.
ylabel
(
'Spec. density'
);
plt
.
xlabel
(
'Frequency deviation [GHz]'
);
plt
.
grid
(
True
)
...
...
@@ -90,17 +90,17 @@ plt.figure(2)
plt
.
subplot
(
2
,
1
,
1
)
plt
.
ylabel
(
'$|E|^2$'
);
plt
.
xlabel
(
'Transmission distance [m]'
);
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f1
[
0
][
'E'
][
0
])
**
2
,
'r'
,
label
=
'$
E_x
Pulse$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f1
[
0
][
'E'
][
1
])
**
2
,
'g'
,
label
=
'$E_y Pulse$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f0
[
0
][
'E'
][
0
])
**
2
,
'r:'
,
label
=
'$
E_x
cw@1550nm$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f0
[
0
][
'E'
][
1
])
**
2
,
'g:'
,
label
=
'$
E_y
cw@1550nm$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f1
[
0
][
'E'
][
0
])
**
2
,
'r'
,
label
=
'$Pulse
: E_x
$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f1
[
0
][
'E'
][
1
])
**
2
,
'g'
,
label
=
'$
Pulse:
E_y Pulse$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f0
[
0
][
'E'
][
0
])
**
2
,
'r:'
,
label
=
'$cw@1550nm
: E_x
$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_f0
[
0
][
'E'
][
1
])
**
2
,
'g:'
,
label
=
'$cw@1550nm
: E_y
$'
)
legend
=
plt
.
legend
(
loc
=
'upper right'
)
plt
.
grid
(
True
)
plt
.
subplot
(
2
,
1
,
2
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
angle
(
E
[
0
][
'E'
][
0
]),
'r'
,
label
=
'$E_x$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
angle
(
E
[
0
][
'E'
][
1
]),
'g'
,
label
=
'$E_y$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
angle
(
E
[
0
][
'E'
][
0
]),
'r'
,
label
=
'$
cw@1550nm:
E_x$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
angle
(
E
[
0
][
'E'
][
1
]),
'g'
,
label
=
'$
cw@1550nm:
E_y$'
)
plt
.
ylabel
(
'$phase(E_x)$'
);
plt
.
grid
(
True
)
legend
=
plt
.
legend
(
loc
=
'upper right'
)
plt
.
show
()
\ No newline at end of file
examples/example_dispersion_1.py
View file @
6d53c91d
...
...
@@ -30,9 +30,9 @@ E_Tx = sig_1550(esig = esig)
# Define your parameters here
T_0
=
25.0e-12
z
=
SSMF
.
l
D
=
SSMF
.
D
beta_2
,
beta_3
=
DS2beta
(
D
,
0
,
gp
.
lambda0
)
z
=
100.0e3
D
=
17.0
beta_2
,
beta_3
=
DS2beta
(
17.0
,
0
,
gp
.
lambda0
)
# Create a single pulse with gaussian shape (not power!)
...
...
@@ -45,7 +45,7 @@ E = SSMF(E = E, D = D, l = z)
# Plot Input and Output signal
plt
.
figure
(
1
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_Tx
[
0
][
'E'
][
0
]),
'r'
,
label
=
'$E(0, t)$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E
[
0
][
'E'
][
0
]),
'g'
,
label
=
'$E(z=
'
+
str
(
SSMF
.
l
/
1e3
)
+
'
$km$, t)$'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E
[
0
][
'E'
][
0
]),
'g'
,
label
=
'$E(z=
100
$km$, t)$'
)
# Get FWHM of the input signal E_Tx
...
...
@@ -64,7 +64,6 @@ plt.annotate(s='', xy=(r1,np.max(np.abs(E[0]['E'][0]))/2), xytext=(r2,np.max(np.
plt
.
text
(
r1
+
(
r2
-
r1
)
/
2.0
,
0.01
+
np
.
max
(
np
.
abs
(
E
[
0
][
'E'
][
0
]))
/
2
,
'$T_{FWHM,1}$ = '
+
str
(
np
.
round
(
r2
-
r1
,
2
))
+
' ps'
,
fontsize
=
12
,
horizontalalignment
=
'center'
)
T_FWHM_1
=
(
r2
-
r1
)
*
1e-12
plt
.
ylabel
(
'$|E|$ a.u.'
);
plt
.
xlabel
(
'Time $t$ [ps]'
);
legend
=
plt
.
legend
(
loc
=
'upper right'
)
plt
.
show
()
L_D
=
(
T_0_plot
)
**
2
/
np
.
abs
(
beta_2
)
# Print the results
...
...
examples/example_dispersion_2.py
View file @
6d53c91d
...
...
@@ -54,8 +54,8 @@ eye(E = E[0]['E'], polarisation = 'x', style="g")
red_patch
=
mpatches
.
Patch
(
color
=
'red'
,
label
=
'Input signal'
)
green_patch
=
mpatches
.
Patch
(
color
=
'green'
,
label
=
'Output signal'
)
plt
.
legend
(
handles
=
[
red_patch
,
green_patch
],
loc
=
1
)
print
'Calculated output FWHM-pulse width : T_FWHM,1 = '
,
T_FWHM
*
np
.
sqrt
(
1
+
(
z
/
L_D
)
**
2
)
*
1e12
,
' ps'
plt
.
legend
(
handles
=
[
red_patch
,
green_patch
],
loc
=
1
);
plt
.
show
()
print
'Calculated output FWHM-pulse width : T_FWHM,1 = '
,
T_FWHM
*
np
.
sqrt
(
1
+
(
z
/
L_D
)
**
2
)
*
1e12
,
' ps'
T_FWHM_norm_0
=
T_FWHM
*
1e12
/
100.0
print
(
'Calculated max reach : '
,
100e-12
**
2
*
(
1
/
1.665095
)
**
2
*
2.0
*
np
.
pi
*
299792458
*
T_FWHM_norm_0
*
np
.
sqrt
(
T_FWHM_norm_max
**
2
-
T_FWHM_norm_0
**
2
)
/
(
16.8e-6
*
1550e-9
**
2
)
*
1e-3
)
\ No newline at end of file
examples/example_dispersion_3.py
View file @
6d53c91d
...
...
@@ -60,7 +60,7 @@ E = copy.deepcopy(E_Tx)
# Fiber trannsmission
E
=
SSMF
(
E
=
E
,
l
=
100e3
,
D
=
16.8
,
S
=
0.058
)
E
=
DCF
(
E
=
E
,
l
=
16.8e3
,
D
=
-
100
,
S
=
-
0.058
/
16.8
*
100
)
# For full dispersion compenstion set S = -0.058/16.8 * 100
E
=
DCF
(
E
=
E
,
l
=
16.8e3
,
D
=
-
100
,
S
=
-
0.058
/
16.8
*
100
# For full dispersion compenstion set S = -0.058/16.8 * 100
# Filter out the channels
...
...
@@ -80,4 +80,4 @@ plt.subplot(3, 1, 2)
eye
(
E
=
E_1550
[
0
][
'E'
],
polarisation
=
'x'
,
style
=
"r"
)
plt
.
subplot
(
3
,
1
,
3
)
eye
(
E
=
E_1554
[
0
][
'E'
],
polarisation
=
'x'
,
style
=
"r"
)
plt
.
show
()
\ No newline at end of file
examples/example_fourwavemixing_4.py
View file @
6d53c91d
...
...
@@ -56,7 +56,7 @@ plt.plot((gp.freqax-gp.f0)*1e-9, np.log10(abs(fftshift(fft(E[0]['E'][1] )**2))
plt
.
title
(
"Input spectrum"
,
loc
=
'left'
)
plt
.
ylabel
(
'Spec. density'
);
plt
.
grid
(
True
)
plt
.
show
()
# Fiber transmission
c1
=
0
for
z
in
np
.
arange
(
0
,
L
,
l
):
...
...
examples/example_polarisationmodedispersion_7.py
0 → 100644
View file @
6d53c91d
##!/usr/bin/env python2
# -*- coding: utf-8 -*-
#Import functions and libraries
import
sys
sys
.
path
.
append
(
'../'
)
from
pypho_setup
import
pypho_setup
from
pypho_bits
import
pypho_bits
from
pypho_signalsrc
import
pypho_signalsrc
from
pypho_lasmod
import
pypho_lasmod
from
pypho_fiber
import
pypho_fiber
from
pypho_fiber_birefringence
import
pypho_fiber_birefringence
from
pypho_cwlaser
import
pypho_cwlaser
from
pypho_optfi
import
pypho_optfi
from
pypho_functions
import
*
import
numpy
as
np
import
copy
import
matplotlib.patches
as
mpatches
import
matplotlib.pyplot
as
plt
# Define network elements
gp
=
pypho_setup
(
nos
=
16
,
sps
=
1
*
128
,
symbolrate
=
10e9
)
bitsrc
=
pypho_bits
(
glova
=
gp
,
nob
=
gp
.
nos
,
pattern
=
'singlepulse'
)
# Set pattern = "singlepulse"
esigsrc
=
pypho_signalsrc
(
glova
=
gp
,
pulseshape
=
'gauss_rz'
,
fwhm
=
0.33
)
sig
=
pypho_lasmod
(
glova
=
gp
,
power
=
0
,
Df
=
0
,
teta
=
1
*
np
.
pi
/
8.0
)
SSMF
=
pypho_fiber
(
glova
=
gp
,
l
=
80e3
,
D
=
0.0
,
S
=
0.0
,
alpha
=
1.0e-12
,
gamma
=
1.4
,
phi_max
=
0.9
)
# Simulation
# Define wavelength channels
bits
=
bitsrc
()
esig
=
esigsrc
(
bitsequence
=
bits
)
E
=
sig
(
esig
=
esig
)
E_Tx
=
copy
.
deepcopy
(
E
)
# Create birefarray
fibres
=
[]
fibres
.
append
(
pypho_fiber_birefringence
(
0
,
0
,
0.001
))
#fibres.append(pypho_fiber_birefringence(40e3, np.pi/2, 0.001))
# Fiber transmission
E
=
SSMF
(
E
=
E
,
birefarray
=
fibres
)
# Plot power of both pol axis as function of transmission distance
plt
.
figure
(
2
)
plt
.
ylabel
(
'$|E|^2$'
);
plt
.
xlabel
(
'Time [ps]'
);
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_Tx
[
0
][
'E'
][
0
])
**
2
,
'r'
,
alpha
=
0.4
,
label
=
'$E_x$ input'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E_Tx
[
0
][
'E'
][
1
])
**
2
,
'g'
,
alpha
=
0.4
,
label
=
'$E_y$ input'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E
[
0
][
'E'
][
0
])
**
2
,
'r'
,
label
=
'$E_x$ output'
)
plt
.
plot
(
gp
.
timeax
*
1.0e12
,
np
.
abs
(
E
[
0
][
'E'
][
1
])
**
2
,
'g'
,
label
=
'$E_y$ output'
)
plt
.
grid
(
True
);
legend
=
plt
.
legend
(
loc
=
'upper right'
);
plt
.
show
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment