def test_from_nu(self): """ Check conversions from nu to omega and nu to lambda """ domain = Domain() self.assertEqual(nu_to_omega(domain.centre_nu), domain.centre_omega) self.assertEqual(nu_to_lambda(domain.centre_nu), domain.centre_lambda) assert_array_almost_equal(nu_to_omega(domain.nu), domain.omega) assert_array_almost_equal(nu_to_lambda(domain.nu), domain.Lambda)
from pyofss import Domain, System, Gaussian, Fibre from pyofss import map_plot, waterfall_plot, animated_plot, labels nu_0 = lambda_to_nu(1060.0) nu_1 = lambda_to_nu(1550.0) offset_nu = nu_0 - nu_1 system = System(Domain(bit_width=20.0, samples_per_bit=8192, channels=2, centre_nu=nu_0)) system.add(Gaussian(width=1.0, peak_power=1000.0, channel=0)) system.add(Gaussian(width=1.0, peak_power=0.1, channel=1, 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'):