コード例 #1
0
    def integrate(self, type='NLS'):

        r = ode(getattr(self, '_func_' + type))
        opt = Odeoptions()
        opt.atol = 1e-12
        opt.rtol = 1e-10
        opt.max_step = self.dz

        r.set_integrator('zvode',
                         method=opt.method,
                         order=opt.order,
                         atol=opt.atol,
                         rtol=opt.rtol,
                         nsteps=opt.nsteps,
                         first_step=opt.first_step,
                         min_step=opt.min_step,
                         max_step=opt.max_step)

        r.set_initial_value(self.a0, 0)

        self.Y = [r.y]

        for i in trange(1, len(self.z)):
            self.Y.append(r.integrate(self.z[i]))

        self.Y = np.array(self.Y)
コード例 #2
0
    def integrate(self):
        r = ode(self.__func_LS_cyc)
        opt = Odeoptions()
        opt.atol = 1e-10
        opt.rtol = 1e-8
        opt.max_step = .005

        r.set_integrator('zvode',
                         method=opt.method,
                         order=opt.order,
                         atol=opt.atol,
                         rtol=opt.rtol,
                         nsteps=opt.nsteps,
                         first_step=opt.first_step,
                         min_step=opt.min_step,
                         max_step=opt.max_step)

        r.set_initial_value(self.a0, 0)

        self.Y = [r.y]

        for i in trange(1, len(self.z)):
            self.Y.append(r.integrate(self.z[i]))

        self.Y = np.array(self.Y)