Exemplo n.º 1
0
def single_orbit(dt=dt,
                 N_integrate=N_integrate,
                 stride=stride,
                 V_threshold=THRESHOLD):
    X = integrate_one_rk4(initial_state,
                          dt=dt / float(stride),
                          N_integrate=N_integrate,
                          stride=stride)
    V, h, n, x, Ca = X[0], X[1], X[2], X[3], X[4]
    V_model, h_model, n_model, x_model, Ca_model = tl.splineLS1D(
    ), tl.splineLS1D(), tl.splineLS1D(), tl.splineLS1D(), tl.splineLS1D()

    try:
        ni = tl.crossings(V, V_threshold)  # convert to millivolts
        V, h, n, x, Ca = V[ni[-2]:ni[-1]], h[ni[-2]:ni[-1]], n[
            ni[-2]:ni[-1]], x[ni[-2]:ni[-1]], Ca[ni[-2]:ni[-1]]
        t = PI2 * np.arange(V.size) / float(V.size - 1)
        V_model.makeModel(V, t)
        h_model.makeModel(h, t)
        n_model.makeModel(n, t)
        x_model.makeModel(x, t)
        Ca_model.makeModel(Ca, t)

    except:
        print '# single_orbit:  No closed orbit found!'
        raise ValueError

    T = dt * V.size

    return V_model, h_model, n_model, x_model, Ca_model, T
Exemplo n.º 2
0
def single_orbit(DT_ORBIT=DT_ORBIT,
                 N_ORBIT=N_ORBIT,
                 STRIDE_ORBIT=STRIDE_ORBIT,
                 V_threshold=THRESHOLD,
                 verbose=0):
    X = integrate_one_rk4(
        -0.04346306,
        0.99599451,
        0.02006609,
        dt=DT_ORBIT / float(STRIDE_ORBIT),
        N_integrate=N_ORBIT,
        stride=STRIDE_ORBIT)
    V, h, m = X[0], X[1], X[2]
    Vm, Hm, Mm = tl.splineLS1D(), tl.splineLS1D(), tl.splineLS1D()

    try:
        ni = tl.crossings(V, V_threshold)  # convert to millivolts
        V, h, m = V[ni[-2]:ni[-1]], h[ni[-2]:ni[-1]], m[ni[-2]:ni[-1]]
        t = PI2 * np.arange(V.size) / float(V.size - 1)
        Vm.makeModel(V, t)
        Hm.makeModel(h, t)
        Mm.makeModel(m, t)

    except:
        print '# single_orbit:  No closed orbit found!'
        raise ValueError

    T = DT_ORBIT * V.size

    return Vm, Hm, Mm, T
Exemplo n.º 3
0
def single_orbit(DT_ORBIT=DT_ORBIT,
                 N_ORBIT=N_ORBIT,
                 STRIDE_ORBIT=STRIDE_ORBIT,
                 V_threshold=THRESHOLD,
                 verbose=0):
    X = integrate_one_rk4(-0.04346306,
                          0.99599451,
                          0.02006609,
                          dt=DT_ORBIT / float(STRIDE_ORBIT),
                          N_integrate=N_ORBIT,
                          stride=STRIDE_ORBIT)
    V, h, m = X[0], X[1], X[2]
    Vm, Hm, Mm = tl.splineLS1D(), tl.splineLS1D(), tl.splineLS1D()

    try:
        ni = tl.crossings(V, V_threshold)  # convert to millivolts
        V, h, m = V[ni[-2]:ni[-1]], h[ni[-2]:ni[-1]], m[ni[-2]:ni[-1]]
        t = PI2 * np.arange(V.size) / float(V.size - 1)
        Vm.makeModel(V, t)
        Hm.makeModel(h, t)
        Mm.makeModel(m, t)

    except:
        print '# single_orbit:  No closed orbit found!'
        raise ValueError

    T = DT_ORBIT * V.size

    return Vm, Hm, Mm, T
Exemplo n.º 4
0
def single_orbit(DT_ORBIT=0.05,
                 N_ORBIT=5 * 10**4,
                 STRIDE_ORBIT=10,
                 V_threshold=0.,
                 verbose=0):

    X = integrate_one_rk4(INITIAL_ORBIT, DT_ORBIT / float(STRIDE_ORBIT),
                          N_ORBIT, STRIDE_ORBIT)
    x_raw, y = cos(X[0]), sin(X[0])
    x_m, y_m = tl.splineLS1D(), tl.splineLS1D()

    try:
        ni = tl.crossings(x_raw, V_threshold)  # convert to millivolts
        x, y = x_raw[ni[-2]:ni[-1]], y[ni[-2]:ni[-1]]
        t = tl.PI2 * np.arange(x.size) / float(x.size - 1)
        x_m.makeModel(x, t)
        y_m.makeModel(y, t)

    except:
        print '# single_orbit:  No closed orbit found!'
        T = DT_ORBIT * x_raw.size  # in msec.
        x = x_raw
        raise ValueError

    T = DT_ORBIT * x.size  # in msec.

    return x_m, y_m, T
