Exemplo n.º 1
0
def main(datafile, err):
    # load a *.txt data file (see spinmob wiki for formatting rules)
    d = spinmob.data.load(datafile)
    
    # create a fitter object (with a reasonable guess for the Rutherford file)
    f = spinmob.data.fitter('a*(x-x0)**2+b', 'a,x0,b')
    
    # set the data and error bar
    ys = d.c('R_=_V/I_(ohm)') # Ohms
    xs = d.c('B_(mT)') / 1000 # T
    es = d.c('error_V5') # V
    
    es = [numpy.sqrt(e**2 + (y*1e-4)**2 + (y*1e-4)**2) for y, e in zip(ys, es)]
    es = pylab.array(es) / 1.2
    
    a = -(ys[-1]-ys[0])/(xs[-1]**2-xs[0]**2)
    x0 = 0
    b = 65
    
    f.set_data(xs, ys, es)
    f.set(a=a, x0=x0, b=b)
    
    f.fit()
    res1 = f.results[0]
    fct1 = lambda x: res1[0] * (x - res1[1])**2 + res1[2]
    
    plt.clf()
    fig = pylab.figure()
    gs = gridspec.GridSpec(4, 4)
    TR = fig.add_subplot(gs[1:, :])
    TR.errorbar(xs, ys, es, fmt=',')
    Xs = pylab.linspace(min(xs), max(xs))
    TR.plot(Xs, fct1(Xs), '-', color='red')
    pylab.xlabel('Magnetic field ($\\times10^{-1}\\mathrm{T}$)')
    pylab.xticks(pylab.linspace(0, 0.5, 6),
        ['{:1.0f}'.format(i) for i in range(6)])
    pylab.xlim(min(xs), max(xs))
    pylab.ylabel('Resistance ($\\Omega$)')
    residual1 = fig.add_subplot(gs[0, :])
    rs = [(y - fct1(x))/e for x, y, e in zip(xs, ys, es)]
    residual1.errorbar(xs, rs, 1, fmt=',', color='blue')
    xs = pylab.linspace(min(xs), max(xs), 3)
    residual1.plot(xs, [0 for x in xs], '-', color='red')
    residual1.xaxis.tick_top()
    pylab.xticks([])
    pylab.xlim(min(xs), max(xs))
    pylab.yticks([])
    pylab.ylabel('Studentized\nresidual')
    plt.savefig('../Graphs/Magnetoresistance/Fit.png')
    plt.savefig('../Graphs/Magnetoresistance/Fit.pdf')
    return f
Exemplo n.º 2
0
def test():
    time = plt.linspace(0,10,1000)

    #single-ball-simulation
    initials = [4,0,0,0]
    pos, vel = Cromer_1d(initials, singleforce, time)
    plt.plot(pos,vel)
Exemplo n.º 3
0
def make_fig(Ts, Rs, es, a, b, c, d, fct1, fct2, outfile):
    fig = pylab.figure()
    gs = gridspec.GridSpec(4, 4)
    TR = fig.add_subplot(gs[:, :])
    TR.errorbar(Ts, Rs, es, fmt=',', color='blue')
    #TR.plot(Ts, Rs, '.', color='blue')
    xs = pylab.linspace(a, b, 100)
    xs = pylab.linspace(c, d, 100)
    pylab.xlim(160, 400)
    pylab.yticks(list(pylab.linspace(0, 25e-2, 6)),
        ['{:.0f}'.format(i) for i in pylab.linspace(0, 25, 6)])
    #pylab.ylim(0, 2e-1)
    pylab.xlabel('Temperature (K)')
    pylab.ylabel('Hall coefficient ($10^{-2}\\,\\mathrm{m}^3/\\mathrm{C}$)')
    #room_T, nominal_R_H, nRHe = 293, 1.47e-2*5e-3/1e-3, 1e-4
    #TR.errorbar([room_T], [nominal_R_H], nRHe, fmt=',', color='red')
    if not outfile: outfile = 'Fits'
    fig.savefig('../Graphs/Hall/'+outfile+'.png')
    fig.savefig('../Graphs/Hall/'+outfile+'.pdf')
