API Reference#

This section provides the complete public API reference for SiNAPS, auto-generated from the docstrings in the project source code.

Section#

class sinaps.Section(**kwargs)#

Part of neuron with uniform physical values

Resistance and capacitance given per membrane-area unit

add_channel(C, x=None)#

Add a channel to the section

Parameters
  • C (Channel) –

  • x (Float, optional) – relative position along the section (between 0 and 1), if None (default) the channels is treated as a continuous density channel giving a surfacic current in nA/μm2

add_voltage_source(C, x=0)#

Add a voltage source to the section

Parameters
  • V (VoltageSource) –

  • x (Flaot, optional) – relative position along the section (between 0 and 1),

property c_m#

Membrane capacitance per unit length [pF/μm]

clear_channels()#

Clear all channels

property r_l#

Longitudinal resistance per unit length [GOhm/μm]

Neuron#

class sinaps.Neuron(sections, V_ref)#

Set of sections connected together.

sections#

sections is the structure the neuron : It is a dict with section as key and a tuple of integer as value for identifying the nodes

Type

dict(Section), optional

V_ref#

Resting potential of the neuron due to long term dynamic of ions channels not modeled

Type

float, optional

Examples

Create an empty neuron:

>>> nrn = Neuron()

Create a neuron with one section binding nodes 0 and 1:

>>> nrn = Neuron([(0,1)])

or specifying the section:

>>> sec = Section()
>>> nrn = Neuron({sec: (0,1)})
add_node_data(nodes=None, **kwargs)#

Add data to graph nodes

This is useful for plotting

add_reaction(left, right, k1, k2)#

Add chemical reaction to the Neuron.

The reaction is defined with the chemical equation and the reactions rates. The reaction will be simulated during the electrodiffusion simulation Species are automatically added to the neuron if they are not already present.

Parameters
  • left (dict(Species:number)) – chemical equation, with species as key and stoichiometric coefficients as value

  • right (dict(Species:number)) – chemical equation, with species as key and stoichiometric coefficients as value

  • k1 (float) – reaction rates, units depends of stoichiometric coeficents, base value are ms and mMol/L

  • k2 (float) – reaction rates, units depends of stoichiometric coeficents, base value are ms and mMol/L

add_section(sec, i, j)#

Connect nodes.

example : N.add_section(s,i,j) With i and j:Int and s:Section connect nodes i and j with section s

add_sections_from_dict(sections)#

Add multiple sections from dictionnary {sec:(i,j)}.

add_sections_from_list(sections)#

Add multiple sections from a list {(i,j)}.

add_species(species, C0=None, D=None)#

Add species to the neuron.

Set the paramaters C0 (initial concentration) and D (Diffusion coeficient) for each section

Parameters
  • species (Species) –

  • C0 (number or dict [mMol/L], optional) – Default value for initial concentration if not defined in the section. The default is None.

  • D (number or dict [𝜇𝑚^2/ms], optional) – Default value for difusion coef if not defined in the section. The default is None.

Raises

InitialConcentrationError

Examples

Add species Ca :

>>> nrn.add_species(Species.Ca)

Add species Ca with initial concentration 1 mMol/L and difusion coeficient 1 𝜇𝑚^2/ms:

>>> nrn = Neuron([(0,1)])
>>> nrn.add_species(Species.Ca, C0=1, D=1)
leaves()#

Return leaves section

property nb_nodes#

Number of nodes of the neuron

property nodes#

underlying graph nodes

radius_array()#

Return the radius of each nodes.

init_sim(dx) must have been previously called

property species#

species is a set of species for electrodiffusion simulation.

Simulation#

class sinaps.Simulation(*args, **kwargs)#

Object used for running simulations and accessing results

The class simulation is linked to a specific neuron and is used to run voltage propagation simulation and electrodiffusion simulations with some custom spatial and time resolution. The results of the simulation are stored as attributes

Parameters
  • neuron (sinaps.Neuron) – Neuron used for the simulation

  • dx (float) – Spatial resolution (um) to used if no specific dx is set for the section

  • force_dx (bool) – If True, dx will be used even if a custom dx was set for a section

Examples

Create the simulation with neuron N and spatial resolution of 20 um :

>>> sim=sn.Simulation(N,dx=20)
run(t_span, method='BDF', atol=1.49012e-08, **kwargs)#

Run the voltage related simulation

The results of the simulation are stored in attribute V

Parameters
  • t_span (2-tuple of number) – Timeframe for the simulation (ms)

  • **kwargs – args to pass to the ode solver. see the scipy solve_ivp doc

Examples

Run the simulation between 0 and 10 ms :

>>> sim.run((0,10))

View the results (potential vector for each time and position):

>>> sim.V
run_diff(species=None, temperature=310, method='BDF', atol=1.49012e-08, **kwargs)#

Run the electro-diffusion simulation based on Nersnt-Planck model.

The simulation for the voltage must have been run before.

The results of the simulation are stored in attribute C

