dt = 0.025 tstop=50 # Parameters dist = 2.5 #mm rho = 3.5 #conductivity, Ohm.m alpha = 0. #angle, rad cutoff = 800. #high-pass cutoff, Hz order = 401 #filter order # Electrode position and filter pos = (dist*np.sin(alpha)*1000, dist*np.cos(alpha)*1000, 0) fir = field.hp_fir(order, cutoff, dt) # Simulation cell.load_model('models/Mainen/demo_ext.hoc', 'models/Mainen/%s/.libs/libnrnmech.so' % ARCH) cell.initialize(dt=dt) t, I = cell.integrate(tstop) coords = cell.get_seg_coords() # Select segments dend = field.select_sections(coords, "dend") soma = field.select_sections(coords, "soma") axon = field.select_sections(coords, "(node)|(myelin)") iseg = field.select_sections(coords, "iseg") hill = field.select_sections(coords, "hill") all = field.select_sections(coords, ".*") colors = {"dend": "r", "soma": "c", "axon": "b",
import platform ARCH = platform.uname()[4] dt = 0.025 tstop=50 # Parameters rho = 3.5 #conductivity, Ohm.m cutoff = 800. #high-pass cutoff, Hz order = 401 #filter order Nsamp = 30 filter = None # Simulation cell.load_model('models/Mainen/demo_ext.hoc', 'models/Mainen/%s/.libs/libnrnmech.so' % ARCH) cell.initialize(dt=dt) t, I = cell.integrate(tstop) coords = cell.get_seg_coords() # Plots fig = plt.figure(figsize=(6,6), facecolor=(0.7, 0.7, 0.7)) fig.subplots_adjust(left=0.05, right=0.95) ax = plt.subplot(111, frameon=False) S = np.pi*coords['diam']*coords['L'] #segment surface p2p = np.abs(I).max(0)-np.abs(I).min(0) norm = colors.LogNorm(vmin=p2p.min(), vmax=p2p.max()) col = graph.plot_neuron(coords, p2p, norm=norm) plt.xticks([]) plt.yticks([]) plt.ylim((-200, 610))
rho = 3.5 #conductivity, Ohm.m cutoff = 800. #high-pass cutoff, Hz order = 401 #filter order Nsamp = 30 filter = None y_range = (-200, 610) x_range = (-550, 250) bg_color = (0.7, 0.7, 0.7) cmap = cm.viridis simulation_filename = "data/neuron_simulation_data.npz" # Simulation if not os.path.exists(simulation_filename): from eap import cell cell.load_model('models/Mainen/demo_ext.hoc', 'models/Mainen/{}/.libs/libnrnmech.so'.format(ARCH)) cell.initialize(dt=dt) t, I = cell.integrate(tstop) coords = cell.get_seg_coords() I = I[(t > t0) & (t < t1)] t = t[(t > t0) & (t < t1)] np.savez(simulation_filename, coords=coords, I=I, t=t) else: data = np.load(simulation_filename) coords = data['coords'] t = data['t'] I = data['I'] # Plots fig = plt.figure(figsize=(6,6), facecolor=bg_color) fig.subplots_adjust(left=0.05, right=0.95)
import matplotlib.pyplot as plt from eap import field, cell, graph from matplotlib import transforms dt = 0.025 tstop=35 win = [25, 33] # Parameters rho = 3.5 #conductivity, Ohm.m cutoff = 800. #high-pass cutoff, Hz order = 51 #filter order Nsamp = 20 filter = None # Simulation cell.load_model('models/Mainen/demo_ext.hoc', 'models/Mainen/i686/.libs/libnrnmech.so') cell.initialize(dt=dt) t, I = cell.integrate(tstop) tmin, tmax = win I = I[(t>tmin) & (t<tmax), :] t = t[(t>tmin) & (t<tmax)] # Calculation of field xrange = [-3000, 3000] yrange = [-3000, 3000] coords = cell.get_seg_coords() xx, yy = field.calc_grid(xrange, yrange, n_samp=Nsamp) v_ext = field.estimate_on_grid(coords, I, xx, yy) #Filter
dt = 0.025 tstop = 50 xyz_cell1 = [0, 0, 0] #microm xyz_cell2 = [200, 0, 0] cell_list = [] syn_e = -72.0 con_weight = .45e-3 tau1 = 0.25 tau2 = 8 t_length = 5 time_to_plot = 4 # SETUP CELLS # load your model cell cell.load_model('models/amaral.hoc') cells = cell.h.List() cells.append(cell.h.AmaralCell(xyz_cell1[0], xyz_cell1[1], xyz_cell1[2], 0)) cells.append(cell.h.AmaralCell(xyz_cell2[0], xyz_cell2[1], xyz_cell2[2], 0)) nclist = [] stimlist = [] # init synapses def init_synapse(cell_no, syn_start): syn = cell.h.Exp2Syn(0.5, sec=cells[cell_no].soma[0]) syn.e = syn_e syn.tau1 = tau1 #.1 syn.tau2 = tau2 #5
import matplotlib.pyplot as plt from eap import field, cell, graph from matplotlib import transforms dt = 0.025 tstop = 35 win = [25, 33] # Parameters rho = 3.5 #conductivity, Ohm.m cutoff = 800. #high-pass cutoff, Hz order = 51 #filter order Nsamp = 20 filter = None # Simulation cell.load_model('models/Mainen/demo_ext.hoc', 'models/Mainen/i686/.libs/libnrnmech.so') cell.initialize(dt=dt) t, I = cell.integrate(tstop) tmin, tmax = win I = I[(t > tmin) & (t < tmax), :] t = t[(t > tmin) & (t < tmax)] # Calculation of field xrange = [-3000, 3000] yrange = [-3000, 3000] coords = cell.get_seg_coords() xx, yy = field.calc_grid(xrange, yrange, n_samp=Nsamp) v_ext = field.estimate_on_grid(coords, I, xx, yy) #Filter