Exemplo n.º 4
0
Arquivo: GvsT.py Projeto: ejetzer/hall
def make_fig(Ts, Rs, Ges, a, b, c, d, fct1, fct2, outfile=None):
    fig = pylab.figure()
    gs = gridspec.GridSpec(4, 4)
    TR = fig.add_subplot(gs[1:, :])
    TR.errorbar(Ts, 1/Rs, Ges[0], fmt=',')
    xs = pylab.linspace(a, b, 100)
    TR.plot(xs, 1/fct1(xs), '-', color='red')
    xs = pylab.linspace(c, d, 100)
    TR.plot(xs, 1/fct2(xs), '-', color='red')
    pylab.xlim(225, 400)
    pylab.ylim(0, 0.05)
    pylab.xlabel('Temperature (K)')
    pylab.ylabel('Conductance ($\\Omega^{-1}$)')
    residual1 = fig.add_subplot(gs[0, :2])
    xs = [x for x in Ts if a <= x <= b]
    ys = [(1/y - 1/fct1(x))/e for x, y, e in zip(Ts, Rs, Ges[0]) if a <= x <= b]
    residual1.errorbar(xs, ys, 1, fmt=',', color='blue')
    xs = pylab.linspace(a, b, 100)
    residual1.plot(xs, [0 for x in xs], '-', color='red')
    residual1.xaxis.tick_top()
    pylab.xlim(a, b)
    pylab.xticks([a, b-1])
    pylab.yticks([])
    pylab.ylim(-3, 3)
    pylab.ylabel('Studentized\nresidual')
    residual2 = fig.add_subplot(gs[0, 2:])
    xs = [x for x in Ts if c <= x <= d]
    ys = [(1/y - 1/fct2(x))/e for x, y, e in zip(Ts, Rs, Ges[1]) if c <= x <= d]
    residual2.errorbar(xs, ys, 1, fmt=',', color='blue')
    xs = pylab.linspace(c, d, 100)
    residual2.plot(xs, [0 for x in xs], '-', color='red')
    residual2.xaxis.tick_top()
    pylab.xticks([c+1, d])
    pylab.yticks([])
    pylab.ylim(-3, 3)
    pylab.xlim(c, d)
    if not outfile: outfile = 'Fits'
    fig.savefig('../Graphs/GvsT/'+outfile+'.png')
    fig.savefig('../Graphs/GvsT/'+outfile+'.pdf')
Exemplo n.º 5
0
def test_interp():
    # Testing interpolation
    nn = 33 # number of nodes
    ne = 65 # number of evaluation points
    x = cos(pi*(1+array(range(nn)))/(nn+1))
    xp = linspace(-1,1,ne)
    rbf_list = ['mq','gauss','phs']   
    ep_list = [3.,5.,7.,9.]
    m = 3
    for ep in ep_list:
        for ff in rbf_list:
            # 1D
            d = array([x]).T
            p = array([xp]).T
            rhs = testfunction(d)
            exact = testfunction(p)
            Pf = rbfinterp(d,rhs,p,ff,shapeparm = ep, power = m)

            err = norm(Pf-exact)
            
            print("1D interp, {}, shape = {}, L2 error = {:e}".format(ff,ep,err))
    
            # 2D
            d = array([x,x]).T
            p = array([xp,xp]).T
            rhs = testfunction(d)
            exact = testfunction(p)
            Pf = rbfinterp(d,rhs,p,ff,shapeparm = ep, power = m)
        
            err = norm(Pf-exact)
            
            print("2D interp, {}, shape = {}, L2 error = {:e}".format(ff,ep,err))
        
            # 3D
            d = array([x,x,x]).T
            p = array([xp,xp,xp]).T
            rhs = testfunction(d)
            exact = testfunction(p)
            Pf = rbfinterp(d,rhs,p,ff,shapeparm = ep, power = m)
        
            err = norm(Pf-exact)
        
            print("3D interp, {}, shape = {}, L2 error = {:e}".format(ff,ep,err))
            print("----------------------------------------------------------")
