示例#1
0
def generate_overview_plots(domain):
    """ Generate single, map, and waterfall plots of the soliton collision. """
    system = System(domain)
    system.add(Sech(peak_power=8.8e-3, width=(1.0 / 0.44),
                    position=0.625))
    system.add(Sech(peak_power=8.8e-3, width=(1.0 / 0.44),
                    position=0.375, offset_nu=-0.8))
    system.add(Fibre(length=400.0, beta=[0.0, 0.0, -0.1, 0.0],
                     gamma=2.2, total_steps=400, traces=100,
                     method='ARK4IP', local_error=1e-6))
    system.run()

    storage = system['fibre'].stepper.storage
    (x, y, z) = storage.get_plot_data(reduced_range=(140.0, 360.0))

    # Split step_sizes (list of tuples) into separate lists;
    # distances and steps:
    (distances, steps) = zip(*storage.step_sizes)

    print np.sum(steps)

    single_plot(distances, steps, labels["z"], "Step size, h (km)",
                filename="soliton_collision_steps")

    map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"],
             filename="soliton_collision_map")

    waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"],
                   filename="soliton_collision_waterfall",
                   y_range=(0.0, 0.02))
示例#2
0
文件: soliton.py 项目: daibo/pyofss
def generate_map_and_waterfall_plots(domain):
    """ Generate map and waterfall plots to visualise pulse propagation. """
    system = System(domain)
    system.add(Sech(peak_power=4.0, width=1.0))
    system.add(
        Fibre(
            "fibre",
            length=0.5 * np.pi,
            beta=[0.0, 0.0, -1.0, 0.0],
            gamma=1.0,
            method="rk4ip",
            total_steps=1000,
            traces=50,
        )
    )
    system.run()

    storage = system["fibre"].stepper.storage
    (x, y, z) = storage.get_plot_data(reduced_range=(95.0, 105.0))

    map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"], filename="soliton_map")

    waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"], filename="soliton_waterfall", y_range=(0.0, 16.0))
示例#3
0
(x, y, z_temp) = storage.get_plot_data(channel=0)
z_label = r"Fibre length, $z \, (m)$"
z = z_temp * 1.0e3

map_plot(x,
         y,
         z,
         labels["t"],
         labels["P_t"],
         z_label,
         filename="7-9_map_t_pump")

waterfall_plot(x,
               y,
               z,
               labels["t"],
               z_label,
               labels["P_t"],
               filename="7-9_waterfall_t_pump",
               y_range=(0.0, 1.0e3))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["t"],
                  labels["P_t"],
                  r"$z = {0:7.3f} \, m$", (x[0], x[-1]), (0.0, 1.0e3),
                  fps=20,
                  frame_prefix="pump_",
                  filename="7-9_animation_t_pump.avi")
示例#4
0
(x, y, z_temp) = storage.get_plot_data(False, (71.9, 314.9), True)
z_label = r"Fibre length, $z \, (cm)$"
z = z_temp * 1.0e5

map_plot(x,
         y,
         z,
         labels["nu"],
         labels["P_nu"],
         z_label,
         filename="5-23_map_nu")

waterfall_plot(x,
               y,
               z,
               labels["nu"],
               z_label,
               labels["P_nu"],
               filename="5-23_waterfall_nu",
               y_range=(0.0, 1.1))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["nu"],
                  labels["P_nu"],
                  r"$z = {0:7.3f} \, cm$", (x[0], x[-1]), (0.0, 1.1),
                  fps=20,
                  frame_prefix="nu_",
                  filename="5-23_animation_nu.avi")
示例#5
0
    Fibre(length=6.0,
          beta=[0.0, 0.0, 0.0, 1.0],
          traces=100,
          total_steps=200,
          method='RK4IP'))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(reduced_range=(-10.0, 40.0))

map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"], filename="3-7_map")

waterfall_plot(x,
               y,
               z,
               labels["t"],
               labels["z"],
               labels["P_t"],
               filename="3-7_waterfall")

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["t"],
                  labels["P_t"],
                  r"$z = {0:7.3f} \, km$",
                  x_range=(-10.0, 20.0),
                  y_range=(0.0, 1.6),
                  fps=10,
                  frame_prefix="t_",
示例#6
0
storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(False, (192.6, 193.6), normalised=True)

map_plot(x,
         y,
         z,
         labels["nu"],
         labels["P_nu"],
         labels["z"],
         filename="4-11_map_nu")

waterfall_plot(x,
               y,
               z,
               labels["nu"],
               labels["z"],
               labels["P_nu"],
               filename="4-11_waterfall_nu",
               y_range=(0.0, 0.5))

