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))
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) = list(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))
def __str__(self): """ :return: Information string :rtype: string Output information on Filter. """ output_string = [ 'width_nu = {0:f} THz', 'fwhm_nu = {1:f} THz', 'offset_nu = {2:f} THz', 'm = {3:d}', 'channel = {4:d}', 'type_filt = {5:s}' ] return "\n".join(output_string).format(self.width_nu, self.calculate_fwhm(), self.offset_nu, self.m, self.channel, self.type) if __name__ == "__main__": """ Plot the power transfer function of the filter """ from pyofss import Domain, Filter, single_plot domain = Domain(centre_nu=193.0) gauss_filter = Filter(offset_nu=1.5) filter_tf = gauss_filter.transfer_function(domain.nu, domain.centre_nu) # Expect the filter transfer function to be centred at 194.5 THz: single_plot(domain.nu, filter_tf)
the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, 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/>. """ from pyofss import Domain, System, Gaussian, Fibre from pyofss import spectral_power, single_plot, labels domain = Domain(bit_width=4.0, samples_per_bit=4096) s = 0.01 width = 1.0 / (s * domain.centre_omega) system = System(domain) system.add(Gaussian(peak_power=1.0, width=width)) system.add(Fibre(length=20.0, gamma=1.0, total_steps=200, self_steepening=True, method="RK4IP")) system.run() P_nu_normalised = spectral_power(system.fields['fibre'], True) single_plot(system.domain.nu, P_nu_normalised, labels["nu"], labels["P_nu"], filename="4-20", x_range=(145.1, 256.1))
factor = power(delta_nu / self.width_nu, (2 * self.m)) self.shape = exp(-0.5 * factor) return np.abs(self.shape) ** 2 def __str__(self): """ :return: Information string :rtype: string Output information on Filter. """ output_string = [ 'width_nu = {0:f} THz', 'fwhm_nu = {1:f} THz', 'offset_nu = {2:f} THz', 'm = {3:d}', 'channel = {4:d}'] return "\n".join(output_string).format( self.width_nu, self.calculate_fwhm(), self.offset_nu, self.m, self.channel) if __name__ == "__main__": """ Plot the power transfer function of the filter """ from pyofss import Domain, Filter, single_plot domain = Domain(centre_nu=193.0) gauss_filter = Filter(offset_nu=1.5) filter_tf = gauss_filter.transfer_function(domain.nu, domain.centre_nu) # Expect the filter transfer function to be centred at 194.5 THz: single_plot(domain.nu, filter_tf)
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 spectral_power, single_plot, labels domain = Domain(bit_width=4.0, samples_per_bit=4096) s = 0.01 width = 1.0 / (s * domain.centre_omega) system = System(domain) system.add(Gaussian(peak_power=1.0, width=width)) system.add( Fibre(length=20.0, gamma=1.0, total_steps=200, self_steepening=True, method="RK4IP")) system.run() P_nu_normalised = spectral_power(system.fields['fibre'], True) single_plot(system.domain.nu, P_nu_normalised, labels["nu"], labels["P_nu"], filename="4-20", x_range=(145.1, 256.1))