Beispiel #1
0
def current(loci, ail):
    cell = nm.NeuronModel(dl=1000, dd=2,  sl=40, sd=20,\
           hl=10, hd=2, ail=ail, aid=1.2, axl=1000, axd=1.2,\
           dna=100, sna=100, hna=300, aina=4000, axna=300, dk=20,\
           sk=20, hk=150, aik=1000, axk=150,\
           na_type=7, aina12=1000, aina16=1000)
    stim = nm.attach_current_clamp(cell, amp=1, dur=1)
    vec = nm.set_recording_vectors(cell)
    v = h.Vector()
    v.record(cell.ais(loci)._ref_v)

    icap = h.Vector()  # (mA/cm2)
    icap.record(cell.ais(loci)._ref_i_cap)

    ileak = h.Vector()  # (mA/cm2)
    ileak.record(cell.ais(loci)._ref_i_pas)

    ina = h.Vector()  # (mA/cm2)
    ina.record(cell.ais(loci)._ref_ina)

    ik = h.Vector()  # (mA/cm2)
    ik.record(cell.ais(loci)._ref_ik)

    nm.simulate()
    print(nm.cal_velocity(vec, ["ais"]))

    iax = -np.array(icap.to_python()) - np.array(ileak.to_python()) - np.array(
        ina.to_python()) - np.array(ik.to_python())

    cell.dend1 = None
    cell.soma = None
    cell.hill = None
    cell.ais = None
    cell.axon = None
    for sec in h.allsec():
        print(sec)
    return v, icap, ileak, ina, ik, iax
 if not os.path.exists(save_figure_path):
     os.makedirs(save_figure_path)
 for p in range(7):
     bpv_sum = np.zeros([len(dist_x), len(len_x)])
     fwv_sum = np.zeros([len(dist_x), len(len_x)])
     for i, d in enumerate(dist_x):
         for j, l in enumerate(len_x):
             file_name = 'type'+str(na_type)\
                +'_aina12_'+str(aina12_x[p])\
                +'_aina16_'+str(aina16_x[p])\
                +'_aik_'+str(aik_x[p])\
                +'_dist_'+str(d)+'_len_'+str(l)+'_v_vec.p'
             print(na_type, p, d, l)
             cell = nm.NeuronModel(hl=int(d),\
                       ail=int(l),\
                    na_type=na_type,\
                    aina12=aina12_x[p],\
                    aina16=aina16_x[p],\
                    aik=aik_x[p])
             stim = nm.attach_current_clamp(cell, amp=.7)
             vec = nm.set_recording_vectors(cell)
             nm.simulate()
             nm.save_vec(vec, save_data_path + file_name)
             nm.show_output(vec, save_figure_path + file_name)
             bpv_sum[i, j], fwv_sum[i,
                                    j], ___ = nm.cal_velocity(vec, ['ais'])
             cell.dend1 = None
             cell.dend2 = None
             cell.soma = None
             cell.hill = None
             cell.ais = None
             cell.axon = None
        save_data_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/data/aina' + str(
            na12m) + str(na16m) + '/'
        save_figure_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/figure/aina' + str(
            na12m) + str(na16m) + '/'
        if not os.path.exists(save_data_path):
            os.makedirs(save_data_path)
        if not os.path.exists(save_figure_path):
            os.makedirs(save_figure_path)

        for i, gna in enumerate(ais_gna_x):
            for j, l in enumerate(len_x):
                print('na12m:', na12m, '; na16m:', na16m, ';gna:', gna,
                      'pS/um2; len:', l, 'um;')
                cell = nm.NeuronModel(ail=int(l),
                                      na_type=2,
                                      na12_map=na12m,
                                      na16_map=na16m,
                                      aina12=gna,
                                      aina16=gna)
                stim = nm.attach_current_clamp(cell, amp=.7)
                vec = nm.set_recording_vectors(cell)
                nm.simulate()
                nm.save_vec(
                    vec, save_data_path + str(na12m) + str(na16m) + '_gna_' +
                    str(gna) + '_len_' + str(l) + '_')
                nm.show_output(
                    vec, save_figure_path + str(na12m) + str(na16m) + 'gna_' +
                    str(gna) + '_len_' + str(l) + '_')
                bpv_len_sum[i, j], fwv_len_sum[i, j], ___ = nm.cal_velocity(
                    vec, ['ais'])
                cell.dend1 = None
                cell.dend2 = None
Beispiel #4
0
save_figure_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/figure/3d_type_21/'
if not os.path.exists(save_data_path):
    os.makedirs(save_data_path)
if not os.path.exists(save_figure_path):
    os.makedirs(save_figure_path)