Parameters
  • species ([species]) – Species to consider in simulation

  • temperature (float) – Temperature in Nerst Planck equation

  • **kwargs

    args to pass to the ode solver. see the scipy solve_ivp doc

Channels#

class sinaps.Channel#

Generic class describing a channel or a group of channel.

To implement a channel C, it is necessary to implement:

  • a function C.I(V,*st_vars) returning the net current towards inside ([pA] for point channel and [pA/μm2] for density channels ) of the mechanism with V the voltage (:array) and *st_vars the state variable of the mechanism (:array)

  • If there is state variables a function C.dS(V,*st_vars) returning a tuple with the differential of each state variable and a function S0 returning a tuple with the initial value for each state variable

class sinaps.channels.AMPAR(t0, gampa=0.02, tampa1=0.3, tampa2=3, V_ampa=70)#

Point channel with a AMPAr-type current starting at time t0.

Parameters
  • t0 (float) – start of the current [ms]

  • gampa (float) – max conductance of Ampar [nS]

  • tampa1 (float) – Ampar time constant [ms]

  • tampa2 (float) – Ampar time constant [ms]

  • V_ampa (float) – Ampar Nernst potential [mV]

class sinaps.channels.ConstantCurrent(current)#

Channel with a constant current.

Parameters

current (float) – The current in [pA] for point channel or pA/um2 for density channel

class sinaps.channels.Hodgkin_Huxley(gNa=120, V_Na=115, gK=36, V_K=- 12, gL=0.3, V_L=10.6)#

Hodgkin Huxley channels

Parameters
  • gNa (float) – [mS/cm2] Conductance of sodium channel

  • V_Na (float) – [mV] Equilibrium potential of sodium channel

  • gK (float) – [mS/cm2] Conductance of potasium channel

  • V_K (float) – [mV] Equilibrium potential of potasium channel

  • gL (float) – [mS/cm2] conductance of leak channel

  • V_L (float) – [mV] Equilibrium potential of leak channel

S0()#

Return the initial value for the state variable n = 0.317 m = 0.0526 h = 0.5734

class sinaps.channels.Hodgkin_Huxley_Ca(gCa=14.5, V_Ca=115)#

Ca channel to add to Hodgkin Huxley

Parameters
  • gCa (float) – [mS/cm2] Conductance of calcium channel

  • V_Ca (float) – [mV] Equilibrium potential of calcium channel

S0()#

Return the initial value for the state variable

m = 0 h = 1

class sinaps.channels.Hodgkin_Huxley_red(gNa=120, V_Na=115, gK=36, V_K=- 12, gL=0.3, V_L=10.6)#

Hodgkin Huxley channel reduced version.

Simplification of the classical HH, with m = m_{infty}, and h = 0.89 - 1.1 n (see Mathematical Physiology, Keener J. and Sneyd J., chap.5)

Parameters
  • gNa (float) – [mS/cm2] Conductance of sodium channel

  • V_Na (float) – [mV] Equilibrium potential of sodium channel

  • gK (float) – [mS/cm2] Conductance of potasium channel

  • V_K (float) – [mV] Equilibrium potential of potasium channel

  • gL (float) – [mS/cm2] conductance of leak channel

  • V_L (float) – [mV] Equilibrium potential of leak channel

S0()#

Return the initial value for the state variable

n = 0.316

class sinaps.channels.LeakChannel(G_m=0.3, Veq=0)#

Leak channel I = (V-Veq) * G_m.

Parameters
  • Veq (float) – [mV] Equilibrium potential for the leak channel

  • G_m (float) – [mS/cm2] Resistance of the menbrane (leak channel)

class sinaps.channels.NMDAR(t0, gnmda=0.2, tnmda1=11.5, tnmda2=0.67, V_nmda=75)#

Point channel with a NMDAr-type current starting at time t0.

Voltage-dependent flow of sodium (Na+) and small amounts of calcium (Ca2+) ions into the cell and potassium (K+) out of the cell.

Parameters
  • t0 (float) – start of the current [ms]

  • gnmda (float) – max conductance of NMDAr [nS]

  • tnmda1 (float) – NMDAr time constant [ms]

  • tnmda2 (float) – NMDAr time constant [ms]

  • V_nmda (float) – NMDAr Nernst potential [mV]

class sinaps.channels.PulseCurrent(current, t0, tf)#

Channel with a constant current between a time period.

Parameters
  • current (float) – The current in [pA] for point channel or pA/um2 for density channel

  • t0 (float) – [ms] start time of the current pulse

  • tf (float) – [ms] end time of the current pulse

I/O#

sinaps.io.read_swc(filename)#

Return a neuron from a swc file

See swc specification at www.neuronland.org/NLMorphologyConverter/MorphologyFormats/SWC/Spec.html

Parameters

filename (filename or url to swc file) –

Examples

Create a neuron nrn from swc file neuron.swc:

>>> nrn = read_swc('neuron.swc)