Exemplo n.º 1
0
	def refresh_nullclines(self):
		x_i = np.arange(self.x_min, self.x_max, 0.01)

		nullcline_x = model.nullcline_x(x_i, model.params['I_0'], model.params['m_0'])
		nullcline_y = model.nullcline_y(x_i, model.params['x_0'], model.params['k_0'])

		xscale, yscale = 1., 3.
		nullcline_x, X_i = tl.adjustForPlotting(nullcline_x, x_i, ratio=xscale/yscale, threshold=0.03*xscale)
		nullcline_y, x_i = tl.adjustForPlotting(nullcline_y, x_i, ratio=xscale/yscale, threshold=0.03*xscale)

		self.li_ncl_x.set_data(nullcline_x, X_i)
		self.li_ncl_y.set_data(nullcline_y, x_i)

		if not self.network == None:
			g = self.network.coupling_strength

			if all( (g[0] == g_i for g_i in g) ):
				nullcline_xg = model.nullcline_x(X_i, model.params['I_0'], model.params['m_0'], model.params['E_0'], g[0])
				self.li_sft_ncl_x.set_data(nullcline_xg, X_i)

			else:
				self.li_sft_ncl_x.set_data([], [])
			

		self.fig.canvas.draw()
Exemplo n.º 2
0
    def refresh_nullclines(self):
        x_i = np.arange(self.x_min, self.x_max, 0.01)

        nullcline_x = model.nullcline_x(x_i, model.params['I_0'],
                                        model.params['m_0'])
        nullcline_y = model.nullcline_y(x_i, model.params['x_0'],
                                        model.params['k_0'])

        xscale, yscale = 1., 3.
        nullcline_x, X_i = tl.adjustForPlotting(nullcline_x,
                                                x_i,
                                                ratio=xscale / yscale,
                                                threshold=0.03 * xscale)
        nullcline_y, x_i = tl.adjustForPlotting(nullcline_y,
                                                x_i,
                                                ratio=xscale / yscale,
                                                threshold=0.03 * xscale)

        self.li_ncl_x.set_data(nullcline_x, X_i)
        self.li_ncl_y.set_data(nullcline_y, x_i)

        if not self.network == None:
            g = self.network.coupling_strength

            if all((g[0] == g_i for g_i in g)):
                nullcline_xg = model.nullcline_x(X_i, model.params['I_0'],
                                                 model.params['m_0'],
                                                 model.params['E_0'], g[0])
                self.li_sft_ncl_x.set_data(nullcline_xg, X_i)

            else:
                self.li_sft_ncl_x.set_data([], [])

        self.fig.canvas.draw()
Exemplo n.º 3
0
    def refresh_orbit(self):

        try:
            self.compute_prc(kick=0.01, N_integrate=10 ** 4)  # also computes orbit
            self.tx_state_space.set_text("")

        except:
            self.tx_state_space.set_text("No closed orbit found!")

        phi = np.arange(500) / float(499.0)

        X = self.evaluate_orbit(tl.PI2 * phi)
        xscale, yscale = 1.0, 3.0
        y, x = tl.adjustForPlotting(X[1], X[0], ratio=xscale / yscale, threshold=0.03 * xscale)
        y[-1], x[-1] = y[0], x[0]
        self.li_traj.set_data(y, x)

        PRC = self.evaluate_prc(tl.PI2 * phi)
        self.li_prc1.set_data(tl.adjustForPlotting(phi, PRC[0], ratio=xscale / yscale, threshold=0.03 * xscale))
        self.li_prc1_traj.set_data(tl.adjustForPlotting(phi, X[0], ratio=xscale / yscale, threshold=0.03 * xscale))
        self.li_prc2.set_data(tl.adjustForPlotting(phi, PRC[1], ratio=xscale / yscale, threshold=0.03 * xscale))
        self.li_prc2_traj.set_data(tl.adjustForPlotting(phi, X[1], ratio=xscale / yscale, threshold=0.03 * xscale))
        self.ax_prc1.set_ylim(min(PRC[0]), max(PRC[0]))
        self.ax_prc2.set_ylim(min(PRC[1]), max(PRC[1]))

        self.fig.canvas.draw()
        try:
            self.torus.vectorField_prc()
        except:
            pass

        try:
            self.traces.computeTraces()
        except:
            pass