Exemplo n.º 6
0
def plot_het_concordance(a):    
    x = P.linspace(0, 1, a.shape[0])
    y = a[:, 1] / (a[:, 0] + 1e-15)
    P.figure(1)
    P.clf()
    ax = P.subplot(111, title='IMPUTE2-PRIMAL Discordance Rate', xlabel='IMPUTE2 Confidence', ylabel='Discordance Rate')
    ax.plot(x, y, 'b.-')
    P.xlim([min(x[-20:]), 1.01])
    P.grid(True)
    P.ylim([0, max(y[-20:])])
    P.hold(True)
    
    f = np.polyfit(1 - x[-10:], y[-10:], 1)
    yFit = np.polyval(f, 1 - x)    
    # ax.plot(x, 0.3 * (1 - x) + 0.005, 'g--')  # Regression line
    ax.plot(x, yFit, 'g--')  # Regression line
    
    for item in [ax.title, ax.xaxis.label, ax.yaxis.label]: item.set_fontsize(18)
    for item in (ax.get_xticklabels() + ax.get_yticklabels()): item.set_fontsize(14)
    return x, y, f
	def gaussianFit2(self):
		"""
		It does not work
		"""
		data = P.hist(self.zMass, bins = 100)

		# Equation for Gaussian
		def f(x, a, b, c):
			return a * P.exp(-(x - b)**2.0 / (2 * c**2))

		# Generate data from bins as a set of points 
		x = [0.5 * (data[1][i] + data[1][i+1]) for i in xrange(len(data[1])-1)]
		y = data[0]

		popt, pcov = optimize.curve_fit(f, x, y)

		x_fit = P.linspace(x[0], x[-1], 100)
		y_fit = f(x_fit, *popt)

		P.plot(x_fit, y_fit, lw=4, color="r")

		P.show()
Exemplo n.º 8
0
def test_dmatrix():
    # Unit tests for the dmatrix function
    x = linspace(0,1,5)
    # Test 1D without formatting input, data is 1D, shape is (N,)
    data = x
    DM = dmatrix(data)
    print(DM)
    
    # Test 1D with x in wrong orientation (dim by N pts), data is 2D array
    data = array([x])
    DM = dmatrix(data)
    print(DM)   
    
    # Test 1D with x in correct orientation (N by dim pts), data is 2D array
    data = array([x]).T
    DM = dmatrix(data)
    print(DM)

    # Test 2D with x in wrong orientation (dim by N pts), data is 2D array
    data = array([x,x])
    DM = dmatrix(data)
    print(DM) 

    # Test 2D with x in correct orientation (N by dim pts), data is 2D array
    data = array([x,x]).T
    DM = dmatrix(data)
    print(DM)   

    # Test 3D with x in wrong orientation (dim by N pts), data is 2D array
    data = array([x,x,x])
    DM = dmatrix(data)
    print(DM)  

    # Test 3D with x in correct orientation (N by dim pts), data is 2D array
    data = array([x,x,x]).T
    DM = dmatrix(data)
    print(DM)
