{"id":17093539,"url":"https://github.com/nuniz/coincidencedetectionnetwork","last_synced_at":"2025-11-11T04:02:50.184Z","repository":{"id":247279277,"uuid":"825434947","full_name":"nuniz/CoincidenceDetectionNetwork","owner":"nuniz","description":"Analytical derivation of the stochastic output of coincidence detection (CD) neurons","archived":false,"fork":false,"pushed_at":"2024-07-16T06:04:45.000Z","size":488,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-03T08:03:22.337Z","etag":null,"topics":["auditory-nerve","brainstem-neuron","cd","cochlea","coincidence-detection","hearing","hearing-aids","neural-network","neuron","neuron-simulator","neurons","physical-modeling","poission"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nuniz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T19:02:55.000Z","updated_at":"2024-07-16T12:35:39.000Z","dependencies_parsed_at":"2024-07-07T20:41:57.506Z","dependency_job_id":null,"html_url":"https://github.com/nuniz/CoincidenceDetectionNetwork","commit_stats":null,"previous_names":["nuniz/coincidencedetectionnetwork"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2FCoincidenceDetectionNetwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2FCoincidenceDetectionNetwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2FCoincidenceDetectionNetwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2FCoincidenceDetectionNetwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuniz","download_url":"https://codeload.github.com/nuniz/CoincidenceDetectionNetwork/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239986195,"owners_count":19729589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auditory-nerve","brainstem-neuron","cd","cochlea","coincidence-detection","hearing","hearing-aids","neural-network","neuron","neuron-simulator","neurons","physical-modeling","poission"],"created_at":"2024-10-14T14:07:28.395Z","updated_at":"2025-11-11T04:02:50.132Z","avatar_url":"https://github.com/nuniz.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CD-Network\n\nCD-Network is a Python library designed for the analytical derivation of the stochastic output (*instantaneous spikes rate*) of coincidence detection \n(CD) neurons, based on non-homogeneous Poisson processes.\n\n[![DOI](https://zenodo.org/badge/825434947.svg)](https://zenodo.org/doi/10.5281/zenodo.12746265)\n\n![cd_scheme](cd.png)\n\n\n\n\n## Features\n\nEach cell can run individually through its respective function (ei, simple_ee, ee, cd), or be configured via a network\nfile.\n\n### Dynamic Connections (CD Network)\n\nDefine how cells are interconnected within the network and how external inputs affect cell\nresponses.\n\n```python\nimport numpy as np\nfrom cd_network.network import CDNetwork\n\nif __name__ == '__main__':\n    # Load the neural network configuration from a JSON file\n    config_path = r'config.json'  # Path to the configuration file\n    network = CDNetwork(config_path)\n\n    # Define external inputs for the network\n    external_inputs = {\n        'external1': np.random.randn(1000),\n        'external2': np.random.randn(1000),\n        'external3': np.random.randn(1000)\n    }\n\n    # Run the network with the provided external inputs\n    outputs = network(external_inputs)\n\n    # Print the outputs of the network\n    print(outputs)\n\n```\n\nTo visualize the network's connections, use:\n```python\nnetwork.plot_network_connections()\n```\n\n### Configuration File\n\nThe CD network uses a JSON configuration file. Below is a breakdown of the configuration structure:\n\n    fs: Sampling frequency in Hz. This value is used across all cells for time-based calculations.\n\n    cells: An array of objects where each object represents a neural cell and its specific parameters:\n        type: Specifies the type of the cell (e.g., ei, simple_ee, cd).\n        id: A unique identifier for the cell.\n        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.\n\n    connections: An array defining the connections between cells or from external inputs to cells:\n        source: Identifier for the source of the input. This can be an external source or another cell.\n        target: Identifier for the cell receiving the input.\n        input_type: Specifies whether the input is excitatory or inhibitory.\n\n[Example Configuration File](example_notebooks/config.json)\n\n### CD Cells\n[My notes about CD neurons](notes.pdf)\n\n#### `ei(excitatory_input, inhibitory_inputs, delta_s, fs)`\n\nComputes the output of an excitatory-inhibitory (EI) neuron model.\nThe model outputs spikes based on the excitatory inputs, except when inhibited by any preceding spikes within a\nspecified time window from the inhibitory inputs.\n\n- **Parameters:**\n    - `excitatory_input (np.ndarray)`: 1D or 2D array of instantaneous rates of one or more excitatory neuron.\n    - `inhibitory_inputs (np.ndarray)`: 1D or 2D array of instantaneous rate of one or more inhibitory neurons.\n    - `delta_s (float)`: Coincidence integration duration in seconds, defining the time window for inhibition.\n    - `fs (float)`: Sampling frequency in Hz.\n\n- **Returns:**\n    - `np.ndarray`: Output instantaneous rates array after applying the excitatory-inhibitory interaction.\n\n#### `simple_ee(inputs, delta_s, fs)`\n\nSimplifies the model of excitatory-excitatory (EE) interaction where an output spikes rate is generated whenever both inputs\nspike within a specified time interval.\n\n- **Parameters:**\n    - `inputs (np.ndarray)`: 2D array of excitatory input instantaneous rates.\n    - `delta_s (float)`: Coincidence integration duration in seconds.\n    - `fs (float)`: Sampling frequency in Hz.\n\n- **Returns:**\n    - `np.ndarray`: Output instantaneous rates array after applying the EE interaction.\n\n#### `ee(inputs, n_spikes, delta_s, fs)`\n\nA general excitatory-excitatory (EE) cell model that generates a spike whenever at least a minimum number of its inputs\nspike simultaneously within a specific time interval.\n\n- **Parameters:**\n    - `inputs (np.ndarray)`: 2D array of excitatory input instantaneous rates.\n    - `n_spikes (int)`: Minimum number of inputs that must spike simultaneously.\n    - `delta_s (float)`: Coincidence integration duration in seconds.\n    - `fs (float)`: Sampling frequency in Hz.\n\n- **Returns:**\n    - `np.ndarray`: Output instantaneous rates array based on the input conditions.\n\n#### `cd(excitatory_inputs, inhibitory_inputs, n_spikes, delta_s, fs)`\n\nModels the output of a coincidence detector (CD) cell which generates spikes rate based on the relative timing and number of\nexcitatory and inhibitory inputs within a defined interval.\n\n- **Parameters:**\n    - `excitatory_inputs (np.ndarray)`: 2D array of excitatory input instantaneous rates.\n    - `inhibitory_inputs (np.ndarray)`: 2D array of inhibitory input instantaneous rates.\n    - `n_spikes (int)`: Minimum excess of excitatory spikes over inhibitory spikes required to generate an output spikes rate.\n    - `delta_s (float)`: Interval length in seconds.\n    - `fs (float)`: Sampling frequency in Hz.\n\n- **Returns:**\n    - `np.ndarray`: Output instantaneous rates after applying the CD interaction based on the relative timing and number of\n      inputs.\n\n## Installation\n\nYou can install CD-Network directly from pypi:\n\n```bash\npip install cd_network\n```\n\nOr you can install CD-Network directly from the source code:\n\n```bash\ngit clone https://github.com/nuniz/CoincidenceDetectionNetwork.git\ncd CoincidenceDetectionNetwork\npip install .\n```\n\n## Contribution\n\nBefore contributing, run pre-commit to check all files in the repo.\n\n```bash \npre-commit run --all-files\n```\n\n## Citation\nIf you use this software, please cite it as below.\n\n```\n@software{asaf_zorea_2023_8004059,\n  author       = {Asaf Zorea},\n  title        = {CoincidenceDetectionNetwork: Analytical derivation of the stochastic output of coincidence detection neurons},\n  month        = jun,\n  year         = 2024,\n  publisher    = {Zenodo},\n  version      = {v0.1.4},\n  doi          = {10.5281/zenodo.12746266},\n  url          = {https://doi.org/10.5281/zenodo.12746266}\n}\n```\n\nKrips R, Furst M. Stochastic properties of coincidence-detector neural cells. Neural Comput. 2009 Sep;21(9):2524-53. \ndoi: 10.1162/neco.2009.07-07-563. PMID: 19548801.\n\n## Further Readings\nZorea Asaf, and Miriam Furst. Contribution of Coincidence Detection to Speech Segregation in Noisy Environments. \narXiv:2405.06072, arXiv, 9 May 2024. arXiv.org, https://doi.org/10.48550/arXiv.2405.06072.\n\nKrips R, Furst M. Stochastic properties of auditory brainstem coincidence detectors in binaural perception.\nJ Acoust Soc Am. 2009 Mar;125(3):1567-83. doi: 10.1121/1.3068446. PMID: 19275315.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuniz%2Fcoincidencedetectionnetwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuniz%2Fcoincidencedetectionnetwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuniz%2Fcoincidencedetectionnetwork/lists"}