ieegprep


Nameieegprep JSON
Version 1.6.0 PyPI version JSON
download
home_page
SummaryA package to read and pre-process Intracranial Electroencephalography (iEEG) data that is structured according to the Brain Imaging Data Structure (BIDS)
upload_time2023-09-25 13:18:53
maintainer
docs_urlNone
author
requires_python>=3.8
licenseGPLv3
keywords intracranial electroencephalography ieeg bids
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # IeegPrep
IeegPrep is a python library to read, pre-process and epoch Intracranial Electroencephalography (iEEG) data that is structured according to the Brain Imaging Data Structure (BIDS) 


## Install

```
pip install ieegprep
```

## Usage

After installing, the library can be used directly to:

Read EDF, BrainVision or MEF3 data
```
from ieegprep import IeegDataReader

# initialize a reader for a specific dataset
reader = IeegDataReader('/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr', preload_data=False)

# print metadata
print(reader.sampling_rate)
print(reader.channel_names)

# retrieve all the data from single channel
channel_data      = reader.retrieve_channel_data('CH05')

# retrieve a range of sample-data from all, a single or multiple channels
range_data_all    = reader.retrieve_sample_range_data(sample_start=1000, sample_end=2000)
range_data_single = reader.retrieve_sample_range_data(sample_start=1000, sample_end=2000, channels='CH01')
range_data_multi  = reader.retrieve_sample_range_data(sample_start=1000, sample_end=2000, channels=('CH01', 'CH05'))

# optionally, close the reader and release the memory
reader.close()
```

Read BIDS sidecar metadata files
```
from ieegprep import load_event_info, load_channel_info

channels = load_channel_info('/bids_data_root/subj-01/ieeg/sub-01_run-06_channels.tsv')
events   = load_event_info('/bids_data_root/subj-01/ieeg/sub-01_run-06_events.tsv')
```

Load, pre-process and epoched data as a matrix
```
from ieegprep import load_data_epochs

# retrieve epoched data
[srate, epochs] = load_data_epochs( '/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',
                                    retrieve_channels = channels['name'],
                                    onsets            = events['onset'])
data_ch0_trial13 = epochs[1, 13, :]

# retrieve epoched data specifying the epoch window and baseline normalization
[srate, epochs] = load_data_epochs( '/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',
                                    retrieve_channels = channels['name'],
                                    onsets            = events['onset'],
                                    trial_epoch       = (-1, 2),                         #  -1s < onset < 2s  
                                    baseline_norm     = 'Median',
                                    baseline_epoch    = (-1, -0.1))
                            
# retrieve epoched data with pre-processing (high-pass filtering, CAR re-referencing and 50Hz line-noise removal)
from ieegprep import RerefStruct
[srate, epochs] = load_data_epochs( '/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',
                                    retrieve_channels  = channels['name'],
                                    onsets             = events['onset'],
                                    high_pass          = True,
                                    early_reref        = RerefStruct.generate_car(channels['name'].tolist()),
                                    line_noise_removal = 50)
```

Load, epoch and get the average of each stimulated electrode pair (minimizing memory usage)
```
from ieegprep import load_data_epochs_averages, load_elec_stim_events

# load the events file and retrieve the different stimulated electrode-pairs (e.g. Ch01-Ch02...) as conditions
_, _, conditions_onsets, _ = load_elec_stim_events('/bids_data_root/subj-01/ieeg/sub-01_run-06_events.tsv')

# retrieve epoch data averaged over conditions
[srate, epochs, _] =  load_data_epochs_averages('/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',
                                                retrieve_channels = channels['name'],
                                                conditions_onsets = conditions_onsets)
data_respCh01_stimCh02_03 = epochs[1, 4, :]
```

## Acknowledgements

