pyLGN is a visual stimulus-driven simulator of spatiotemporal cell responses in the early part of the visual system consisting of the retina, lateral geniculate nucleus (LGN) and primary visual cortex. The simulator is based on a mechanistic, firing rate model that incorporates the influence of thalamocortical loops, in addition to the feedforward responses. The advantage of the simulator lies in its computational and conceptual ease, allowing for fast and comprehensive exploration of various scenarios for the organization of the LGN circuit.
In this example a natural image is used as stimulus to stimulate a layer of (ON-center) ganglion cells. The static image is shown in 80 ms after a 40 ms delay, and the response of the ganglion cells is shown as a heatmap from blue to red (low to high response).
import pylgn
import pylgn.kernels as kernel
import quantities as pq
# create network
network = pylgn.Network()
# create integrator
integrator = network.create_integrator(nt=8, nr=9, dt=1*pq.ms, dr=0.1*pq.deg)
# create kernels
Wg_r = kernel.spatial.create_dog_ft()
Wg_t = kernel.temporal.create_biphasic_ft()
# create neurons
ganglion = network.create_ganglion_cell(kernel=(Wg_r, Wg_t))
# create stimulus
stimulus = pylgn.stimulus.create_natural_image(filenames="natural_scene.png",
delay=40*pq.ms,
duration=80*pq.ms)
network.set_stimulus(stimulus, compute_fft=True)
# compute
network.compute_response(ganglion)
# visulize
pylgn.plot.animate_cube(ganglion.response,
title="Ganglion cell responses",
dt=integrator.dt.rescale("ms"))
The resulting response is shown below:
-
The documentation for pyLGN can be found at http://pylgn.rtfd.io/.
pyLGN can easily be installed using conda:
conda install -c defaults -c conda-forge -c cinpla pylgn
To install a specific version use:
conda install -c defaults -c conda-forge -c cinpla pylgn=0.91
pyLGN can also be installed by cloning the Github repository:
$ git clone https://github.com/miladh/pylgn
$ cd /path/to/pylgn
$ python setup.py install
Note that dependencies must be installed independently.
pyLGN has the following dependencies:
python >=3.5
matplotlib
numpy
scipy
setuptools
pillow
quantities 0.12.1
If you use pyLGN in your work, please cite: