AI/neuron

[neuron][파이썬] 21. 깃헙 뉴런 튜토리얼 - Single compartment neuron model

내만 2022. 7. 27. 13:46
728x90
반응형

반응형

 

 

 

🙆‍♂️소개


단일 모델을 구성해보겠습니다.

 

from __future__ import division
from neuron import h
from neuron import gui
import matplotlib.pyplot as plt
import numpy as np

앞으로 이 부분은 항상 import 합니다.

 

 

🙋‍♂️모델 만들기 - create model


처음 할 일은 soma section을 만드는 것입니다. 뉴런의 형태를 만드는 것이죠. 그냥 원통과 같습니다. 축삭돌기와 수상돌기를 제거한 뉴런을 만드는 것입니다.

# create model
soma = h.Section(name='soma')
soma.L    = 10 # the length of the soma
soma.diam = 10 # the diameter of the soma
soma.Ra   = 100 # tha axial resistance
soma.insert('pas') # add passive properties 
soma.g_pas = 1/10000 # set the specific membrane to 10000 ohm*cm^2

soma는 세포체로 저기 동그란 녀석입니다.

L은 세포체의 길이

diam은 세포체의 지름

Ra는 축 저항 입니다.

그리고 passive라는 속성을 입력해고 specific membrane 값을 조정합니다. membrane은 막이라는 뜻입니다.

passive 매커니즘을 사용하는 이유는 아마 수동으로 전기 신호를 입력하기 위해서 일까요?

 

추가적으로 nseg값과 cm값이 있는데 nseg값은 세그멘트의 갯수 이고

cm값은 mebrane capacitance라고 막전위 값입니다.

 

🤷‍♂️ clamp 생성 및 전기 자극 변수 지정 -

Create Current Clamp and set the variables for the current injection


btw 이제 전기 자극을 줘서 시뮬레이션을 돌려볼 수 있습니다.

stim = h.IClamp(soma(0.5))
stim.delay = 20 # start of the current injection (ms)
stim.dur   = 100 # duration (ms)
stim.amp   = 0.01 # amplitude (nA)

IClamp라는 속성을 이용하여 soma의 중간 부분에 자극을 주는 것 입니다.

del,dur,amp 속성이 있는데

del은 자극이 시작될 때 까지의 지연 시간이고 (단위는 ms)

dur은 자극의 지속 시간 (단위는 ms)

amp는 자극의 진폭 (단위는 nA) 입니다.

 

💆‍♂️전기자극 전압과 시간 기록 -

Record voltage of soma and injected current and the time


soma_v = h.Vector()
soma_v.record(soma(0.5)._ref_v)

stim_current = h.Vector()
stim_current.record(stim._ref_i)

t = h.Vector()
t.record(h._ref_t)

시뮬레이션을 확인하기 위해 전기 자극을 했을 때를 시간 별로 기록합니다.

 

h.tstop = 220 # set the simulation time
h.v_init = -70
# run simulation
h.run()

그리고 시뮬레이션을 실행합니다.

시뮬레이션 시간을 설정하고 v_init으로 휴지전위 값을 설정합니다. 

 

 

🧏‍♂️ 반응을 그래프에 plot하기 - plot the injected current and the voltage response


f, (ax0, ax1) = plt.subplots(2,1, gridspec_kw = {'height_ratios':[3, 1]})
ax0.plot(t,soma_v, 'k')
ax1.plot(t,stim_current, 'gray', label='I (nA)')

ax0.set_ylabel('Voltage (mV)')
ax0.set_ylim(-80,-30)
ax0.spines['right'].set_visible(False)
ax0.spines['top'].set_visible(False)
ax0.spines['bottom'].set_visible(False)
ax0.get_xaxis().set_visible(False)


ax1.set_ylabel('I (nA)')
ax1.set_xlabel('t (ms)')
ax1.set_ylim(-0.01,0.02)
ax1.spines['right'].set_visible(False)
ax1.spines['top'].set_visible(False)
ax1.spines['left'].set_visible(False)
ax1.get_yaxis().set_visible(False)
ax1.legend(frameon=False)

위의 코드 중 set_ylavel은 y축 label이름을 정하는 것이고 ylim은 y좌표 limit 범위를 정하는 코드입니다.

 

🚀 추가적인 실험1 - soma 크기 키웠을 때와 줄였을 때 그래프 비교


위에는 소마가 L=10, diam = 10으로 돼있을 때 그래프다. -40까지는 갔다.

L=20, diam=20 때

 

L=5,diam=5일 때

체세포 크기가 작을 수록 Voltage값이 커집니다.

 

 

 

 

 

https://github.com/orena1/NEURON_tutorial

 

GitHub - orena1/NEURON_tutorial: Tutorial for understanding how to use NEURON simulation environment

Tutorial for understanding how to use NEURON simulation environment - GitHub - orena1/NEURON_tutorial: Tutorial for understanding how to use NEURON simulation environment

github.com

 

728x90
반응형