Metadata-Version: 2.1
Name: ieeg
Version: 0.1
Summary: A Python package for iEEG data processing.
Home-page: https://github.com/coganlab/IEEG_Pipelines
Author: Aaron Earle-Richardson
Author-email: Aaron Earle-Richardson <ae166@duke.edu>
License: MIT License
        
        Copyright (c) 2023 coganlab
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/coganlab/IEEG_Pipelines
Project-URL: Source, https://github.com/coganlab/IEEG_Pipelines
Project-URL: Issues, https://github.com/coganlab/IEEG_Pipelines/Issues
Project-URL: Documentation, https://ieeg-pipelines.readthedocs.io/en/latest/
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bids>=0.0
Requires-Dist: EDFlib-Python
Requires-Dist: mne
Requires-Dist: mne-bids
Requires-Dist: numpy
Requires-Dist: matplotlib
Requires-Dist: scipy
Requires-Dist: scikit-learn
Requires-Dist: pandas
Requires-Dist: joblib>=1.3
Requires-Dist: psutil
Requires-Dist: pyvistaqt
Requires-Dist: pytz
Requires-Dist: pyqt5
Requires-Dist: tqdm
Requires-Dist: h5io
Requires-Dist: dipy
Requires-Dist: mne-qt-browser
Requires-Dist: edfio

# IEEG_Pipelines

A repo of current preprocessing pipelines for the [Cogan Lab](https://www.coganlab.org/)

[![Brain](./docs/images/brain_rot.gif)](https://www.coganlab.org/)

## Documentation

[![Documentation Status](https://readthedocs.org/projects/ieeg-pipelines/badge/?version=latest)](https://ieeg-pipelines.readthedocs.io/en/latest/?badge=latest)

[Lab Wiki](https://coganlab.pages.oit.duke.edu/wiki//)

## Pipeline Functionality

[![Python (3.10) on Windows/Linux](https://github.com/coganlab/IEEG_Pipelines/actions/workflows/Python-CI.yml/badge.svg)](https://github.com/coganlab/IEEG_Pipelines/actions/workflows/Python-CI.yml)

[![MATLAB latest](https://github.com/coganlab/IEEG_Pipelines/actions/workflows/MATLAB-CI.yml/badge.svg)](https://github.com/coganlab/IEEG_Pipelines/actions/workflows/MATLAB-CI.yml)

[![codecov](https://codecov.io/gh/coganlab/IEEG_Pipelines/branch/main/graph/badge.svg?token=X4IAFGOBGN)](https://codecov.io/gh/coganlab/IEEG_Pipelines)

## Installation

### MATLAB

1. Install MATLAB
2. Clone this repository into your userpath (`Documents/MATLAB` by default)
3. Run commands:

    ```MATLAB
    path = fullfile(userpath, 'IEEG_Pipelines', 'MATLAB');
    addpath(genpath(path));
    ```

### Python

Version 3.10 supported

#### Conda

1. Install Anaconda
2. Clone this repository
3. Open a terminal and `cd` into this repo's `Python` directory
4. Run this command:

    ```bash
    conda env create -f envs/environment.yml
    ```

5. When it is finished installing run `conda activate preprocess` to activate the environment

#### Pip

1. Install Python
2. Clone this repository
3. Open a terminal and `cd` into this repo's `Python` directory
4. Run:

    ```bash
    python -m venv <PATH TO VENV>/preprocess
    python -m pip install -r envs/requirements.txt -e <PATH TO VENV>/preprocess
    ```

5. When it is finished installing run `source activate <PATH TO VENV>/preprocess` to activate the environment

## Usage

### MATLAB (INCOMPLETE)

1. Load `.dat` file using [convert_OpenE_rec2mat.m](MATLAB/ieeg%20file%20reading/convert_OpenE_rec2mat.m)
2. Create the ieeg data structure from the [ieegStructClass.m](MATLAB/ieegClassDefinition/ieegStructClass.m)
3. `TBD`

### Python ([INCOMPLETE](https://github.com/orgs/coganlab/projects/7))

1. Load BIDS files from BIDS directory using `pybids`
    
    ```python
    from bids import BIDSLayout
    import ieeg
    layout = BIDSLayout(BIDS_root)
    data = ieeg.io.raw_from_layout(layout)
    ```
2. [Perform line noise filtering](https://ieeg-pipelines.readthedocs.io/en/latest/auto_examples/plot_clean.html)

3. [Check Spectrograms](https://ieeg-pipelines.readthedocs.io/en/latest/auto_examples/plot_spectrograms.html)

4. [Plot the high gamma responses](https://ieeg-pipelines.readthedocs.io/en/latest/auto_examples/plot_HG.html)

5. [Run the cluster correction and permutation test](https://ieeg-pipelines.readthedocs.io/en/latest/auto_examples/plot_stats.html)