for p in range(7):
    bpv_sum = np.zeros([len(dist_x), len(len_x)])
    fwv_sum = np.zeros([len(dist_x), len(len_x)])
    for i, d in enumerate(dist_x):
        for j, l in enumerate(len_x):
            print(p, d, l)
            cell = nm.NeuronModel(hl=int(d), \
                      ail=int(l), \
                   na_type=2, \
                   na12_map=1,
                   na16_map=1,
                   aina12=aina12_x[p],\
                   aina16=aina16_x[p],\
                   aik=aik_x[p])
            stim = nm.attach_current_clamp(cell, amp=.7)
            vec = nm.set_recording_vectors(cell)
            nm.simulate()
            nm.save_vec(vec, save_data_path\
               +'type2_map1'\
               +'_aina12_'+str(aina12_x[p])\
               +'_aina16_'+str(aina16_x[p])\
               +'_aik_'+str(aik_x[p])\
               +'_dist_'+str(d)+'_len_'+str(l)+'_')
            nm.show_output(vec, save_figure_path\
               +'type2_map1'\
               +'_aina12_'+str(aina12_x[p])\
dist_step = 5
dist_stop = 33
dist_x = np.arange(dist_start, dist_stop + 1, dist_step)
bpv_len_sum = np.zeros([len(hill_gna_x), len(len_x)])
fwv_len_sum = np.zeros([len(hill_gna_x), len(len_x)])
bpv_dist_sum = np.zeros([len(hill_gna_x), len(dist_x)])
fwv_dist_sum = np.zeros([len(hill_gna_x), len(dist_x)])

save_data_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/data/hna/'
save_figure_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/figure/hna/'

for i, gna in enumerate(hill_gna_x):

    for j, l in enumerate(len_x):
        print('hna:', gna, 'pS/um2; len:', l, 'um;')
        cell = nm.NeuronModel(ail=int(l), na_type=1, hna=gna)
        stim = nm.attach_current_clamp(cell, amp=.7)
        vec = nm.set_recording_vectors(cell)
        nm.simulate()
        nm.save_vec(
            vec, save_data_path + 'hna_' + str(gna) + '_len_' + str(l) + '_')
        nm.show_output(
            vec, save_figure_path + 'hna_' + str(gna) + '_len_' + str(l) + '_')
        bpv_len_sum[i, j], fwv_len_sum[i,
                                       j], ___ = nm.cal_velocity(vec, ['ais'])
        cell.dend1 = None
        cell.dend2 = None
        cell.soma = None
        cell.hill = None
        cell.ais = None
        cell.axon = None
save_data_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/data/3d_type_1/'
save_figure_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/figure/3d_type_1/'
if not os.path.exists(save_data_path):
    os.makedirs(save_data_path)
if not os.path.exists(save_figure_path):
    os.makedirs(save_figure_path)

for p in aina_x + [aina]:
    bpv_sum = np.zeros([len(dist_x), len(len_x)])
    fwv_sum = np.zeros([len(dist_x), len(len_x)])
    for i, d in enumerate(dist_x):
        for j, l in enumerate(len_x):
            print(p, d, l)
            cell = nm.NeuronModel(hl=int(d), \
                      ail=int(l), \
                   na_type=1, \
                   aina=p,\
                   aik=aik)
            stim = nm.attach_current_clamp(cell, amp=.7)
            vec = nm.set_recording_vectors(cell)
            nm.simulate()
            nm.save_vec(
                vec, save_data_path + 'aina_' + str(p) + '_aik_' + str(aik) +
                '_dist_' + str(d) + '_len_' + str(l) + '_')
            nm.show_output(
                vec, save_figure_path + 'aina_' + str(p) + '_aik_' + str(aik) +
                '_dist_' + str(d) + '_len_' + str(l) + '_')
            bpv_sum[i, j], fwv_sum[i, j], ___ = nm.cal_velocity(vec, ['ais'])
            cell.dend1 = None
            cell.dend2 = None
            cell.soma = None
Beispiel #7
0
for p in range(7):
    bpv_sum = np.zeros([len(dist_x), len(len_x)])
    fwv_sum = np.zeros([len(dist_x), len(len_x)])
    for i, d in enumerate(dist_x):
        for j, l in enumerate(len_x):
            print(p, d, l)
            file_name = 'aina12_'+str(aina12_x[p])\
                       +'_aina16_'+str(aina16_x[p])\
                 +'_aik_'+str(aik_x[p])\
                 +'_dist_'+str(d)\
                 +'_len_'+str(l)+'_'
            cell = nm.NeuronModel(hl=int(d), \
                      ail=int(l), \
                   na_type=na_type_i, \
                   aina12=aina12_x[p],\
                   aina16=aina16_x[p],\
                   aik=aik_x[p],\
                   hna = hna_i,\
                   hk = hk_i,\
                   hd = hd_i)
            stim = nm.attach_current_clamp(cell, amp=.7)
            vec = nm.set_recording_vectors(cell)
            nm.simulate()
            nm.save_vec(vec, save_data_path + file_name)
            nm.show_output(vec, save_figure_path + file_name)
            bpv_sum[i, j], fwv_sum[i, j], ___ = nm.cal_velocity(vec, ['ais'])
            cell.dend1 = None
            cell.dend2 = None
            cell.soma = None
            cell.hill = None
            cell.ais = None
bpv_len_sum = np.zeros([len(hill_gk_x), len(len_x)])
fwv_len_sum = np.zeros([len(hill_gk_x), len(len_x)])
bpv_dist_sum = np.zeros([len(hill_gk_x), len(dist_x)])
fwv_dist_sum = np.zeros([len(hill_gk_x), len(dist_x)])

save_data_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/data/hk/'
save_figure_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/figure/hk/'
if not os.path.exists(save_data_path):
	os.makedirs(save_data_path)
if not os.path.exists(save_figure_path):
	os.makedirs(save_figure_path)

for i,gk in enumerate(hill_gk_x):		
	for j, l in enumerate(len_x):
		print('hk:', gk, 'pS/um2; len:', l,'um;')		
		cell = nm.NeuronModel(ail=int(l), na_type=1, hk=gk)
		stim = nm.attach_current_clamp(cell, amp=.7)
		vec = nm.set_recording_vectors(cell)
		nm.simulate()
		nm.save_vec(vec, save_data_path+'hk_'+str(gk)+'_len_'+str(l)+'_')
		nm.show_output(vec, save_figure_path+'hk_'+str(gk)+'_len_'+str(l)+'_')
		bpv_len_sum[i,j], fwv_len_sum[i,j], ___ = nm.cal_velocity(vec, ['ais'])
		cell.dend1 = None
		cell.dend2 = None
		cell.soma = None
		cell.hill = None
		cell.ais  = None
		cell.axon = None
		for sec in h.allsec():
			print(sec)
			
        save_data_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/data/aik' + str(
            na12m) + str(na16m) + '/'
        save_figure_path = 'E:/02_AIS/Simulation/AIS/190708/fit_v2/figure/aik' + str(
            na12m) + str(na16m) + '/'
        if not os.path.exists(save_data_path):
            os.makedirs(save_data_path)
        if not os.path.exists(save_figure_path):
            os.makedirs(save_figure_path)

        for i, gk in enumerate(ais_gk_x):
            for j, l in enumerate(len_x):
                print('na12m:', na12m, '; na16m:', na16m, ';gk:', gk,
                      'pS/um2; len:', l, 'um;')
                cell = nm.NeuronModel(ail=int(l),
                                      na_type=2,
                                      na12_map=na12m,
                                      na16_map=na16m,
                                      aik=gk)
                stim = nm.attach_current_clamp(cell, amp=.7)
                vec = nm.set_recording_vectors(cell)
                nm.simulate()
                nm.save_vec(
                    vec, save_data_path + str(na12m) + str(na16m) + '_gk_' +
                    str(gk) + '_len_' + str(l) + '_')
                nm.show_output(
                    vec, save_figure_path + str(na12m) + str(na16m) + 'gk_' +
                    str(gk) + '_len_' + str(l) + '_')
                bpv_len_sum[i, j], fwv_len_sum[i, j], ___ = nm.cal_velocity(
                    vec, ['ais'])
                cell.dend1 = None
                cell.dend2 = None