Exemplo n.º 5
0
def single_orbit(DT_ORBIT=dt,
                 N_ORBIT=N_integrate,
                 STRIDE_ORBIT=stride,
                 V_threshold=THRESHOLD,
                 verbose=0):

    X = integrate_one_rk4(INITIAL_ORBIT, DT_ORBIT / float(STRIDE_ORBIT),
                          N_ORBIT, STRIDE_ORBIT)
    x_raw, y = X[0], X[1]
    x_m, y_m = tl.splineLS1D(), tl.splineLS1D()

    try:
        ni = np.asarray(tl.crossings(x_raw, V_threshold),
                        dtype=int)  # convert to millivolts
        x, y = x_raw[ni[-2]:ni[-1]], y[ni[-2]:ni[-1]]
        t = tl.PI2 * np.arange(x.size) / float(x.size - 1)
        x_m.makeModel(x, t)
        y_m.makeModel(y, t)

    except:
        print '# single_orbit:  No closed orbit found!'
        raise ValueError

    T = DT_ORBIT * x.size  # in msec.

    return x_m, y_m, T
Exemplo n.º 6
0
	def set_model(self, model):
		self.model = model
		self.integrate = model.integrate_one_rk4	# generates a single trace of all variables
		self.dimensions = model.N_EQ1
		self.trajectory = [tl.splineLS1D(isphase=False) for i in xrange(self.dimensions)]
		self.ORBIT_COMPUTED = False

		self.dt = model.dt
		self.stride = model.stride
		self.N_integrate = model.N_integrate
Exemplo n.º 7
0
	def set_model(self, model):
		self.model = model
		self.integrate = model.integrate_one_rk4
		self.dimensions = model.N_EQ1
		self.trajectory = [tl.splineLS1D(isphase=False) for i in xrange(self.dimensions)]

		self.initial_state = model.initial_state
		self.dt = model.dt
		self.stride = model.stride
		self.N_integrate = model.N_integrate
Exemplo n.º 8
0
def single_orbit(dt=dt, N_integrate=N_integrate, stride=stride, V_threshold=THRESHOLD):
	X = integrate_one_rk4(initial_state, dt=dt/float(stride), N_integrate=N_integrate, stride=stride)
	V, h, n, x, Ca = X[0], X[1], X[2], X[3], X[4]
	V_model, h_model, n_model, x_model, Ca_model =  tl.splineLS1D(), tl.splineLS1D(), tl.splineLS1D(), tl.splineLS1D(), tl.splineLS1D()

	try:
		ni = tl.crossings(V, V_threshold) # convert to millivolts
		V, h, n, x, Ca = V[ni[-2]:ni[-1]], h[ni[-2]:ni[-1]], n[ni[-2]:ni[-1]], x[ni[-2]:ni[-1]], Ca[ni[-2]:ni[-1]]
		t = PI2*np.arange(V.size)/float(V.size-1)
		V_model.makeModel(V, t); h_model.makeModel(h, t); n_model.makeModel(n, t); x_model.makeModel(x, t); Ca_model.makeModel(Ca, t)

	except:
		print '# single_orbit:  No closed orbit found!'
		raise ValueError

	
	T = dt*V.size

	return V_model, h_model, n_model, x_model, Ca_model, T
Exemplo n.º 9
0
def single_orbit(DT_ORBIT=0.05, N_ORBIT=5*10**4, STRIDE_ORBIT=10, V_threshold=0., verbose=0):

	X = integrate_one_rk4(INITIAL_ORBIT, DT_ORBIT/float(STRIDE_ORBIT), N_ORBIT, STRIDE_ORBIT)
	x_raw, y = X[0], X[1]
	x_m, y_m = tl.splineLS1D(), tl.splineLS1D()

	try:
		ni = tl.crossings(x_raw, V_threshold) # convert to millivolts
		x, y = x_raw[ni[-2]:ni[-1]], y[ni[-2]:ni[-1]]
		t = tl.PI2*np.arange(x.size)/float(x.size-1)
		x_m.makeModel(x, t); y_m.makeModel(y, t)
	
	except:
		print '# single_orbit:  No closed orbit found!'
		raise ValueError

	T = DT_ORBIT*x.size	 # in msec.

	return x_m, y_m, T
Exemplo n.º 10
0
    def set_model(self, model):
        self.model = model
        self.integrate = model.integrate_one_rk4  # generates a single trace of all variables
        self.dimensions = model.N_EQ1
        self.trajectory = [
            tl.splineLS1D(isphase=False) for i in xrange(self.dimensions)
        ]
        self.ORBIT_COMPUTED = False

        self.dt = model.dt
        self.stride = model.stride
        self.N_integrate = model.N_integrate
Exemplo n.º 11
0
	def set_model(self, model):
		orb.orbit.set_model(self, model)
		self.PRC_COMPUTED = False
		self.prcurve = [tl.splineLS1D(isphase=False) for i in xrange(self.dimensions)]
Exemplo n.º 12
0
 def set_model(self, model):
     orb.orbit.set_model(self, model)
     self.PRC_COMPUTED = False
     self.prcurve = [
         tl.splineLS1D(isphase=False) for i in xrange(self.dimensions)
     ]