Exemplo n.º 9
0
 def run(self, z, N = 2**14, self_steep = False):
     # euristic for setting the timescale
     dts = [p['dt'].to('ps').magnitude for p in self.pulses]
     timescale = max(dts)*5e2
     
     self.t = np.linspace(-timescale,timescale,N) * ps
     t_step = self.t[1]-self.t[0]
     
     self.w = fftfreq(N,t_step)*2*pi
     w_step = self.w[2]-self.w[1]
     
     self.z = pl.linspace(0,z.to('m').magnitude,10)*Q_('m')
     
     print(self.init_report())
     ## ToDo Verify all pulses are within the simulation
     
     self.a0 = np.sum(np.c_[[self.generate_pulse(**p) for p in self.pulses]],0)
     
     
     ## Generate operators
     dw = self.w
     dispersion = 1/2. *self.beta[1] * dw**2 + 1./6 *self.beta[2] * dw**3
     nlinear = self.gamma
     if self_steep:
         self_steep = self.gamma/self.w0.to('1/ps').magnitude
     else:
         self_steep = 0
     
     
     ## Start simulation
     self.sols = nl.split_step(self.a0, self.z, w_op = dispersion, nlin = nlinear,
                               dt = t_step.to('ps').magnitude, self_steep = self_steep)
     self.results = Solution(self.sols, self.t, fftshift(self.w.to('GHz').magnitude)*Q_('GHz'), z = self.z)
     self.results.l0 = self.l0
     
     return self.sols