- Written by Max van den Boom (Multimodal Neuroimaging Lab, Mayo Clinic, Rochester MN)
- Dependencies:
  - PyMef by Jan Cimbalnik, Matt Stead, Ben Brinkmann, and Dan Crepeau (https://github.com/msel-source/pymef)
  - NumPy
  - SciPy
  - psutil
- The new EDF and BrainVision readers are in part adaptations of the Fieldtrip code (by Robert Robert Oostenveld) and replicate some of the header logic from the MNE package (by Teon Brooks, Stefan Appelhoff and others)  
  
- This project was funded by the National Institute Of Mental Health of the National Institutes of Health Award Number R01MH122258 to Dora Hermes


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ieegprep",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "intracranial,electroencephalography,ieeg,BIDS",
    "author": "",
    "author_email": "Max van den Boom <m.a.vandenboom84@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7a/84/4f6444c957b4b65274fd34ecd3f2aa7d98303b54600aa93cd3f1ff0fee30/ieegprep-1.6.0.tar.gz",
    "platform": null,
    "description": "# IeegPrep\r\nIeegPrep is a python library to read, pre-process and epoch Intracranial Electroencephalography (iEEG) data that is structured according to the Brain Imaging Data Structure (BIDS) \r\n\r\n\r\n## Install\r\n\r\n```\r\npip install ieegprep\r\n```\r\n\r\n## Usage\r\n\r\nAfter installing, the library can be used directly to:\r\n\r\nRead EDF, BrainVision or MEF3 data\r\n```\r\nfrom ieegprep import IeegDataReader\r\n\r\n# initialize a reader for a specific dataset\r\nreader = IeegDataReader('/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr', preload_data=False)\r\n\r\n# print metadata\r\nprint(reader.sampling_rate)\r\nprint(reader.channel_names)\r\n\r\n# retrieve all the data from single channel\r\nchannel_data      = reader.retrieve_channel_data('CH05')\r\n\r\n# retrieve a range of sample-data from all, a single or multiple channels\r\nrange_data_all    = reader.retrieve_sample_range_data(sample_start=1000, sample_end=2000)\r\nrange_data_single = reader.retrieve_sample_range_data(sample_start=1000, sample_end=2000, channels='CH01')\r\nrange_data_multi  = reader.retrieve_sample_range_data(sample_start=1000, sample_end=2000, channels=('CH01', 'CH05'))\r\n\r\n# optionally, close the reader and release the memory\r\nreader.close()\r\n```\r\n\r\nRead BIDS sidecar metadata files\r\n```\r\nfrom ieegprep import load_event_info, load_channel_info\r\n\r\nchannels = load_channel_info('/bids_data_root/subj-01/ieeg/sub-01_run-06_channels.tsv')\r\nevents   = load_event_info('/bids_data_root/subj-01/ieeg/sub-01_run-06_events.tsv')\r\n```\r\n\r\nLoad, pre-process and epoched data as a matrix\r\n```\r\nfrom ieegprep import load_data_epochs\r\n\r\n# retrieve epoched data\r\n[srate, epochs] = load_data_epochs( '/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',\r\n                                    retrieve_channels = channels['name'],\r\n                                    onsets            = events['onset'])\r\ndata_ch0_trial13 = epochs[1, 13, :]\r\n\r\n# retrieve epoched data specifying the epoch window and baseline normalization\r\n[srate, epochs] = load_data_epochs( '/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',\r\n                                    retrieve_channels = channels['name'],\r\n                                    onsets            = events['onset'],\r\n                                    trial_epoch       = (-1, 2),                         #  -1s < onset < 2s  \r\n                                    baseline_norm     = 'Median',\r\n                                    baseline_epoch    = (-1, -0.1))\r\n                            \r\n# retrieve epoched data with pre-processing (high-pass filtering, CAR re-referencing and 50Hz line-noise removal)\r\nfrom ieegprep import RerefStruct\r\n[srate, epochs] = load_data_epochs( '/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',\r\n                                    retrieve_channels  = channels['name'],\r\n                                    onsets             = events['onset'],\r\n                                    high_pass          = True,\r\n                                    early_reref        = RerefStruct.generate_car(channels['name'].tolist()),\r\n                                    line_noise_removal = 50)\r\n```\r\n\r\nLoad, epoch and get the average of each stimulated electrode pair (minimizing memory usage)\r\n```\r\nfrom ieegprep import load_data_epochs_averages, load_elec_stim_events\r\n\r\n# load the events file and retrieve the different stimulated electrode-pairs (e.g. Ch01-Ch02...) as conditions\r\n_, _, conditions_onsets, _ = load_elec_stim_events('/bids_data_root/subj-01/ieeg/sub-01_run-06_events.tsv')\r\n\r\n# retrieve epoch data averaged over conditions\r\n[srate, epochs, _] =  load_data_epochs_averages('/bids_data_root/subj-01/ieeg/sub-01_run-06_ieeg.vhdr',\r\n                                                retrieve_channels = channels['name'],\r\n                                                conditions_onsets = conditions_onsets)\r\ndata_respCh01_stimCh02_03 = epochs[1, 4, :]\r\n```\r\n\r\n## Acknowledgements\r\n\r\n- Written by Max van den Boom (Multimodal Neuroimaging Lab, Mayo Clinic, Rochester MN)\r\n- Dependencies:\r\n  - PyMef by Jan Cimbalnik, Matt Stead, Ben Brinkmann, and Dan Crepeau (https://github.com/msel-source/pymef)\r\n  - NumPy\r\n  - SciPy\r\n  - psutil\r\n- The new EDF and BrainVision readers are in part adaptations of the Fieldtrip code (by Robert Robert Oostenveld) and replicate some of the header logic from the MNE package (by Teon Brooks, Stefan Appelhoff and others)  \r\n  \r\n- This project was funded by the National Institute Of Mental Health of the National Institutes of Health Award Number R01MH122258 to Dora Hermes\r\n\r\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "A package to read and pre-process Intracranial Electroencephalography (iEEG) data that is structured according to the Brain Imaging Data Structure (BIDS)",
    "version": "1.6.0",
    "project_urls": {
        "documentation": "https://github.com/MultimodalNeuroimagingLab/ieegprep",
        "homepage": "https://github.com/MultimodalNeuroimagingLab/ieegprep",
        "repository": "https://github.com/MultimodalNeuroimagingLab/ieegprep"
    },
    "split_keywords": [
        "intracranial",
        "electroencephalography",
        "ieeg",
        "bids"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed52dce4e437ce86cd60dcd3b2e0d26ef007a32f28a5870cd16ee9a4bf53f3d8",
                "md5": "5a6d574287dc8beab6199ab7642a2d0a",
                "sha256": "f2a62169084096cdce3b00cafe2c2f27315820490615cf59029f346e9286ce2c"
            },
            "downloads": -1,
            "filename": "ieegprep-1.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a6d574287dc8beab6199ab7642a2d0a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 81763,
            "upload_time": "2023-09-25T13:18:52",
            "upload_time_iso_8601": "2023-09-25T13:18:52.045038Z",
            "url": "https://files.pythonhosted.org/packages/ed/52/dce4e437ce86cd60dcd3b2e0d26ef007a32f28a5870cd16ee9a4bf53f3d8/ieegprep-1.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a844f6444c957b4b65274fd34ecd3f2aa7d98303b54600aa93cd3f1ff0fee30",
                "md5": "bea2cf97164d571755ad196ab3da5da4",
                "sha256": "4a7576e3ee1a61ef4d66265d1b51fd30dd6cf8b0291728a9917fdb1134be6c20"
            },
            "downloads": -1,
            "filename": "ieegprep-1.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bea2cf97164d571755ad196ab3da5da4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 89493,
            "upload_time": "2023-09-25T13:18:53",
            "upload_time_iso_8601": "2023-09-25T13:18:53.899293Z",
            "url": "https://files.pythonhosted.org/packages/7a/84/4f6444c957b4b65274fd34ecd3f2aa7d98303b54600aa93cd3f1ff0fee30/ieegprep-1.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-25 13:18:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MultimodalNeuroimagingLab",
    "github_project": "ieegprep",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ieegprep"
}
        
Elapsed time: 0.12785s