Beispiel #10
0
@author: cbi
"""

import neuronmodel as nm
import numpy as np
from matplotlib import pyplot as plt
from neuron import h
import os
import pickle

plt.close('all')
seg = ['ais']

cell = nm.NeuronModel(dl=1000, dd=2,  sl=40, sd=20, \
       hl=10, hd=2, ail=40, aid=1.2, axl=1000, axd=1.2,\
       dna=100, sna=100, hna=300, aina=4000, axna=300, dk=20, \
       sk=20, hk=150, aik=1000, axk=150,\
       na_type=6, aina12=6000, aina16=6000)
stim = nm.attach_current_clamp(cell, amp=1.0)
vec = nm.set_recording_vectors(cell)
nm.simulate()
nm.show_output(vec, None)
bpv, fwv, __ = nm.cal_velocity(vec, seg)
print('normal:', bpv, fwv)
cell.dend1 = None
cell.soma = None
cell.hill = None
cell.ais = None
cell.axon = None
for sec in h.allsec():
    print(sec)
aik_i = 3000
hna_i = 300 
hk_i = 200
hl_i = 15
ail_i = 40
hd_i = 4


for j, l in enumerate(len_x):	
	print(j,l)
	cell = nm.NeuronModel(ail=int(l), \
					   na_type=na_type_i, \
					   na12_map=na12_map_i, \
					   na16_map=na16_map_i, \
					   aina12=aina12_i, \
					   aina16=aina16_i, \
					   aik=aik_i,\
					   hna=hna_i,\
					   hk=hk_i,\
					   hl = hl_i,\
					   hd = hd_i)
	stim = nm.attach_current_clamp(cell, amp=.7)
	vec = nm.set_recording_vectors(cell)
	nm.simulate()
	nm.show_output(vec, save_figure_log_path+'len_'+str(l)+'_')
	bpv_len_sum[0,j], fwv_len_sum[0,j], ___ = nm.cal_velocity(vec, ['ais'])
	cell.dend1 = None
	cell.dend2 = None
	cell.soma = None
	cell.hill = None
	cell.ais  = None