eeg-analysis


Nameeeg-analysis JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/KarthikDani/PHCCOProject/tree/main/gsmm
SummaryA library for processing and plotting EEG data
upload_time2024-09-07 14:58:12
maintainerNone
docs_urlNone
authorKarthik Dani
requires_python>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # EEG Analysis

This Library provides functions to process and plot EEG data, specifically focusing on the effects of different states (Before, During, After) on various EEG frequency bands.

## Installation

To install the library, use pip:

```bash
pip install eeg_analysis
```

## Usage

### Loading the Data

First, load the data from a CSV file. The CSV file should be structured with columns for subject, location, band, and power measurements for three states (Before, During, After).

```python
import pandas as pd
from eeg_analysis import load_data

# Load the data
data = load_data('path/to/your/data.csv')
```

### Cleaning the Data

Once the data is loaded, it needs to be cleaned and structured into a more usable format. The `clean_data` function organizes the data into a DataFrame with appropriate columns.

```python
from eeg_analysis import clean_data

# Clean and structure the data
df = clean_data(data)

# Optionally, save the cleaned data to a new CSV file
df.to_csv('cleaned_data.csv', index=False)
print(df.head())
```

### Performing Paired T-Tests

The library includes a function to perform paired t-tests between the different states for a specified frequency band. This can help determine if there are statistically significant differences in power between the states.

```python
from eeg_analysis import perform_ttests

# Perform t-tests for a specific band (e.g., 'Delta')
ttest_results_df = perform_ttests(df, 'Delta')

# Display the results
print(ttest_results_df)
```

### Plotting Median Power Across Bands

The library provides a function to plot the median power across different states for each frequency band. This can help visualize the changes in power for different subjects and states.

```python
from my_pypi_library import plot_median_across_bands

# Plot the median power across bands
plot_median_across_bands(df)
```

### Example Workflow

Here's a complete example that demonstrates the typical workflow using the library:

```python
import pandas as pd
from eeg_analysis import load_data, clean_data, perform_ttests, plot_median_across_bands

# Step 1: Load the data
data = load_data('path/to/your/data.csv')

# Step 2: Clean and structure the data
df = clean_data(data)

# Step 3: Perform t-tests for a specific band (e.g., 'Delta')
ttest_results_df = perform_ttests(df, 'Delta')
print(ttest_results_df)

# Step 4: Plot the median power across bands
plot_median_across_bands(df)
```

## API Reference

### `load_data(filepath: str) -> pd.DataFrame`

Load the data from a CSV file.

- **Parameters:**
  - `filepath` (str): The path to the CSV file containing the data.

- **Returns:**
  - `pd.DataFrame`: A DataFrame containing the loaded data.

### `clean_data(data: pd.DataFrame) -> pd.DataFrame`

Clean and structure the data into a usable format.

- **Parameters:**
  - `data` (pd.DataFrame): The raw data DataFrame.

- **Returns:**
  - `pd.DataFrame`: A cleaned and structured DataFrame.

### `perform_ttests(data: pd.DataFrame, band: str) -> pd.DataFrame`

Perform paired t-tests for a given frequency band.

- **Parameters:**
  - `data` (pd.DataFrame): The cleaned data DataFrame.
  - `band` (str): The frequency band to analyze (e.g., 'Delta').

- **Returns:**
  - `pd.DataFrame`: A DataFrame containing the t-test results for each subject and comparison.

### `plot_median_across_bands(data: pd.DataFrame)`

Plot the median power across different states for each frequency band.

- **Parameters:**
  - `data` (pd.DataFrame): The cleaned data DataFrame.

