<jupyter_start><jupyter_text>Passive Membrane Tutorial This is a tutorial which is designed to allow users to explore the passive responses of neuron membrane potentials and how it changes under various conditions such as current injection, ion concentration (both inside and outside the cell), change in membrane capacitance and passive conductances.Written by <NAME>; February 2018All units are in SI units.  Parameters:<jupyter_code>dt = 1e-4      #Integration time step. Reduce if you encounter NaN errors.
t_sim = 0.5    #Total time plotted. Increase as desired.

Na_in = 13     #Sodium ion concentration inside the cell. Default = 13 (in mM)
Na_out = 120   #Sodium ion concentration outside the cell. Default = 120 (in mM)
K_in = 140     #Potassium ion concentration inside the cell. Default = 140 (in mM)
K_out = 8      #Potassium ion concentration outside the cell. Default = 8 (in mM)

Cm = 1e-7      #Membrane capacitance. Default = 0.1 microF.
gNa = 5e-7     #Passive sodium conductance. Default = 0.5 microS.
gK = 1e-5      #Passive potassium conductance. Default = 10 microS.<jupyter_output><empty_output><jupyter_text>Nernst Potential Equations:<jupyter_code>import math as ma
Ena = -0.058*ma.log10(Na_in/Na_out);
Ek = -0.058*ma.log10(K_in/K_out);<jupyter_output><empty_output><jupyter_text>If you wish to use pre-determined ENa and EK values, set them here and convert this cell into code from Markdown:Ena = ??;Ek = ??;<jupyter_code>import numpy as np
niter = int(t_sim//dt)    #Total number of integration steps (constant).
#Output variables:
Vm = np.zeros(niter)
Ie = np.zeros(niter)
#Starting values: You can change the initial conditions of each simulation here:
Vm[0] = -0.070;<jupyter_output><empty_output><jupyter_text>Current Injection<jupyter_code>I_inj =-5e-8   #Current amplitude. Default = 50 nA.
t_start = 0.150  #Start time of current injection.
t_end = 0.350    #End time of current injection.

Ie[int(t_start//dt):int(t_end//dt)] = I_inj<jupyter_output><empty_output><jupyter_text>Calculation - do the actual computation here:<jupyter_code>#Integration steps - do not change:
for i in np.arange(niter-1):    
    Vm[i+1] = Vm[i] + dt/Cm*(Ie[i] - gNa*(Vm[i] - Ena) - gK*(Vm[i] - Ek));<jupyter_output><empty_output><jupyter_text>Plot results<jupyter_code>import matplotlib.pyplot as plt
%matplotlib notebook
plt.figure()
t = np.arange(niter)*dt;
plt.plot(t,Vm);
plt.xlabel('Time in s')
plt.ylabel('Membrane Voltage in V')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10600564288593309, 'fraction_numerical': 0.02781136638452237, 'mean_word_length': 4.772093023255814, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '362', 'license': 'MIT', 'n_tokens_mistral': 940, 'n_tokens_neox': 848, 'n_words': 269, 'path': 'Passive_Membrane_tutorial.ipynb', 'repo_name': 'zbpvarun/Neuron', 'size': '2490'}