def test_from_lambda(self): """ Check conversions from lambda to nu and lambda to omega """ domain = Domain() self.assertEqual(lambda_to_nu(domain.centre_lambda), domain.centre_nu) self.assertEqual(lambda_to_omega(domain.centre_lambda), domain.centre_omega) assert_array_almost_equal(lambda_to_nu(domain.Lambda), domain.nu) assert_array_almost_equal(lambda_to_omega(domain.Lambda), domain.omega)
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/>. """ import sys from pyofss.domain import nu_to_omega, lambda_to_nu 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()
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 import numpy as np from pyofss import Domain, System, Sech, Fibre from pyofss.domain import lambda_to_nu from pyofss.modules.linearity import convert_dispersion_to_physical from pyofss import map_plot, waterfall_plot, animated_plot, labels domain = Domain(bit_width=2.0, samples_per_bit=8192, centre_nu=lambda_to_nu(1550.0)) s = 0.05 width = 1.0 / (s * domain.centre_omega) tau_R = 0.1 T_R = tau_R * width D = 16.0 beta_2 = convert_dispersion_to_physical(D)[0] delta_3 = 0.03 beta_3 = 6.0 * np.abs(beta_2) * width * delta_3 beta = [0.0, 0.0, beta_2, beta_3]
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 import numpy as np from pyofss import Domain, System, Sech, Fibre from pyofss.domain import lambda_to_nu from pyofss.modules.linearity import convert_dispersion_to_physical from pyofss import map_plot, waterfall_plot, animated_plot, labels domain = Domain(bit_width=2.0, samples_per_bit=8192, centre_nu=lambda_to_nu(1550.0)) s = 0.05 width = 1.0 / (s * domain.centre_omega) tau_R = 0.1 T_R = tau_R * width D = 16.0 beta_2 = convert_dispersion_to_physical(D)[0] delta_3 = 0.03 beta_3 = 6.0 * np.abs(beta_2) * width * delta_3 beta = [0.0, 0.0, beta_2, beta_3]
self.field = ifftshift(fft(field)) if self.dir_to_up is True: self.field[:self.ind] = 0.0 else: self.field[self.ind:] = 0.0 return ifft(fftshift(self.field + self.field_pump)) if __name__ == "__main__": from pyofss import * cwl = 1030.0 domain = Domain( centre_nu=lambda_to_nu(cwl), samples_per_bit=1024*16, bit_width = 1600.0) ds = Diss_soliton( width = 30., peak_power = 10., offset_nu = dlambda_to_dnu(5, cwl), C = 60) sech = Sech( width = 10, peak_power = 5.0, offset_nu = -dlambda_to_dnu(10, cwl)) sys = System( domain ) sys.add( sech ) sys.run()