## Contributing

Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request on [GitHub](https://github.com/KarthikDani/BCI-Internship/tree/main/eeg_analysis).

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE.txt) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/KarthikDani/PHCCOProject/tree/main/gsmm",
    "name": "eeg-analysis",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Karthik Dani",
    "author_email": "karthikdani14@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1b/9b/39f1ca68c9ccb2671d44b95def1d907764d351950510fdbbdae2a1ddb62c/eeg_analysis-0.1.3.tar.gz",
    "platform": null,
    "description": "# EEG Analysis\n\nThis Library provides functions to process and plot EEG data, specifically focusing on the effects of different states (Before, During, After) on various EEG frequency bands.\n\n## Installation\n\nTo install the library, use pip:\n\n```bash\npip install eeg_analysis\n```\n\n## Usage\n\n### Loading the Data\n\nFirst, load the data from a CSV file. The CSV file should be structured with columns for subject, location, band, and power measurements for three states (Before, During, After).\n\n```python\nimport pandas as pd\nfrom eeg_analysis import load_data\n\n# Load the data\ndata = load_data('path/to/your/data.csv')\n```\n\n### Cleaning the Data\n\nOnce the data is loaded, it needs to be cleaned and structured into a more usable format. The `clean_data` function organizes the data into a DataFrame with appropriate columns.\n\n```python\nfrom eeg_analysis import clean_data\n\n# Clean and structure the data\ndf = clean_data(data)\n\n# Optionally, save the cleaned data to a new CSV file\ndf.to_csv('cleaned_data.csv', index=False)\nprint(df.head())\n```\n\n### Performing Paired T-Tests\n\nThe library includes a function to perform paired t-tests between the different states for a specified frequency band. This can help determine if there are statistically significant differences in power between the states.\n\n```python\nfrom eeg_analysis import perform_ttests\n\n# Perform t-tests for a specific band (e.g., 'Delta')\nttest_results_df = perform_ttests(df, 'Delta')\n\n# Display the results\nprint(ttest_results_df)\n```\n\n### Plotting Median Power Across Bands\n\nThe library provides a function to plot the median power across different states for each frequency band. This can help visualize the changes in power for different subjects and states.\n\n```python\nfrom my_pypi_library import plot_median_across_bands\n\n# Plot the median power across bands\nplot_median_across_bands(df)\n```\n\n### Example Workflow\n\nHere's a complete example that demonstrates the typical workflow using the library:\n\n```python\nimport pandas as pd\nfrom eeg_analysis import load_data, clean_data, perform_ttests, plot_median_across_bands\n\n# Step 1: Load the data\ndata = load_data('path/to/your/data.csv')\n\n# Step 2: Clean and structure the data\ndf = clean_data(data)\n\n# Step 3: Perform t-tests for a specific band (e.g., 'Delta')\nttest_results_df = perform_ttests(df, 'Delta')\nprint(ttest_results_df)\n\n# Step 4: Plot the median power across bands\nplot_median_across_bands(df)\n```\n\n## API Reference\n\n### `load_data(filepath: str) -> pd.DataFrame`\n\nLoad the data from a CSV file.\n\n- **Parameters:**\n  - `filepath` (str): The path to the CSV file containing the data.\n\n- **Returns:**\n  - `pd.DataFrame`: A DataFrame containing the loaded data.\n\n### `clean_data(data: pd.DataFrame) -> pd.DataFrame`\n\nClean and structure the data into a usable format.\n\n- **Parameters:**\n  - `data` (pd.DataFrame): The raw data DataFrame.\n\n- **Returns:**\n  - `pd.DataFrame`: A cleaned and structured DataFrame.\n\n### `perform_ttests(data: pd.DataFrame, band: str) -> pd.DataFrame`\n\nPerform paired t-tests for a given frequency band.\n\n- **Parameters:**\n  - `data` (pd.DataFrame): The cleaned data DataFrame.\n  - `band` (str): The frequency band to analyze (e.g., 'Delta').\n\n- **Returns:**\n  - `pd.DataFrame`: A DataFrame containing the t-test results for each subject and comparison.\n\n### `plot_median_across_bands(data: pd.DataFrame)`\n\nPlot the median power across different states for each frequency band.\n\n- **Parameters:**\n  - `data` (pd.DataFrame): The cleaned data DataFrame.\n\n## Contributing\n\nContributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request on [GitHub](https://github.com/KarthikDani/BCI-Internship/tree/main/eeg_analysis).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE.txt) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library for processing and plotting EEG data",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/KarthikDani/PHCCOProject/tree/main/gsmm"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7d826b2ec6815cd6ffea6313aa8687716de83d41fd54fa5833d22719afac6aa2",
                "md5": "3d92914da65f9e94f31e31e73460f778",
                "sha256": "406a8df18c786a149d786be6e155f154e2f2a3c66b2c5b78ca97418abb151f2c"
            },
            "downloads": -1,
            "filename": "eeg_analysis-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d92914da65f9e94f31e31e73460f778",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 157759,
            "upload_time": "2024-09-07T14:58:08",
            "upload_time_iso_8601": "2024-09-07T14:58:08.703597Z",
            "url": "https://files.pythonhosted.org/packages/7d/82/6b2ec6815cd6ffea6313aa8687716de83d41fd54fa5833d22719afac6aa2/eeg_analysis-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b9b39f1ca68c9ccb2671d44b95def1d907764d351950510fdbbdae2a1ddb62c",
                "md5": "0cdd4066c3190e9001b0b28c75236512",
                "sha256": "244cd3e766ea01c588b4630108925449079309338e73124fb52bddbb5e63abeb"
            },
            "downloads": -1,
            "filename": "eeg_analysis-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "0cdd4066c3190e9001b0b28c75236512",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 157181,
            "upload_time": "2024-09-07T14:58:12",
            "upload_time_iso_8601": "2024-09-07T14:58:12.104399Z",
            "url": "https://files.pythonhosted.org/packages/1b/9b/39f1ca68c9ccb2671d44b95def1d907764d351950510fdbbdae2a1ddb62c/eeg_analysis-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-07 14:58:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KarthikDani",
    "github_project": "PHCCOProject",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "eeg-analysis"
}
        
Elapsed time: 0.55731s