cnmodel.populations package

Definitions of cell populations for each cell type.

cnmodel.populations.population

class cnmodel.populations.population.Population(species, size, fields, synapsetype='multisite', **kwds)[source]

Bases: object

A Population represents a group of cell all having the same type.

Populations provide methods for:

  • Adding cells to the population with characteristic distributions.
  • Connecting the cells in one population to the cells in another.
  • Automatically adding cells to satisfy connectivity requirements when connecting populations together.

Populations have a concept of a “natural” underlying distribution of neurons, and behave as if all neurons in this distribution already exist in the model. However, initially all neurons are virtual, and are only instantiated to become a part of the running model if the neuron provides synaptic input to another non-virtual neuron, or if the user explicitly requests a recording of the neuron.

Subclasses represent populations for a specific cell type, and at least need to reimplement the create_cell and connection_stats methods.

cell_connections(index)[source]

Return a dictionary containing, for each population, a list of cells connected to the cell in this population at index.

cells

The array of cells in this population.

For all populations, this array has a ‘cell’ field that is either 0 (for virtual cells) or a Cell instance (for real cells).

Extra fields may be added by each Population subclass.

connect(*pops)[source]

Connect this population to any number of other populations.

A connection is unidirectional; calling pop1.connect(pop2) can only result in projections from pop1 to pop2.

Note that the connection is purely symbolic at first; no cells are actually connected by synapses at this time.

connect_pop_to_cell(pop, cell_index)[source]

Connect cells in a presynaptic population to the cell in this population at cell_index, and return the presynaptic indexes of cells that were connected.

This method is responsible for choosing pairs of cells to be connected by synapses, and may be overridden in subclasses.

The default implementation calls self.connection_stats() to determine the number and selection criteria of presynaptic cells.

connection_stats(pop, cell_rec)[source]

The population pop is being connected to the cell described in cell_rec.

This method is responsible for deciding the distributions of presynaptic cell properties for any given postsynaptic cell (for example, a cell with cf=10kHz might receive SGC input from 10 cells selected from a normal distribution centered at 10kHz).

The default implementation of this method uses the ‘convergence’ and ‘convergence_range’ values from the data tables to specify a lognormal distribution of presynaptic cells around the postsynaptic cell’s CF.

This method must return a tuple (size, dist) with the following values:

  • size: integer giving the number of cells that should be selected from the presynaptic population and connected to the postsynaptic cell.
  • dist: dictionary of {property_name: distribution} pairs that describe how cells should be selected from the presynaptic population. See keyword arguments to select() for more information on the content of this dictionary.
create_cell(cell_rec)[source]

Return a single new cell to be used in this population. The cell_rec argument is the row from self.cells that describes the cell to be created.

Subclasses must reimplement this method.

create_cells(cell_inds)[source]

Instantiate each cell in cell_inds, which is a list of indexes into self.cells.

get_cell(i, create=True)[source]

Return the cell at index i. If the cell is virtual, then it will be instantiated first unless create is False.

get_cell_index(cell)[source]

Return the index of cell.

pre_connections

The list of populations connected to this one.

real_cells()[source]

Return indexes of all real cells in this population.

Initially, all cells in the population are virtual–they are accounted for, but not actually instantiated as part of the NEURON simulation. Virtual cells can be made real by calling get_cell(). This method returns the indexes of all cells for which get_cell() has already been invoked.

resolve_inputs(depth=1)[source]

For each _real_ cell in the population, select a set of presynaptic partners from each connected population and generate a synapse from each.

Although it is allowed to call resolve_inputs multiple times for a single population, each individual cell will only resolve its inputs once. Therefore, it is recommended to create and connect all populations before making any calls to resolve_inputs.

select(size, create=False, **kwds)[source]

Return a list of indexes for cells matching the selection criteria.

The size argument specifies the number of cells to return.

If create is True, then any selected cells that are virtual will be instantiated.

Each keyword argument must be the name of a field in self.cells. Values may be:

  • A distribution (see scipy.stats), in which case the distribution influences the selection of cells
  • An array giving the probability to assign to each cell in the population
  • A number, in which case the cell(s) with the closest match are returned. If this is used, it overrides all other criteria except where they evaluate to 0.

If multiple distributions are provided, then the product of the survival functions of all distributions determines the probability of selecting each cell.

species
unresolved_cells()[source]

Return indexes of all real cells whose inputs have not been resolved.

cnmodel.populations.bushy

class cnmodel.populations.bushy.Bushy(species='mouse', **kwds)[source]

Bases: cnmodel.populations.population.Population

Population of bushy cells.

Cells are distributed uniformly from 2kHz to 64kHz.

Note that cf is the mean value used when selecting SGCs to connect; it is NOT the measured CF of the cell (although it should be close).

connection_stats(pop, cell_rec)[source]

The population pop is being connected to the cell described in cell_rec. Return the number of presynaptic cells that should be connected and a dictionary of distributions used to select cells from pop.

create_cell(cell_rec)[source]

Return a single new cell to be used in this population. The cell_rec argument is the row from self.cells that describes the cell to be created.

type = 'bushy'

cnmodel.populations.dstellate

class cnmodel.populations.dstellate.DStellate(species='mouse', **kwds)[source]

Bases: cnmodel.populations.population.Population

create_cell(cell_rec)[source]

Return a single new cell to be used in this population. The cell_rec argument is the row from self.cells that describes the cell to be created.

type = 'dstellate'

cnmodel.populations.sgc

class cnmodel.populations.sgc.SGC(species='mouse', model='dummy', **kwds)[source]

Bases: cnmodel.populations.population.Population

A population of spiral ganglion cells.

The cell distribution is uniform from 2kHz to 64kHz, evenly divided between spontaneous rate groups.

connect_pop_to_cell(pop, index)[source]
create_cell(cell_rec)[source]

Return a single new cell to be used in this population. The cell_rec argument is the row from self.cells that describes the cell to be created.

set_seed(seed)[source]
set_sound_stim(stim, parallel=False)[source]

Set a sound stimulus to generate spike trains for all (real) cells in this population.

type = 'sgc'

cnmodel.populations.tstellate

class cnmodel.populations.tstellate.TStellate(species='mouse', **kwds)[source]

Bases: cnmodel.populations.population.Population

create_cell(cell_rec)[source]

Return a single new cell to be used in this population. The cell_rec argument is the row from self.cells that describes the cell to be created.

type = 'tstellate'