neurodynex.neuron_type package

Submodules

neurodynex.neuron_type.neurons module

This file implements a type I and a type II model from the abstract base class NeuronAbstract.

You can inject step currents and plot the responses, as well as get firing rates.

Relevant book chapters:

class neurodynex.neuron_type.neurons.NeuronAbstract[source]

Bases: object

Abstract base class for both neuron types.

This stores its own recorder and network, allowing each neuron to be run several times with changing currents while keeping the same neurogroup object and network internally.

get_rate(I_amp, t_end=1000.0, do_plot=False)[source]

Return the firing rate under a current step.

Parameters:
  • NeuronClass (type) – Subclass of neurons.AbstractNeuron
  • I_amp (float) – Amplitude of voltage step
  • t_end (float) – Length of simulation
  • do_plot (bool, optional) – plot the results
Returns:

firing rate of neuron

Return type:

float

make_neuron()[source]

Abstract function, which creates neuron attribute for this class.

run(curr, simtime)[source]

Runs the neuron for a given current.

Parameters:
  • curr (TimedArray) – Input current injected into the neuron
  • simtime (float) – Simulation time [seconds]
Returns:

Brian2 StateMonitor with input current (I) and voltage (V) recorded

Return type:

StateMonitor

step(t_end=300.0, I_tstart=20, I_tend=270, I_amp=0.5, do_plot=True, show=True)[source]

Runs the neuron for a step current and plots the data.

Parameters:
  • t_end (float, optional) – the simulation time of the model [ms]
  • I_tstart (float, optional) – start of current step [ms]
  • I_tend (float, optional) – start of end step [ms]
  • I_amp (float, optional) – amplitude of current step [nA]
  • do_plot (bool, optional) – plot the resulting simulation
  • show (bool, optional) – call plt.show for the plot
Returns:

Brian2 StateMonitor with input current (I) and voltage (V) recorded

Return type:

StateMonitor

class neurodynex.neuron_type.neurons.NeuronTypeOne[source]

Bases: neurodynex.neuron_type.neurons.NeuronAbstract

make_neuron()[source]

Sets the self.neuron attribute.

class neurodynex.neuron_type.neurons.NeuronTypeTwo[source]

Bases: neurodynex.neuron_type.neurons.NeuronAbstract

make_neuron()[source]

Sets the self.neuron attribute.

neurodynex.neuron_type.neurons.get_spiketimes(t, v, v_th=0.5, do_plot=False)[source]

Returns numpy.ndarray of spike times, for a given time and voltage series.

Parameters:
  • t (numpy.ndarray) – time dimension of timeseries [ms]
  • v (numpy.ndarray) – voltage dimension of timeseries [mV]
  • v_th (float, optional) – threshold voltage for spike detection [mV]
  • do_plot (bool, optional) – plot the results
Returns:

detected spike times

Return type:

np.ndarray

neurodynex.neuron_type.neurons.get_step_curr(I_tstart=20, I_tend=270, I_amp=0.5)[source]

Returns a pA step current TimedArray.

Parameters:
  • I_tstart (float, optional) – start of current step [ms]
  • I_tend (float, optional) – start of end step [ms]
  • I_amp (float, optional) – amplitude of current step [pA]
Returns:

Brian2 StateMonitor with input current (I) and voltage (V) recorded

Return type:

StateMonitor

neurodynex.neuron_type.neurons.plot_data(rec, title=None, show=False)[source]

Plots a TimedArray for values I, v and w

Parameters:
  • rec (TimedArray) – the data to plot
  • title (string, optional) – plot title to display
  • show (bool, optional) – call plt.show for the plot
Returns:

Brian2 StateMonitor with input current (I) and voltage (V) recorded

Return type:

StateMonitor

neurodynex.neuron_type.neurons.rec_to_tuple(rec)[source]

Extracts a tuple of numpy arrays from a brian2 StateMonitor.

Parameters:rec (StateMonitor) – state monitor with v, w, I recorded
Returns:(t, v, w, I) tuple of numpy.ndarrays
Return type:tuple

neurodynex.neuron_type.typeXY module

This module has two neuron models, NeuronX and NeuronY. One of them is Type I, the other is Type II - the assignment is randomly generated when the module is loaded.

Relevant book chapters:

class neurodynex.neuron_type.typeXY.NeuronX

Bases: neurodynex.neuron_type.neurons.NeuronTypeTwo

classmethod get_neuron_type(x)

Returns the underlying neuron type.

Returns:Class of the underlying neuron model
Return type:type
class neurodynex.neuron_type.typeXY.NeuronY

Bases: neurodynex.neuron_type.neurons.NeuronTypeOne

classmethod get_neuron_type(x)

Returns the underlying neuron type.

Returns:Class of the underlying neuron model
Return type:type
neurodynex.neuron_type.typeXY.create_models()[source]

Creates classes NeuronX and NeuronY in this module that are random assignments of Type1 and Type2 neuron models.

Module contents