system = System(Domain(bit_width=200.0, samples_per_bit=2048)) system.add(Gaussian("gaussian", peak_power=1.0, width=1.0)) system.run() P_ts = [temporal_power(system.fields['gaussian'])] fibres = [ Fibre(length=5.0, beta=[0.0, 0.0, 0.0, 1.0], total_steps=100), Fibre(length=5.0, beta=[0.0, 0.0, 1.0, 1.0], total_steps=100) ] for fibre in fibres: system = System(Domain(bit_width=200.0, samples_per_bit=2048)) system.add(Gaussian(peak_power=1.0, width=1.0)) system.add(fibre) system.run() P_ts.append(temporal_power(system.fields['fibre'])) z_labels = [ r"$z = 0 \, km$", r"$z = 5 \, km$, $\beta_2 = \, 0 \, ps / (nm \cdot km)$", r"$z = 5 \, km$, $\beta_2 \neq \, 0 \, ps / (nm \cdot km)$" ] multi_plot(system.domain.t, P_ts, z_labels, labels["t"], labels["P_t"], z_labels, [-5.0, 15.0], filename="3-6")
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ from pyofss import Domain, System, Gaussian, Fibre from pyofss import temporal_power, multi_plot, labels system = System(Domain(bit_width=200.0, samples_per_bit=2048)) system.add(Gaussian("gaussian", peak_power=1.0, width=1.0)) system.run() P_ts = [temporal_power(system.fields['gaussian'])] fibres = [Fibre(length=5.0, beta=[0.0, 0.0, 0.0, 1.0], total_steps=100), Fibre(length=5.0, beta=[0.0, 0.0, 1.0, 1.0], total_steps=100)] for fibre in fibres: system = System(Domain(bit_width=200.0, samples_per_bit=2048)) system.add(Gaussian(peak_power=1.0, width=1.0)) system.add(fibre) system.run() P_ts.append(temporal_power(system.fields['fibre'])) z_labels = [r"$z = 0 \, km$", r"$z = 5 \, km$, $\beta_2 = \, 0 \, ps / (nm \cdot km)$", r"$z = 5 \, km$, $\beta_2 \neq \, 0 \, ps / (nm \cdot km)$"] multi_plot(system.domain.t, P_ts, z_labels, labels["t"], labels["P_t"], z_labels, [95.0, 115.0], filename="3-6")
P_ts = [] chirps = [] zs = [0.0, 2.0, 4.0] for z in zs: 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=z, beta=[0.0, 0.0, -1.0, 0.0])) system.run() field = system.fields['fibre'] P_ts.append(temporal_power(field)) temp = [f if abs(f) >= 5e-12 else 0.0 for f in field] chirps.append(chirp(temp, system.domain.window_nu)) multi_plot(system.domain.t, P_ts, zs, labels["t"], labels["P_t"], [r"$z = {0:.0f} \, km$"], (-10.0, 10.0), filename="3-1") multi_plot(system.domain.t, chirps, zs, labels["t"], labels["chirp"], [r"$z = {0:.0f} \, km$"], (-10.0, 10.0), (-6.0, 6.0), filename="3-1_chirp")
a high zoom level. """ from pyofss import Domain, System, Gaussian, Fibre from pyofss import temporal_power, multi_plot, labels domain = Domain(bit_width=200.0, samples_per_bit=2048) gaussian = Gaussian(peak_power=1.0, width=1.0) P_ts = [] methods = ['ss_simple', 'ss_symmetric', 'ss_sym_rk4', 'rk4ip'] for m in methods: sys = System(domain) sys.add(gaussian) sys.add( Fibre(length=5.0, method=m, total_steps=50, beta=[0.0, 0.0, 0.0, 1.0], gamma=1.0)) sys.run() P_ts.append(temporal_power(sys.field)) multi_plot(sys.domain.t, P_ts, methods, labels["t"], labels["P_t"], methods, x_range=(80.0, 140.0))
from pyofss import temporal_power, multi_plot, labels domain = Domain(bit_width=2.0, samples_per_bit=4096) s = 0.01 width = 1.0 / (s * domain.centre_omega) P_ts = [] zs = [0.0, 10.0, 20.0] for z in zs: system = System(domain) system.add(Gaussian(peak_power=1.0, width=width)) system.add( Fibre(length=z, gamma=1.0, total_steps=200, self_steepening=True, method="RK4IP")) system.run() field = system.fields['fibre'] P_ts.append(temporal_power(field)) multi_plot(system.domain.t, P_ts, zs, labels["t"], labels["P_t"], [r"$z = {0:.0f} \, km$"], (-0.3, 0.3), filename="4-19")
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ from pyofss import Domain, System, Gaussian, Fibre from pyofss import temporal_power, chirp, multi_plot, labels P_ts = [] chirps = [] zs = [0.0, 2.0, 4.0] for z in zs: 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=z, beta=[0.0, 0.0, -1.0, 0.0])) system.run() field = system.fields['fibre'] P_ts.append(temporal_power(field)) temp = [f if abs(f) >= 5e-12 else 0.0 for f in field] chirps.append(chirp(temp, system.domain.window_nu)) multi_plot(system.domain.t, P_ts, zs, labels["t"], labels["P_t"], [r"$z = {0:.0f} \, km$"], (90.0, 110.0), filename="3-1") multi_plot(system.domain.t, chirps, zs, labels["t"], labels["chirp"], [r"$z = {0:.0f} \, km$"], (90.0, 110.0), (-6.0, 6.0), filename="3-1_chirp")
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/>. """ from pyofss import Domain, System, Sech, Fibre from pyofss import temporal_power, multi_plot, labels domain = Domain(bit_width=0.4, samples_per_bit=4096) s = 0.2 width = 1.0 / (s * domain.centre_omega) beta_2 = width ** 2 P_ts = [] zs = [0.0, 5.0, 10.0] for z in zs: system = System(domain) system.add(Sech(peak_power=1.0, width=width)) system.add(Fibre(length=z, gamma=1.0, total_steps=200, self_steepening=True, beta=[0.0, 0.0, -beta_2])) system.run() field = system.fields['fibre'] P_ts.append(temporal_power(field)) multi_plot(system.domain.t, P_ts, zs, labels["t"], labels["P_t"], [r"$z = {0:.0f} \, km$"], (0.175, 0.225), filename="5-18")
return self.nonlinearity.exp_non(A, h, B) if __name__ == "__main__": """ Plot the result of a Gaussian pulse propagating through optical fibre. Simulates both (third-order) dispersion and nonlinearity. Use five different methods: ss_simple, ss_symmetric, ss_sym_rk4, ss_sym_rkf, and rk4ip. Expect all five methods to produce similar results; plot traces should all overlap. Separate traces should only be seen at a high zoom level. """ from pyofss import Domain, System, Gaussian, Fibre from pyofss import temporal_power, multi_plot, labels domain = Domain(bit_width=200.0, samples_per_bit=2048) gaussian = Gaussian(peak_power=1.0, width=1.0) P_ts = [] methods = ['ss_simple', 'ss_symmetric', 'ss_sym_rk4', 'rk4ip'] for m in methods: sys = System(domain) sys.add(gaussian) sys.add(Fibre(length=5.0, method=m, total_steps=50, beta=[0.0, 0.0, 0.0, 1.0], gamma=1.0)) sys.run() P_ts.append(temporal_power(sys.field)) multi_plot(sys.domain.t, P_ts, methods, labels["t"], labels["P_t"], methods, x_range=(80.0, 140.0))
domain = Domain(bit_width=0.4, samples_per_bit=4096) s = 0.2 width = 1.0 / (s * domain.centre_omega) beta_2 = width**2 P_ts = [] zs = [0.0, 5.0, 10.0] for z in zs: system = System(domain) system.add(Sech(peak_power=1.0, width=width)) system.add( Fibre(length=z, gamma=1.0, total_steps=200, self_steepening=True, beta=[0.0, 0.0, -beta_2])) system.run() field = system.fields['fibre'] P_ts.append(temporal_power(field)) multi_plot(system.domain.t, P_ts, zs, labels["t"], labels["P_t"], [r"$z = {0:.0f} \, km$"], (0.175, 0.225), filename="5-18")
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/>. """ from pyofss import Domain, System, Gaussian, Fibre from pyofss import temporal_power, multi_plot, labels domain = Domain(bit_width=2.0, samples_per_bit=4096) s = 0.01 width = 1.0 / (s * domain.centre_omega) P_ts = [] zs = [0.0, 10.0, 20.0] for z in zs: system = System(domain) system.add(Gaussian(peak_power=1.0, width=width)) system.add(Fibre(length=z, gamma=1.0, total_steps=200, self_steepening=True, method="RK4IP")) system.run() field = system.fields['fibre'] P_ts.append(temporal_power(field)) multi_plot(system.domain.t, P_ts, zs, labels["t"], labels["P_t"], [r"$z = {0:.0f} \, km$"], (0.7, 1.3), filename="4-19")