CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
Project: Testing 18.04
Views: 720
Embed | Download | Raw |
Kernel: Python 3 (system-wide)

NEURON simulation environment

The NEURON simulation environment is used in laboratories and classrooms around the world for building and using computational models of neurons and networks of neurons.

Kernel: Python 3 (system-wide)

CoCalc Setup

important unset DISPLAY, otherwise gui is loading and neron crashes

import os if 'DISPLAY' in os.environ: del os.environ['DISPLAY']

Add the library location to the search path

import sys sys.path.insert(0, '/usr/local/nrn/lib/python/')
from neuron import h, __version__ __version__
soma = h.Section(name='soma')
print("type(soma) = {}".format(type(soma))) print("type(soma(0.5)) ={}".format(type(soma(0.5))))
mech = soma(0.5).pas print(dir(mech))
asyn = h.AlphaSynapse(soma(0.5))
print("asyn.e = {}".format(asyn.e)) print("asyn.gmax = {}".format(asyn.gmax)) print("asyn.onset = {}".format(asyn.onset)) print("asyn.tau = {}".format(asyn.tau))
asyn.onset = 20 asyn.gmax = 1
v_vec = h.Vector() # Membrane potential vector t_vec = h.Vector() # Time stamp vector v_vec.record(soma(0.5)._ref_v) t_vec.record(h._ref_t)
h.load_file('stdrun.hoc') h.tstop = 40.0
from matplotlib import pyplot pyplot.figure(figsize=(8, 4)) # Default figsize is (8,6) pyplot.plot(t_vec, v_vec) pyplot.xlabel('time (ms)') pyplot.ylabel('mV')