Exemplo n.º 10
0
def _plot_hdf5_model_vertical(f, component, output_filename, vmin=None,
                              vmax=None):
    import matplotlib.cm
    import matplotlib.pylab as plt

    data = xarray.DataArray(
        f["data"][component][:], [
            ("latitude", 90.0 - f["coordinate_0"][:]),
            ("longitude", f["coordinate_1"][:]),
            ("radius", f["coordinate_2"][:] / 1000.0)])

    plt.style.use('seaborn-pastel')

    plt.figure(figsize=(32, 18))

    plt.suptitle("Component %s - File %s" % (component, output_filename),
                 fontsize=20)

    count = 12
    lats = plt.linspace(data["latitude"].min(), data["latitude"].max(),
                        count)
    lngs = plt.linspace(data["longitude"].min(), data["longitude"].max(),
                        count)

    import lasif.colors
    my_colormap = lasif.colors.get_colormap(
        "tomo_full_scale_linear_lightness")

    # Overwrite colormap things if given.
    if vmin is not None and vmax is not None:
        min_val_plot = vmin
        max_val_plot = vmax
    else:
        mean = data.mean()
        max_diff = max(abs(mean - data.min()),
                       abs(data.max() - mean))
        min_val_plot = mean - max_diff
        max_val_plot = mean + max_diff
        # Plotting essentially constant models.
        min_delta = 0.001 * abs(max_val_plot)
        if (max_val_plot - min_val_plot) < min_delta:
            max_val_plot = max_val_plot + min_delta
            min_val_plot = min_val_plot - min_delta

    for _i in range(count):
        plt.subplot(4, count // 2, _i + 1)

        x, y = np.meshgrid(data.longitude, data.radius)

        plot_data = data.sel(latitude=lats[_i], method="nearest")
        plot_data = np.ma.masked_invalid(plot_data.data)

        # Plot.
        plt.pcolormesh(
            x, y, plot_data.T,
            cmap=my_colormap, vmin=min_val_plot, vmax=max_val_plot,
            shading="flat")

        # make a colorbar and title
        plt.colorbar()
        plt.title("@Latitude: " + str(lats[_i]))


    for _i in range(count):
        plt.subplot(4, count // 2, count + _i + 1)

        x, y = np.meshgrid(data.latitude, data.radius)

        plot_data = data.sel(longitude=lngs[_i], method="nearest")
        plot_data = np.ma.masked_invalid(plot_data.data)

        # Plot.
        plt.pcolormesh(
            x, y, plot_data.T,
            cmap=my_colormap, vmin=min_val_plot, vmax=max_val_plot,
            shading="flat")

        # make a colorbar and title
        plt.colorbar()
        plt.title("@Longitude: " + str(lngs[_i]))


    plt.tight_layout(rect=(0, 0, 1, 0.95))
    plt.savefig(output_filename, dpi=150)
    plt.close()
Exemplo n.º 11
0
def cons_vac(T):
    """
    consentration is given by n(T)/N 
    (vacant parrticle-spaces divided 
    by total particle-spaces)
    """
    k_b=8.617332478*1e-5;#[eV/K] boltzmanns constant 
    deltaeps=1; #[eV] infitisemial energy for each "particle-jump"
    
    exponential = plt.exp( deltaeps/(T*k_b) ); #these values are way large.
    return 1.0/(exponential);

try:
    pot = int(sys.argv[1]);#power of number of particles
except:
    pot = input("give the power of the temperature you want in your system \n")

tot_temp = 1*10**(pot); #total vacancies in system
#plot_points = 1.0/float(tot_temp-1)

x = plt.linspace(0,int(tot_temp),1001); 
n_cons = cons_vac(x);

plt.plot(x,n_cons,"k-",label="n(T)/N");
plt.xlabel("temperature [K]");
plt.ylabel("consentration of vacancies");
plt.legend(numpoints=1, loc="lower right", borderpad=0.5);

plt.savefig("exercise_g_img"+str(self_int)+".png");
plt.show();
Exemplo n.º 12
0
def plotstuff(cell, electrode):
    #creating array of points and corresponding diameters along structure
    for i in xrange(cell.xend.size):
        if i == 0:
            xcoords = pl.array([cell.xmid[i]])
            ycoords = pl.array([cell.ymid[i]])
            zcoords = pl.array([cell.zmid[i]])
            diams = pl.array([cell.diam[i]])    
        else:
            if cell.zmid[i] < 100 and cell.zmid[i] > -100 and \
                    cell.xmid[i] < 100 and cell.xmid[i] > -100:
                xcoords = pl.r_[xcoords, pl.linspace(cell.xstart[i],
                                            cell.xend[i], cell.length[i]*3)]   
                ycoords = pl.r_[ycoords, pl.linspace(cell.ystart[i],
                                            cell.yend[i], cell.length[i]*3)]   
                zcoords = pl.r_[zcoords, pl.linspace(cell.zstart[i],
                                            cell.zend[i], cell.length[i]*3)]   
                diams = pl.r_[diams, pl.linspace(cell.diam[i], cell.diam[i],
                                            cell.length[i]*3)]
    
    #sort along depth-axis
    argsort = pl.argsort(ycoords)
    
    #plotting
    fig = pl.figure(figsize=[15, 10])
    ax = fig.add_axes([0.1, 0.1, 0.533334, 0.8], frameon=False)
    ax.scatter(xcoords[argsort], zcoords[argsort], s=diams[argsort]**2*20,
               c=ycoords[argsort], edgecolors='none', cmap='gray')
    ax.plot(electrode.x, electrode.z, '.', marker='o', markersize=5, color='k')
    
    i = 0
    limLFP = abs(electrode.LFP).max()
    for LFP in electrode.LFP:
        tvec = cell.tvec*0.6 + electrode.x[i] + 2
        if abs(LFP).max() >= 1:
            factor = 2
            color='r'
        elif abs(LFP).max() < 0.25:
            factor = 50
            color='b'
        else:
            factor = 10
            color='g'
        trace = LFP*factor + electrode.z[i]
        ax.plot(tvec, trace, color=color, lw = 2)
        i += 1
    
    ax.plot([22, 28], [-60, -60], color='k', lw = 3)
    ax.text(22, -65, '10 ms')
    
    ax.plot([40, 50], [-60, -60], color='k', lw = 3)
    ax.text(42, -65, '10 $\mu$m')
    
    ax.plot([60, 60], [20, 30], color='r', lw=2)
    ax.text(62, 20, '5 mV')
    
    ax.plot([60, 60], [0, 10], color='g', lw=2)
    ax.text(62, 0, '1 mV')
    
    ax.plot([60, 60], [-20, -10], color='b', lw=2)
    ax.text(62, -20, '0.1 mV')
    
    
    
    ax.set_xticks([])
    ax.set_yticks([])
    
    ax.axis([-61, 150, -61, 400])
    
    ax.set_title('Location-dependent extracellular spike shapes')
    
    #plotting the soma trace    
    ax = fig.add_axes([0.75, 0.55, 0.2, 0.35])
    ax.plot(cell.tvec, cell.somav)
    ax.set_title('Somatic action-potential')
    ax.set_ylabel(r'$V_\mathrm{membrane}$ (mV)')
Exemplo n.º 13
0
def ex_k(savearg=False):
    n = 1000
    T_hat = 0.9
    rho_hat = plab.linspace(0.2, 2.0, n)
    V_hat = plab.linspace(0.2, 2.0, n)
    p_hat = p_rhot(rho_hat, T_hat)
Exemplo n.º 14
0
except:
    print "error in integer: exg_att#.py"

def heat_capacity(Num,Temp):
    """
    heat capacity is given by the partiaally derived energy on temperature.
    giving us the function:
    C_v = (delta_eps)**2*N*exp(-delta_eps/T*k)/(k*T**2)
    """
    k_b=8.617332478*1e-5;#[eV/K] boltzmanns constant 
    deltaeps=1; #[eV] infitisemial energy for each "particle-jump"
    
    exponential = plt.exp( -deltaeps/(Temp*k_b) ); #these values are way large.
    return Num*deltaeps**2*exponential/(k_b*Temp**2);

T = plt.linspace(0,1000,1001); 

plt.figure("exercise h");
plt.hold(True);
plt.xlabel("Temperature [K]");
plt.ylabel("Heat capacity [eV/K] (log-scale)");
#plt.title("system with N = %d"%N);

for N in [10**i for i in range(3,7)]:
    Cv = heat_capacity(N,T);

    plt.plot(T,Cv,label="N=%d"%N);

#plt.yscale("log")
plt.legend(numpoints=1, loc="upper left", borderpad=0.5);    
plt.savefig("exercise_h_img"+str(self_int)+".png");
Exemplo n.º 15
0
    else: 
        return False

try:
    savearg = int(sys.argv[1])
except IndexError:
    savearg = False
except ValueError:
    savearg = False

n = 1000 # number of datapoints
V_0 = 0.4; V_end = 20.0
Rho_0 = 0.0; Rho_end = 2.0
 
T_hat = [1.15, 1.0, 0.85] # temperature [1]
V_hat = plab.linspace(V_0, V_end, n) # volume [1] 
Rho_hat = plab.linspace(Rho_0, Rho_end, n) # density [1] 
P1_hat = plab.zeros((n,len(T_hat))) #P(V,T) pressure [1]
P2_hat = plab.zeros((n,len(T_hat))) #P(Rho,T) pressure [1]
 
for j in range(len(T_hat)):
    for i in range(n):
        P1_hat[i,j] = p_vt(v_=V_hat[i], t_=T_hat[j])
        P2_hat[i,j] = p_rhot(rho_=Rho_hat[i], t_=T_hat[j])
        #find out when the function is no longer unique
        if check_unique(y1=P2_hat[i-1,j], y2=P2_hat[i,j]):
            print "function is no longer unique for rho=%f, T=%f" %(Rho_hat[i],T_hat[j])

max_index = plab.argmax(P2_hat[0:n/2,2])
max_y = P2_hat[max_index,2]
max_x = Rho_hat[max_index]
Exemplo n.º 16
0
    'custom_code' : ['custom_codes.hoc', 'biophys1.hoc'],
}

#Synaptic parameters, corresponding to a NetCon synapse built into NEURON
synapseParameters = {
    'idx' : 0,               # insert synapse on index "0", the soma
    'e' : 0.,                # reversal potential of synapse
    'syntype' : 'Exp2Syn',   # conductance based double-exponential synapse
    'tau1' : 1.0,            # Time constant, rise
    'tau2' : 1.0,            # Time constant, decay
    'weight' : 0.05,         # Synaptic weight
    'record_current' : True, # Will enable synapse current recording
}

#Generate the grid in xz-plane over which we calculate local field potentials
x = pl.linspace(-50, 50, 11)
z = pl.linspace(-50, 50, 11)
X, Z = pl.meshgrid(x, z)
y = pl.zeros(X.size)

#define parameters for extracellular recording electrode, using optional method
electrodeParameters = {
    'sigma' : 0.3,              # extracellular conductivity
    'x' : X.reshape(-1),        # x,y,z-coordinates of contact points
    'y' : y,
    'z' : Z.reshape(-1),
    'method' : 'som_as_point',  #treat soma segment as sphere source
}

################################################################################
# Main simulation procedure, setting up extracellular electrode, cell, synapse
Exemplo n.º 17
0
#!/usr/bin/env python

from __future__ import print_function
from pysb.simulator import ScipyOdeSimulator
from matplotlib.pyplot import plot, legend, show
from matplotlib.pylab import linspace
from kinase_cascade import model


tspan = linspace(0, 1200)
print("Simulating...")
yfull = ScipyOdeSimulator(model).run(tspan=tspan).all
plot(tspan, yfull['ppMEK'], label='ppMEK')
plot(tspan, yfull['ppERK'], label='ppERK')
legend(loc='upper left')
show()
Exemplo n.º 18
0
def cons_vac(T):
    """
    consentration is given by n(T)/N 
    (vacant parrticle-spaces divided 
    by total particle-spaces)
    """
    k_b=8.617332478*1e-5;#[eV/K] boltzmanns constant 
    deltaeps=1; #[eV] infitisemial energy for each "particle-jump"
    
    exponential = plt.exp( deltaeps/(T*k_b) ); #these values are way large.
    return 1.0/(exponential);

try:
    pot = int(sys.argv[1]);#power of number of particles
except:
    pot = input("give the power of the temperature you want in your system")

tot_temp = 1*10**(pot); #total vacancies in system
plot_points = 1.0/float(tot_temp+1)
x = plt.linspace(0,int(tot_temp), plt.ceil(plot_points)); 
n_cons = cons_vac(x);

plt.plot(x,n_cons,"k-",label="n(T)/N");
plt.xlabel("temperature [K]");
plt.ylabel("consentration of vacancies");
plt.legend(numpoints=1, loc="lower right", borderpad=0.5);

plt.savefig("exercise_g_img"+str(self_int)+".png");
plt.show();
Exemplo n.º 19
0
        'tstopms' : 70.,                   # stop simulation at 200 ms. 
	'passive' : True,
    	'v_init' : -65,             # initial crossmembrane potential
    	'e_pas' : -65,              # reversal potential passive mechs
	'nsegs_method' :  'fixed_length',
#	'fixed_length': 20, # method for setting number of segments,
	#'max_nsegs_length':5, #igy kapunk 52 szegmenst
	'max_nsegs_length':20, #igy kapunk 27 szegmenst
#	'max_nsegs_length':30, #igy kapunk 18 szegmenst
#	'nsegs_method' : 'lambda_f',
#	'lambda_f' : 1000,           # segments are isopotential at this frequency
    'custom_code'  : ['/media/BA0ED4600ED416EB/agy/kCSD/progik/bs_futtat/bs_130509/active.hoc'], # will run this file
}

#Generate the grid in xz-plane over which we calculate local field potentials
x = pl.linspace(d, d, elecnumb)
z = pl.linspace(-150, 550, elecnumb)

y = pl.linspace(0, 0, x.size)

#define parameters for extracellular recording electrode, using optional method
electrodeParameters = {
    'sigma' : 0.5,              # extracellular conductivity
    'x' : x,        # x,y,z-coordinates of contact points
    'y' : y,
    'z' : z,
#     'method' : 'som_as_point',  #treat soma segment as sphere source
#     'method' : 'pointsource'
     'method' : 'linesource'
}