isoCycle


NameisoCycle JSON
Version 0.1.14 PyPI version JSON
download
home_pagehttps://github.com/esiabri/isoCycle
Summaryisolating single cycles of oscillatory activity in neuronal spiking
upload_time2023-08-09 16:47:07
maintainer
docs_urlNone
authorEhsan Sabri
requires_python
licenseCC-BY-NC-SA-4.0
keywords neuroscience oscillation cycle
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # isoCycle
<!-- [![preprint](https://img.shields.io/badge/preprint-bioRxiv-blue)]() -->
[![pip](https://img.shields.io/badge/poster-CCN23-blue)](https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/Poster_CCNeuro.pdf)
[![pip](https://img.shields.io/badge/pip%20install-PyPI-orange)](https://pypi.org/project/isoCycle/)
### A Deep Network-Based Decoder for Isolating Single Cycles of Neural Oscillations in Spiking Activity

<!-- <p align="justify"> -->
Neural oscillations are prominent features of brain activity, observable through frequency-specific power changes in electroencephalograms (EEG) and local field potentials (LFP), as well as coherence across brain regions, modulated by modes of activity. While identifying oscillations has primarily relied on EEG and LFP, the intrinsic relation between neural oscillations and neuronal ***spiking*** remains noteworthy. We investigate the possibility of detecting single cycles of neural rhythms solely through the spiking activity of neurons, using recent advancements in densely recording large populations of neurons within a local network. Many spikes from neurons in a local network provide an estimation of the network activity across time, which we can use to investigate the existence of cyclic patterns. Here, we employ recurrent neural networks to robustly isolate individual cycles of neural oscillations from the spiking of a densely recorded population of neurons. This isolation occurs in the time domain, where cycles from different time scales may combine in various ways to shape the network's spiking probability.
<!-- </p> -->

<p align="center">
  <img alt="https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/decoder_schematics.jpg" src="https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/decoder_schematics.jpg" align="center" style="pointer-events: auto;" width="600px"/>
</a>

<p align="center">
  <img alt="https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/gammaCycleAvgShape.png" src="https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/gammaCycleAvgShape.png" align="center" style="pointer-events: auto;" width="600px"/>
</a>



## Extract the Cycle Times in Your Spiking Data on Google Colab
<p align="center">
<a class="new-tab-link" href="https://colab.research.google.com/github/esiabri/isoCycle/blob/main/isoCycle_yourData_Colab.ipynb" target="_blank" style="pointer-events: none;">
  <img alt="https://colab.research.google.com/assets/colab-badge.svg" src="https://colab.research.google.com/assets/colab-badge.svg" align="center" style="pointer-events: auto;" width="250px"/>
</a>

On the Google Colab linked above, you can use isoCycle online to extract the times of the cycle you choose (e.g., gamma, theta, etc.) in your data. All you need is to have your recorded spike times (from all the nearby units combined) saved in a .npy file. If you're using kilosort/phy for spike sorting, you can use this [matlab function](https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/isoCycleInput_build.m) to generate the .npy file for this google colab, otherwise this [python function](https://github.com/esiabri/isoCycle/blob/main/isoCycle/decoder.py#L646) could be helpful to include spikes fron the desired units into the cycle detection.</p>

The default figures in this Colab notebook show the average shape of gamma and beta cycles, as well as slower cycles, in the spiking activity of 131 neurons simultaneously recorded in the mouse primary visual cortex (V1) during a passive visual stimulation experiment. You can regenerate these figures using this [data file](https://drive.google.com/file/d/1USRsBorZa9iL2ukuZJOt5P8Eu8tZL3aJ/view?usp=sharing). For the local machine version of this notebook see [example](https://github.com/esiabri/isoCycle/tree/main/isoCycle/example).</p>

## GPU acceleration
isoCycle employs a decoder developed with TensorFlow. Leveraging a GPU highly reduces execution time, a factor particularly crucial for long recordings. However, configuring your GPU to work with TensorFlow requires additional steps post-package installation. For quick guidance, refer to [Setting up TensorFlow with GPU Support](#setting-up-tensorflow-with-gpu-support). 
    
## Installation
<p>
  
**quick**: install isoCycle with pip, consider a new environment as conflicts are likely

```buildoutcfg
pip install isoCycle
```

Steps for installation from scratch using Anaconda:

1. First, ensure that you have Anaconda installed on your computer. If you don't have Anaconda, you can download it from the official Anaconda [website](https://www.anaconda.com/downloads). Anaconda is a popular distribution of Python that comes with many pre-installed packages and a package manager called conda, making it convenient for data analysis and scientific computing tasks.

2. Once you have Anaconda installed, open a terminal or command prompt on your computer, and create a new conda environment by executing the following command:
```buildoutcfg
conda create --name myenv
```
Replace myenv with the desired name for your environment.

3. Activate the newly created environment with the following command:
```buildoutcfg
conda activate myenv
```
Again, replace myenv with the name of your environment.

4. Install isoCycle and its dependencies by running the command:
```buildoutcfg
conda install isoCycle
```
5. After the installation is complete, you can import isoCycle into your Python scripts or notebooks using the statement
```buildoutcfg
import isoCycle
```

Now, with Anaconda installed, a new environment created, and isoCycle successfully installed, you are ready to analyze your data using isoCycle. One option is to use [Jupyter Notebook](https://jupyter.org/try-jupyter/retro/notebooks/?path=notebooks/Intro.ipynb). Here is an example Notebook: [isoCycle_example.ipynb](https://github.com/esiabri/isoCycle/blob/main/isoCycle/example/isoCycle_example.ipynb)
</p>

## Setting up TensorFlow with GPU Support

To utilize the power of GPU acceleration with TensorFlow, ensure that you have the correct hardware and software setup. 

You will need a CUDA-capable GPU and you'll need to install the CUDA Toolkit and the cuDNN library. Once these are installed, you can install TensorFlow with built-in GPU support.

To check if TensorFlow is using the GPU, you can use the following Python code:

```python
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
```
  
You can also log device placements with:
  
```python
tf.debugging.set_log_device_placement(True)
```
  
For more detailed information, please refer to the following guides:

1. [Using a GPU with TensorFlow.](https://www.tensorflow.org/guide/gpu)
2. CUDA Toolkit and cuDNN installation guides on the [NVIDIA website](https://developer.nvidia.com/cuda-toolkit).
Please follow the respective instructions carefully when installing these components.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/esiabri/isoCycle",
    "name": "isoCycle",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Neuroscience,Oscillation,Cycle",
    "author": "Ehsan Sabri",
    "author_email": "ehsan.sabri@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/8a/4e1f490da46f76307150ef92b99ad74423370132098690a863535fc1f090/isoCycle-0.1.14.tar.gz",
    "platform": null,
    "description": "# isoCycle\r\n<!-- [![preprint](https://img.shields.io/badge/preprint-bioRxiv-blue)]() -->\r\n[![pip](https://img.shields.io/badge/poster-CCN23-blue)](https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/Poster_CCNeuro.pdf)\r\n[![pip](https://img.shields.io/badge/pip%20install-PyPI-orange)](https://pypi.org/project/isoCycle/)\r\n### A Deep Network-Based Decoder for Isolating Single Cycles of Neural Oscillations in Spiking Activity\r\n\r\n<!-- <p align=\"justify\"> -->\r\nNeural oscillations are prominent features of brain activity, observable through frequency-specific power changes in electroencephalograms (EEG) and local field potentials (LFP), as well as coherence across brain regions, modulated by modes of activity. While identifying oscillations has primarily relied on EEG and LFP, the intrinsic relation between neural oscillations and neuronal ***spiking*** remains noteworthy. We investigate the possibility of detecting single cycles of neural rhythms solely through the spiking activity of neurons, using recent advancements in densely recording large populations of neurons within a local network. Many spikes from neurons in a local network provide an estimation of the network activity across time, which we can use to investigate the existence of cyclic patterns. Here, we employ recurrent neural networks to robustly isolate individual cycles of neural oscillations from the spiking of a densely recorded population of neurons. This isolation occurs in the time domain, where cycles from different time scales may combine in various ways to shape the network's spiking probability.\r\n<!-- </p> -->\r\n\r\n<p align=\"center\">\r\n  <img alt=\"https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/decoder_schematics.jpg\" src=\"https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/decoder_schematics.jpg\" align=\"center\" style=\"pointer-events: auto;\" width=\"600px\"/>\r\n</a>\r\n\r\n<p align=\"center\">\r\n  <img alt=\"https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/gammaCycleAvgShape.png\" src=\"https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/gammaCycleAvgShape.png\" align=\"center\" style=\"pointer-events: auto;\" width=\"600px\"/>\r\n</a>\r\n\r\n\r\n\r\n## Extract the Cycle Times in Your Spiking Data on Google Colab\r\n<p align=\"center\">\r\n<a class=\"new-tab-link\" href=\"https://colab.research.google.com/github/esiabri/isoCycle/blob/main/isoCycle_yourData_Colab.ipynb\" target=\"_blank\" style=\"pointer-events: none;\">\r\n  <img alt=\"https://colab.research.google.com/assets/colab-badge.svg\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" align=\"center\" style=\"pointer-events: auto;\" width=\"250px\"/>\r\n</a>\r\n\r\nOn the Google Colab linked above, you can use isoCycle online to extract the times of the cycle you choose (e.g., gamma, theta, etc.) in your data. All you need is to have your recorded spike times (from all the nearby units combined) saved in a .npy file. If you're using kilosort/phy for spike sorting, you can use this [matlab function](https://github.com/esiabri/isoCycle/blob/main/isoCycle/files/isoCycleInput_build.m) to generate the .npy file for this google colab, otherwise this [python function](https://github.com/esiabri/isoCycle/blob/main/isoCycle/decoder.py#L646) could be helpful to include spikes fron the desired units into the cycle detection.</p>\r\n\r\nThe default figures in this Colab notebook show the average shape of gamma and beta cycles, as well as slower cycles, in the spiking activity of 131 neurons simultaneously recorded in the mouse primary visual cortex (V1) during a passive visual stimulation experiment. You can regenerate these figures using this [data file](https://drive.google.com/file/d/1USRsBorZa9iL2ukuZJOt5P8Eu8tZL3aJ/view?usp=sharing). For the local machine version of this notebook see [example](https://github.com/esiabri/isoCycle/tree/main/isoCycle/example).</p>\r\n\r\n## GPU acceleration\r\nisoCycle employs a decoder developed with TensorFlow. Leveraging a GPU highly reduces execution time, a factor particularly crucial for long recordings. However, configuring your GPU to work with TensorFlow requires additional steps post-package installation. For quick guidance, refer to [Setting up TensorFlow with GPU Support](#setting-up-tensorflow-with-gpu-support). \r\n    \r\n## Installation\r\n<p>\r\n  \r\n**quick**: install isoCycle with pip, consider a new environment as conflicts are likely\r\n\r\n```buildoutcfg\r\npip install isoCycle\r\n```\r\n\r\nSteps for installation from scratch using Anaconda:\r\n\r\n1. First, ensure that you have Anaconda installed on your computer. If you don't have Anaconda, you can download it from the official Anaconda [website](https://www.anaconda.com/downloads). Anaconda is a popular distribution of Python that comes with many pre-installed packages and a package manager called conda, making it convenient for data analysis and scientific computing tasks.\r\n\r\n2. Once you have Anaconda installed, open a terminal or command prompt on your computer, and create a new conda environment by executing the following command:\r\n```buildoutcfg\r\nconda create --name myenv\r\n```\r\nReplace myenv with the desired name for your environment.\r\n\r\n3. Activate the newly created environment with the following command:\r\n```buildoutcfg\r\nconda activate myenv\r\n```\r\nAgain, replace myenv with the name of your environment.\r\n\r\n4. Install isoCycle and its dependencies by running the command:\r\n```buildoutcfg\r\nconda install isoCycle\r\n```\r\n5. After the installation is complete, you can import isoCycle into your Python scripts or notebooks using the statement\r\n```buildoutcfg\r\nimport isoCycle\r\n```\r\n\r\nNow, with Anaconda installed, a new environment created, and isoCycle successfully installed, you are ready to analyze your data using isoCycle. One option is to use [Jupyter Notebook](https://jupyter.org/try-jupyter/retro/notebooks/?path=notebooks/Intro.ipynb). Here is an example Notebook: [isoCycle_example.ipynb](https://github.com/esiabri/isoCycle/blob/main/isoCycle/example/isoCycle_example.ipynb)\r\n</p>\r\n\r\n## Setting up TensorFlow with GPU Support\r\n\r\nTo utilize the power of GPU acceleration with TensorFlow, ensure that you have the correct hardware and software setup. \r\n\r\nYou will need a CUDA-capable GPU and you'll need to install the CUDA Toolkit and the cuDNN library. Once these are installed, you can install TensorFlow with built-in GPU support.\r\n\r\nTo check if TensorFlow is using the GPU, you can use the following Python code:\r\n\r\n```python\r\nimport tensorflow as tf\r\nprint(\"Num GPUs Available: \", len(tf.config.list_physical_devices('GPU')))\r\n```\r\n  \r\nYou can also log device placements with:\r\n  \r\n```python\r\ntf.debugging.set_log_device_placement(True)\r\n```\r\n  \r\nFor more detailed information, please refer to the following guides:\r\n\r\n1. [Using a GPU with TensorFlow.](https://www.tensorflow.org/guide/gpu)\r\n2. CUDA Toolkit and cuDNN installation guides on the [NVIDIA website](https://developer.nvidia.com/cuda-toolkit).\r\nPlease follow the respective instructions carefully when installing these components.\r\n",
    "bugtrack_url": null,
    "license": "CC-BY-NC-SA-4.0",
    "summary": "isolating single cycles of oscillatory activity in neuronal spiking",
    "version": "0.1.14",
    "project_urls": {
        "Download": "https://github.com/esiabri/isoCycle/archive/refs/tags/0.1.1.tar.gz",
        "Homepage": "https://github.com/esiabri/isoCycle"
    },
    "split_keywords": [
        "neuroscience",
        "oscillation",
        "cycle"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c8a4e1f490da46f76307150ef92b99ad74423370132098690a863535fc1f090",
                "md5": "0272b5bbbf16d8516451669f67119f00",
                "sha256": "70c647c9b8fc50b0548682c1d9b955735b27d7f840f612ca75bf6981fee1c82b"
            },
            "downloads": -1,
            "filename": "isoCycle-0.1.14.tar.gz",
            "has_sig": false,
            "md5_digest": "0272b5bbbf16d8516451669f67119f00",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13344270,
            "upload_time": "2023-08-09T16:47:07",
            "upload_time_iso_8601": "2023-08-09T16:47:07.419333Z",
            "url": "https://files.pythonhosted.org/packages/5c/8a/4e1f490da46f76307150ef92b99ad74423370132098690a863535fc1f090/isoCycle-0.1.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-09 16:47:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "esiabri",
    "github_project": "isoCycle",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "isocycle"
}
        
Elapsed time: 0.10431s