728x90
반응형
🙆♂️ 세포 작동여부 확인
아직 자극은 주지 않았지만 만든 cell이 작동하는지 확인해보겠습니다.
recording_cell = my_cells[0]
soma_v = h.Vector().record(recording_cell.soma(0.5)._ref_v)
dend_v = h.Vector().record(recording_cell.dend(0.5)._ref_v)
t = h.Vector().record(h._ref_t)
기록하고
h.finitialize(-65)
h.continuerun(25)
값 지정해주고
%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(t, soma_v, label='soma(0.5)')
plt.plot(t, dend_v, label='dend(0.5)')
plt.legend()
plt.show()
그래프를 그려주면
그래프가 잘 그려지는 모습을 확인했습니다.
🙋♂️ 시냅스 전도
시냅스 값을 기록하는 새로운 변수를 만들어줍니다.
syn_i = h.Vector().record(syn_._ref_i)
h.finitialize(-65)
h.continuerun(25)
전위 설정해주고
fig = plt.figure(figsize=(8,4))
ax1 = fig.add_subplot(2, 1, 1)
soma_plot = ax1.plot(t, soma_v, color='black', label='soma(0.5)')
dend_plot = ax1.plot(t, dend_v, color='red', label='dend(0.5)')
rev_plot = ax1.plot([t[0], t[-1]], [syn_.e, syn_.e], label='syn reversal',
color='blue', linestyle=':')
ax1.legend()
ax1.set_ylabel('mV')
ax1.set_xticks([])
ax2 = fig.add_subplot(2, 1, 2)
syn_plot = ax2.plot(t, syn_i, color='blue', label='synaptic current')
ax2.legend()
ax2.set_ylabel(h.units('ExpSyn.i'))
ax2.set_xlabel('time (ms)')
plt.show()
시뮬레이션을 확인하면
위에서 설정한 대로 10ms에 자극이 전달됩니다.
이제 다음 세포로 시냅스가 전도되도록 코딩해보겠습니다.
syns = []
netcons = []
for source, target in zip(my_cells, my_cells[1:] + [my_cells[0]]):
syn = h.ExpSyn(target.dend(0.5))
nc = h.NetCon(source.soma(0.5)._ref_v, syn, sec=source.soma)
nc.weight[0] = 0.05
nc.delay = 5
netcons.append(nc)
syns.append(syn)
zip을 통해서 배열 마지막 값과 첫 번째 값을 연결시켜줍니다.
h.finitialize(-65 * mV)
h.continuerun(100 * ms)
plt.plot(t, soma_v, label='soma(0.5)')
plt.plot(t, dend_v, label='dend(0.5)')
plt.legend()
plt.show()
시뮬레이션 결과를 확인해보면
spike_times = [h.Vector() for nc in netcons]
for nc, spike_times_vec in zip(netcons, spike_times):
nc.record(spike_times_vec)
h.finitialize(-65)
h.continuerun(100)
for i, spike_times_vec in enumerate(spike_times):
print('cell {}: {}'.format(i, list(spike_times_vec)))
각 셀에 대한 스파이크 시간값을 나타낸 것인데 아직은 무슨 말인지 모르겠습니다.
import matplotlib.pyplot as plt
plt.figure()
for i, spike_times_vec in enumerate(spike_times):
plt.vlines(spike_times_vec, i + 0.5, i + 1.5)
plt.show()
이를 그래프로 그리면 이런 모양입니다.
728x90
반응형
'AI > neuron' 카테고리의 다른 글
[neuron][파이썬] 21. 깃헙 뉴런 튜토리얼 - Single compartment neuron model (0) | 2022.07.27 |
---|---|
[neuron][파이썬] 18. 확장된 링 네트워크 (0) | 2022.07.25 |
[neuron][파이썬] 16. 링 네트워크 구성을 위한 초기 구성 - Initial configuration for build a ring network (0) | 2022.07.22 |
[neuron][파이썬] 15. 여러 개 시뮬레이션2 - Run the simulations (0) | 2022.07.22 |
[neuron][파이썬] 14. 여러 개 시뮬레이션1 - Run the simulation (0) | 2022.07.21 |