Skip to main content

A framework designed to calculate the output of neurons based on non-homogeneous Poisson processes and rate statistic calculations

Project description

CD-Network

CD-Network is a Python library designed for the analytical derivation of the stochastic output of coincidence detector ( CD) cells. These cells receive inputs modeled as non-homogeneous Poisson processes (NHPP) with both excitatory and inhibitory components.

cd_scheme

Features

Dynamic Connections (CD Network)

Define how cells are interconnected within the network and how external inputs affect cell responses.

import numpy as np
from cd_network.network import NeuralNetwork

if __name__ == '__main__':
    # Load the neural network configuration from a JSON file
    config_path = r'config.json'  # Path to the configuration file
    network = NeuralNetwork(config_path)

    # Define external inputs for the network
    external_inputs = {
        'external1': np.random.randn(1000),
        'external2': np.random.randn(1000),
        'external3': np.random.randn(1000)
    }

    # Run the network with the provided external inputs
    outputs = network.run_network(external_inputs)

    # Print the outputs of the network
    print(outputs)

Configuration File

The CD network simulation uses a JSON configuration file. Below is a breakdown of the configuration structure:

fs: Sampling frequency in Hz. This value is used across all cells for time-based calculations.

cells: An array of objects where each object represents a neural cell and its specific parameters:
    type: Specifies the type of the cell (e.g., ei, simple_ee, cd).
    id: A unique identifier for the cell.
    params: Parameters specific to the cell type, such as delta_s for the time window in seconds and n_spikes for the minimum number of spikes required.

connections: An array defining the connections between cells or from external inputs to cells:
    source: Identifier for the source of the input. This can be an external source or another cell.
    target: Identifier for the cell receiving the input.
    input_type: Specifies whether the input is excitatory or inhibitory.

Example Configuration File

CD Cells

ei(excitatory_input, inhibitory_inputs, delta_s, fs)

Computes the output of an excitatory-inhibitory (EI) neuron model. The model outputs spikes based on the excitatory inputs, except when inhibited by any preceding spikes within a specified time window from the inhibitory inputs.

  • Parameters:

    • excitatory_input (np.ndarray): 1D array of spike times or binary spikes from the excitatory neuron.
    • inhibitory_inputs (np.ndarray): 1D or 2D array of spike times or binary spikes from one or more inhibitory neurons.
    • delta_s (float): Coincidence integration duration in seconds, defining the time window for inhibition.
    • fs (float): Sampling frequency in Hz.
  • Returns:

    • np.ndarray: Output spike times or binary spike array after applying the excitatory-inhibitory interaction.

simple_ee(inputs, delta_s, fs)

Simplifies the model of excitatory-excitatory (EE) interaction where an output spike is generated whenever both inputs spike within a specified time interval.

  • Parameters:

    • inputs (np.ndarray): 2D array of excitatory input spikes.
    • delta_s (float): Coincidence integration duration in seconds.
    • fs (float): Sampling frequency in Hz.
  • Returns:

    • np.ndarray: Output spike times or binary spike array after applying the EE interaction.

ee(inputs, n_spikes, delta_s, fs)

A general excitatory-excitatory (EE) cell model that generates a spike whenever at least a minimum number of its inputs spike simultaneously within a specific time interval.

  • Parameters:

    • inputs (np.ndarray): 2D array of excitatory input spikes.
    • n_spikes (int): Minimum number of inputs that must spike simultaneously.
    • delta_s (float): Coincidence integration duration in seconds.
    • fs (float): Sampling frequency in Hz.
  • Returns:

    • np.ndarray: Output spike times or binary spike array based on the input conditions.

cd(excitatory_inputs, inhibitory_inputs, n_spikes, delta_s, fs)

Models the output of a coincidence detector (CD) cell which generates spikes based on the relative timing and number of excitatory and inhibitory inputs within a defined interval.

  • Parameters:

    • excitatory_inputs (np.ndarray): 2D array of excitatory input spikes.
    • inhibitory_inputs (np.ndarray): 2D array of inhibitory input spikes.
    • n_spikes (int): Minimum excess of excitatory spikes over inhibitory spikes required to generate an output spike.
    • delta_s (float): Interval length in seconds.
    • fs (float): Sampling frequency in Hz.
  • Returns:

    • np.ndarray: Output spike array after applying the CD interaction based on the relative timing and number of inputs.

Installation

You can install CD-Network directly from pypi:

pip install cd_network

Or you can install CD-Network directly from the source code:

git clone https://github.com/nuniz/CoincidenceDetectionNetwork.git
cd CoincidenceDetectionNetwork
pip install .

Contribution

run pre-commit to check all files in the repo.

pre-commit run --all-files

Reference

Krips R, Furst M. Stochastic properties of auditory brainstem coincidence detectors in binaural perception. J Acoust Soc Am. 2009 Mar;125(3):1567-83. doi: 10.1121/1.3068446. PMID: 19275315.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cd_network-0.1.3.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

cd_network-0.1.3-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file cd_network-0.1.3.tar.gz.

File metadata

  • Download URL: cd_network-0.1.3.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for cd_network-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2630652534784ce6bc9489bed79d43c11e74e6e18a75c01507cf1cdde636cbe7
MD5 962067aa769a34ae3bc2b9b28b9ba480
BLAKE2b-256 bed9e91ddd5ce5b68f03196ab7a6b1d4153bdba96fbd51a9c9bac9714ea4e1b4

See more details on using hashes here.

File details

Details for the file cd_network-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cd_network-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for cd_network-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 83c6664846b71b8526ffb1a68fb2bbb5ddc3c705f2e128393318b1751a511e92
MD5 ed54b6cd2c3bb0a0878438e9aaaa6f21
BLAKE2b-256 3e04d212e778d4bd0c684e33e5f7e029366ed1d99d45a7af2bf7af84d5f6ec37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page