if (len(sys.argv) > 1 and sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["nu"],
                  labels["P_nu"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1),
                  fps=20,
                  frame_prefix="nu_",
                  filename="4-11_animation_nu.avi")
示例#7
0
storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(reduced_range=(-10.0, 10.0))

map_plot(x,
         y,
         z,
         labels["t"],
         labels["P_t"],
         labels["z"],
         filename="5-9_map_t")

waterfall_plot(x,
               y,
               z,
               labels["t"],
               labels["z"],
               labels["P_t"],
               filename="5-9_waterfall_t",
               y_range=(0.0, 1.64))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["t"],
                  labels["P_t"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.64),
                  fps=20,
                  frame_prefix="t_",
                  filename="5-9_animation_t.avi")
示例#8
0
文件: fig_3_7.py 项目: LeiDai/pyofss
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

import sys
from pyofss import Domain, System, Gaussian, Fibre
from pyofss import map_plot, waterfall_plot, animated_plot, labels

system = System(Domain(bit_width=600.0, samples_per_bit=4096))
system.add(Gaussian(peak_power=1.0, width=1.0, m=3))
system.add(Fibre(length=6.0, beta=[0.0, 0.0, 0.0, 1.0], traces=100,
                 total_steps=200, method='RK4IP'))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(reduced_range=(290.0, 340.0))

map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"], filename="3-7_map")

waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"],
               filename="3-7_waterfall")

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["t"], labels["P_t"], r"$z = {0:7.3f} \, km$",
                  x_range=(290.0, 320.0), y_range=(0.0, 1.6), fps=10,
                  frame_prefix="t_", filename="3-7_animation.avi")
示例#9
0
文件: fig_5_6.py 项目: LeiDai/pyofss
from pyofss import Domain, System, Sech, Fibre
from pyofss import map_plot, waterfall_plot, animated_plot, labels

system = System(Domain(bit_width=100.0, samples_per_bit=4096))
system.add(Sech(peak_power=1.0, width=1.0))
system.add(Fibre(length=0.5 * np.pi, beta=[0.0, 0.0, -1.0, 0.0],
                 gamma=9.0, traces=100, method='ARK4IP'))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(False, (191.1, 195.1), normalised=True)

map_plot(x, y, z, labels["nu"], labels["P_nu"], labels["z"],
         filename="5-6_map_nu")

waterfall_plot(x, y, z, labels["nu"], labels["z"], labels["P_nu"],
               filename="5-6_waterfall_nu", y_range=(0.0, 1.0))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["nu"], labels["P_nu"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1), fps=20,
                  frame_prefix="nu_", filename="5-6_animation_nu.avi")

(x, y, z) = storage.get_plot_data(reduced_range=(46.0, 54.0))

map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"],
         filename="5-6_map_t")

waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"],
               filename="5-6_waterfall_t", y_range=(0.0, 6.0))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
示例#10
0
storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(False, (192.1, 194.1), normalised=True)

map_plot(x,
         y,
         z,
         labels["nu"],
         labels["P_nu"],
         labels["z"],
         filename="4-8_map_nu")

waterfall_plot(x,
               y,
               z,
               labels["nu"],
               labels["z"],
               labels["P_nu"],
               filename="4-8_waterfall_nu")

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["nu"],
                  labels["P_nu"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1),
                  fps=10,
                  frame_prefix="nu_",
                  filename="4-8_animation_nu.avi")
示例#11
0
文件: fig_5_23.py 项目: LeiDai/pyofss
system = System(domain)
system.add(Sech(peak_power=P_0, width=width))
system.add(Fibre(length=length, gamma=gamma, beta=beta, rs_factor=T_R,
                 raman_scattering=True, self_steepening=True,
                 total_steps=200, traces=100, method='ARK4IP'))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z_temp) = storage.get_plot_data(False, (71.9, 314.9), True)
z_label = r"Fibre length, $z \, (cm)$"
z = z_temp * 1.0e5

map_plot(x, y, z, labels["nu"], labels["P_nu"], z_label,
         filename="5-23_map_nu")

waterfall_plot(x, y, z, labels["nu"], z_label, labels["P_nu"],
               filename="5-23_waterfall_nu", y_range=(0.0, 1.1))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["nu"], labels["P_nu"],
                  r"$z = {0:7.3f} \, cm$", (x[0], x[-1]), (0.0, 1.1), fps=20,
                  frame_prefix="nu_", filename="5-23_animation_nu.avi")

(x, y, z_temp) = storage.get_plot_data(reduced_range=(0.9, 1.4))
z = z_temp * 1.0e5

map_plot(x, y, z, labels["t"], labels["P_t"], z_label, filename="5-23_map_t")

waterfall_plot(x, y, z, labels["t"], z_label, labels["P_t"],
               filename="5-23_waterfall_t", y_range=(0.0, 2.6))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
示例#12
0
文件: fig_4_8.py 项目: LeiDai/pyofss
from pyofss import Domain, System, Gaussian, Fibre
from pyofss import map_plot, waterfall_plot, animated_plot, labels

system = System(Domain(bit_width=200.0, samples_per_bit=2048))
system.add(Gaussian(peak_power=1.0, width=1.0))
system.add(Fibre(length=5.0, beta=[0.0, 0.0, 1.0, 0.0],
                 gamma=1.0, traces=50))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(False, (192.1, 194.1), normalised=True)

map_plot(x, y, z, labels["nu"], labels["P_nu"], labels["z"],
         filename="4-8_map_nu")

waterfall_plot(x, y, z, labels["nu"], labels["z"], labels["P_nu"],
               filename="4-8_waterfall_nu")

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["nu"], labels["P_nu"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1), fps=10,
                  frame_prefix="nu_", filename="4-8_animation_nu.avi")


(x, y, z) = storage.get_plot_data(reduced_range=(85.0, 115.0))

map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"],
         filename="4-8_map_t")

waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"],
               filename="4-8_waterfall_t")
示例#13
0
storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(reduced_range=(-10.0, 10.0))

map_plot(x,
         y,
         z,
         labels["t"],
         labels["P_t"],
         labels["z"],
         filename="5-16d_map")

waterfall_plot(x,
               y,
               z,
               labels["t"],
               labels["z"],
               labels["P_t"],
               filename="5-16d_waterfall",
               y_range=(0.0, 1.8))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["t"],
                  labels["P_t"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.8),
                  fps=20,
                  frame_prefix="d_",
                  filename="5-16d_animation.avi")
示例#14
0
文件: fig_4_4.py 项目: LeiDai/pyofss
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

import sys
from pyofss import Domain, System, Gaussian, Fibre
from pyofss import map_plot, waterfall_plot, animated_plot, labels

for m in [1, 3]:
    system = System(Domain(bit_width=200.0, samples_per_bit=2048))
    system.add(Gaussian(peak_power=1.0, width=1.0, m=m))
    system.add(Fibre(length=10.0, gamma=1.0, traces=50))
    system.run()

    storage = system['fibre'].stepper.storage
    (x, y, z) = storage.get_plot_data(is_temporal=False, normalised=True)

    map_plot(x, y, z, labels["nu"], labels["P_nu"], labels["z"],
             filename="4-4_map_m-{0:d}".format(m))

    waterfall_plot(x, y, z, labels["nu"], labels["z"], labels["P_nu"],
                   filename="4-4_waterfall_m-{0:d}".format(m))

    if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
        animated_plot(x, y, z, labels["nu"], labels["P_nu"],
                      r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1),
                      fps=10, frame_prefix="m{0:d}_".format(m),
                      filename="4-4_animation_m-{0:d}.avi".format(m))
示例#15
0
storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(False, (192.1, 194.1), normalised=True)

map_plot(x,
         y,
         z,
         labels["nu"],
         labels["P_nu"],
         labels["z"],
         filename="5-17_map_nu")

waterfall_plot(x,
               y,
               z,
               labels["nu"],
               labels["z"],
               labels["P_nu"],
               filename="5-17_waterfall_nu",
               y_range=(0.0, 1.0))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x,
                  y,
                  z,
                  labels["nu"],
                  labels["P_nu"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1),
                  fps=20,
                  frame_prefix="nu_",
                  filename="5-17_animation_nu.avi")
示例#16
0
import numpy as np
from pyofss import Domain, System, Sech, Fibre
from pyofss import map_plot, waterfall_plot, animated_plot, labels

system = System(Domain(bit_width=100.0, samples_per_bit=2048))

absolute_separation = 3.5
offset = absolute_separation / system.domain.bit_width

system.add(Sech(peak_power=1.0, width=1.0, position=0.5 - offset))
system.add(Sech(peak_power=1.0, width=1.0, position=0.5 + offset,
                initial_phase=np.pi / 4.0))

system.add(Fibre(length=90.0, beta=[0.0, 0.0, -1.0, 0.0], gamma=1.0,
                 total_steps=200, traces=100, method='ARK4IP'))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(reduced_range=(40.0, 60.0))

map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"],
         filename="5-16b_map")

waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"],
               filename="5-16b_waterfall", y_range=(0.0, 1.4))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["t"], labels["P_t"], r"$z = {0:7.3f} \, km$",
                  (x[0], x[-1]), (0.0, 1.4), fps=20, frame_prefix="b_",
                  filename="5-16b_animation.avi")
示例#17
0
文件: fig_7_9.py 项目: LeiDai/pyofss
                    offset_nu=-offset_nu))
system.add(Fibre('fibre', length=0.05, gamma=[0.9, 0.615483871],
           beta=[[0.0, 0.0, 1.0, 0.0], [0.0, 0.0, -1.0, 0.0]],
           centre_omega=(nu_to_omega(nu_0), nu_to_omega(nu_1)),
           sim_type='wdm', method='ARK4IP', traces=100))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z_temp) = storage.get_plot_data(channel=0)
z_label = r"Fibre length, $z \, (m)$"
z = z_temp * 1.0e3

map_plot(x, y, z, labels["t"], labels["P_t"], z_label,
         filename="7-9_map_t_pump")

waterfall_plot(x, y, z, labels["t"], z_label, labels["P_t"],
               filename="7-9_waterfall_t_pump", y_range=(0.0, 1.0e3))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["t"], labels["P_t"], r"$z = {0:7.3f} \, m$",
                  (x[0], x[-1]), (0.0, 1.0e3), fps=20, frame_prefix="pump_",
                  filename="7-9_animation_t_pump.avi")

(x, y, z_temp) = storage.get_plot_data(True, (6.0, 14.0), False, channel=1)
z = z_temp * 1.0e3

map_plot(x, y, z, labels["t"], labels["P_t"], z_label,
         filename="7-9_map_t_probe")

waterfall_plot(x, y, z, labels["t"], z_label, labels["P_t"],
               filename="7-9_waterfall_t_probe", y_range=(0.0, 1.2))
示例#18
0
文件: fig_4_23.py 项目: LeiDai/pyofss
T_R = tau_R * width

system = System(domain)
system.add(Gaussian(peak_power=1.0, width=width))
system.add(Fibre(length=5.0, gamma=4.0, beta=[0.0, 0.0, -1.0],
                 raman_scattering=True, rs_factor=T_R,
                 total_steps=200, traces=200, method='ARK4IP'))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(False, (191.1, 195.1), normalised=True)

map_plot(x, y, z, labels["nu"], labels["P_nu"], labels["z"],
         filename="4-23_map_nu")

waterfall_plot(x, y, z, labels["nu"], labels["z"], labels["P_nu"],
               filename="4-23_waterfall_nu", y_range=(0.0, 1.1))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["nu"], labels["P_nu"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1), fps=20,
                  frame_prefix="nu_", filename="4-23_animation_nu.avi")

(x, y, z) = storage.get_plot_data(reduced_range=(5.0, 45.0))

map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"],
         filename="4-23_map_t")

waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"],
               filename="4-23_waterfall_t", y_range=(0.0, 3.5))

if (len(sys.argv) > 1) and (sys.argv[1] == 'animate'):
示例#19
0
文件: fig_4_11.py 项目: LeiDai/pyofss
from pyofss import Domain, System, Gaussian, Fibre
from pyofss import map_plot, waterfall_plot, animated_plot, labels

system = System(Domain(bit_width=400.0, samples_per_bit=2048))
system.add(Gaussian(peak_power=1.0, width=30.0))
system.add(Fibre(length=90.0, beta=[0.0, 0.0, 1.0, 0.0],
                 gamma=1.0, traces=100))
system.run()

storage = system['fibre'].stepper.storage
(x, y, z) = storage.get_plot_data(False, (192.6, 193.6), normalised=True)

map_plot(x, y, z, labels["nu"], labels["P_nu"], labels["z"],
         filename="4-11_map_nu")

waterfall_plot(x, y, z, labels["nu"], labels["z"], labels["P_nu"],
               filename="4-11_waterfall_nu", y_range=(0.0, 0.5))

if(len(sys.argv) > 1 and sys.argv[1] == 'animate'):
    animated_plot(x, y, z, labels["nu"], labels["P_nu"],
                  r"$z = {0:7.3f} \, km$", (x[0], x[-1]), (0.0, 1.1), fps=20,
                  frame_prefix="nu_", filename="4-11_animation_nu.avi")

(x, y, z) = storage.get_plot_data(reduced_range=(50.0, 350.0))

map_plot(x, y, z, labels["t"], labels["P_t"], labels["z"],
         filename="4-11_map_t")

waterfall_plot(x, y, z, labels["t"], labels["z"], labels["P_t"],
               filename="4-11_waterfall_t")

if(len(sys.argv) > 1 and sys.argv[1] == 'animate'):