Exemplo n.º 4
0
    def refresh_orbit(self):

        try:
            self.compute_prc(kick=0.01,
                             N_integrate=10**4)  # also computes orbit
            self.tx_state_space.set_text("")

        except:
            self.tx_state_space.set_text("No closed orbit found!")

        phi = np.arange(500) / float(499.)

        X = self.evaluate_orbit(tl.PI2 * phi)
        xscale, yscale = 1., 3.
        y, x = tl.adjustForPlotting(X[1],
                                    X[0],
                                    ratio=xscale / yscale,
                                    threshold=0.03 * xscale)
        y[-1], x[-1] = y[0], x[0]
        self.li_traj.set_data(y, x)

        PRC = self.evaluate_prc(tl.PI2 * phi)
        self.li_prc1.set_data(
            tl.adjustForPlotting(phi,
                                 PRC[0],
                                 ratio=xscale / yscale,
                                 threshold=0.03 * xscale))
        self.li_prc1_traj.set_data(
            tl.adjustForPlotting(phi,
                                 X[0],
                                 ratio=xscale / yscale,
                                 threshold=0.03 * xscale))
        self.li_prc2.set_data(
            tl.adjustForPlotting(phi,
                                 PRC[1],
                                 ratio=xscale / yscale,
                                 threshold=0.03 * xscale))
        self.li_prc2_traj.set_data(
            tl.adjustForPlotting(phi,
                                 X[1],
                                 ratio=xscale / yscale,
                                 threshold=0.03 * xscale))
        self.ax_prc1.set_ylim(min(PRC[0]), max(PRC[0]))
        self.ax_prc2.set_ylim(min(PRC[1]), max(PRC[1]))

        self.fig.canvas.draw()
        try:
            self.torus.vectorField_prc()
        except:
            pass

        try:
            self.traces.computeTraces()
        except:
            pass
Exemplo n.º 5
0
	def computeTraces(self, initial_condition=None, plotit=True):

		if initial_condition == None:
			initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand())

		V_i = fh.integrate_three_rk4(
				initial_condition,
				self.network.coupling_strength,
				self.system.dt/float(self.system.stride),
				self.system.N_output(self.CYCLES),
				self.system.stride)

		t = self.system.dt*np.arange(V_i.shape[0])

		if plotit:
			ticks = np.asarray(t[::t.size/10], dtype=int)

			xscale, yscale = t[-1], 2.
			for (i, li) in enumerate([self.li_b, self.li_g, self.li_r]):
				tj, Vj = tl.adjustForPlotting(t, V_i[:, i], ratio=xscale/yscale, threshold=0.05*xscale)
				li.set_data(tj, Vj-i*2)

			self.ax.set_xticks(ticks)
			self.ax.set_xticklabels(ticks)
			self.ax.set_xlim(t[0], t[-1])
			self.fig.canvas.draw()

		return t, V_i
Exemplo n.º 6
0
    def refresh_orbit(self):

        try:
            new_x, new_y, new_period = model.single_orbit(N_ORBIT=10**4)
            self.x_orbit, self.y_orbit, self.orbit_period = new_x, new_y, new_period
            self.tx_state_space.set_text("")

        except:
            self.tx_state_space.set_text("No closed orbit found!")
            pass

        phi = np.arange(500) / float(499.)

        xscale, yscale = 1., 3.
        y, x = tl.adjustForPlotting(self.y_orbit(tl.PI2 * phi),
                                    self.x_orbit(tl.PI2 * phi),
                                    ratio=xscale / yscale,
                                    threshold=0.03 * xscale)
        y[-1], x[-1] = y[0], x[0]

        self.li_traj.set_data(y, x)
        self.fig.canvas.draw()

        try:
            self.traces.computeTraces()
        except:
            pass
Exemplo n.º 7
0
	def refresh_orbit(self):
	
		try:
			new_x, new_y, new_period = model.single_orbit(N_ORBIT=10**4)
			self.x_orbit, self.y_orbit, self.orbit_period = new_x, new_y, new_period
			self.tx_state_space.set_text("")
	
		except:
			self.tx_state_space.set_text("No closed orbit found!")
			pass
		
		phi = np.arange(500)/float(499.)

		xscale, yscale = 1., 3.
		y, x = tl.adjustForPlotting(self.y_orbit(tl.PI2*phi), self.x_orbit(tl.PI2*phi), ratio=xscale/yscale, threshold=0.03*xscale)
		y[-1], x[-1] = y[0], x[0]

		self.li_traj.set_data(y, x)
		self.fig.canvas.draw()

		try:
			self.traces.computeTraces()
		except:
			pass