Beispiel #1
0
    def __init__(self,
                 name="fibre",
                 length=1.0,
                 alpha=None,
                 beta=None,
                 gamma=0.0,
                 sim_type=None,
                 traces=1,
                 local_error=1.0e-6,
                 method="RK4IP",
                 total_steps=100,
                 self_steepening=False,
                 raman_scattering=False,
                 rs_factor=0.003,
                 use_all=False,
                 centre_omega=None,
                 tau_1=12.2e-3,
                 tau_2=32.0e-3,
                 f_R=0.18):

        use_cache = not (method.upper().startswith('A'))

        self.name = name
        self.length = length
        self.linearity = Linearity(alpha, beta, sim_type, use_cache,
                                   centre_omega)
        self.nonlinearity = Nonlinearity(gamma, sim_type, self_steepening,
                                         raman_scattering, rs_factor, use_all,
                                         tau_1, tau_2, f_R)

        class Function():
            """ Class to hold linear and nonlinear functions. """
            def __init__(self, l, n, linear, nonlinear):
                self.l = l
                self.n = n
                self.linear = linear
                self.nonlinear = nonlinear

            def __call__(self, A, z):
                return self.l(A, z) + self.n(A, z)

        self.function = Function(self.l, self.n, self.linear, self.nonlinear)

        self.stepper = Stepper(traces, local_error, method, self.function,
                               self.length, total_steps)