ezdsp


Nameezdsp JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/ywatanabe1989/ezdsp
SummaryEasy digital signal processing
upload_time2024-04-08 15:30:32
maintainerNone
docs_urlNone
authorywatanabe1989
requires_python>=3.6
licenseMIT
keywords numpytorch pandas lfp eeg meg
VCS
bugtrack_url
requirements julius matplotlib mne numpy numpy_fn pandas ripple_detection scipy tensorpac torch torch_fn torchaudio torchsummary mngs
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![CI](https://github.com/ywatanabe1989/ezdsp/actions/workflows/pip_install.yml/badge.svg)
![CI](https://github.com/ywatanabe1989/ezdsp/actions/workflows/run_example.yml/badge.svg)

# ezDSP: Easy Digital Signal Processing

ezDSP is a digital signal processing toolbox written in PyTorch (`./src/ezdsp/nn/`). However, ezDSP not only processes torch.tensors (CPU & GPU) but also handles numpy.ndarray and pd.DataFrame, enabling a consistent and intensive workflow.

## Installation
```bash
$ pip install ezdsp
$ python ./example.py # ./example_outputs/ will be generated.
```

## Samples
#### Normalization, Resampling, Noise Addition, Filtering, Hilbert Transformation
<div align="center">
  <img src="./example_outputs/3_chirp/1_signals.png" height="400">
</div>

#### Wavelet Transformation
<div align="center">
  <img src="./example_outputs/4_ripple/2_wavelet_orig.png" height="400">
</div>

#### Power Spectrum Density
<div align="center">
  <img src="./example_outputs/3_chirp/3_orig.png" height="400">
  <img src="./example_outputs/3_chirp/3_psd_bandstop_filted%20(20%20-%2050%20Hz).png" height="400">
</div>

#### Phase-Amplitude Coupling
<div align="center">
  <img src="./example_outputs/modulation_index_calculation_with_ezDSP_and_Tensorpac.png" height="400">
</div>

## Quick Start
``` python
import ezdsp as ed

# Parameters
SRC_FS = 1024  # Source sampling frequency
TGT_FS = 512   # Target sampling frequency
FREQS_HZ = [10, 30, 100]  # Frequencies in Hz
LOW_HZ = 20    # Low frequency for bandpass filter
HIGH_HZ = 50   # High frequency for bandpass filter
SIGMA = 10     # Sigma for Gaussian filter
SIG_TYPES = [
    "uniform",
    "gauss",
    "periodic",
    "chirp",
    "ripple",
    "meg",
    "tensorpac",
] # Available signal types


# Demo Signal
xx, tt, fs = ed.demo_sig(
    t_sec=T_SEC, fs=SRC_FS, freqs_hz=FREQS_HZ, sig_type="chirp"
)
# xx is either of torch.tensor (on cpu / cuda), numpy.ndarray, or pd.DataFrame.

# Normalization
xx_norm = ed.norm.z(xx)
xx_minmax = ed.norm.minmax(xx)

# Resampling
xx_resampled = ed.resample(xx, fs, TGT_FS)

# Noise addition
xx_gauss = ed.add_noise.gauss(xx)
xx_white = ed.add_noise.white(xx)
xx_pink = ed.add_noise.pink(xx)
xx_brown = ed.add_noise.brown(xx)

# Filtering
xx_filted_bandpass = ed.filt.bandpass(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)
xx_filted_bandstop = ed.filt.bandstop(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)
xx_filted_gauss = ed.filt.gauss(xx, sigma=SIGMA)

# Hilbert Transformation
phase, amplitude = ed.hilbert(xx) # or envelope

# Wavelet Transformation
wavelet_coef, wavelet_freqs = ed.wavelet(xx, fs)

# Power Spetrum Density
psd, psd_freqs = ed.psd(xx, fs)

# Phase-Amplitude Coupling
pac, freqs_pha, freqs_amp = ed.pac(x_3d, fs) # This function is computationally demanding. Please monitor the RAM/VRAM usage.
```

# Alias
[`mngs.dsp`](https://github.com/ywatanabe1989/mngs/src/mngs/dsp/) has the same functionalities.

# Contact
Yusuke Watanabe (ywata1989@gmail.com).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ywatanabe1989/ezdsp",
    "name": "ezdsp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "numpytorch, pandas, LFP, EEG, MEG",
    "author": "ywatanabe1989",
    "author_email": "ywata1989@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e8/7f/823afc937fdce6f233b7d58e3f9649f9617fa7de495d738e4657864e869b/ezdsp-1.3.0.tar.gz",
    "platform": null,
    "description": "![CI](https://github.com/ywatanabe1989/ezdsp/actions/workflows/pip_install.yml/badge.svg)\n![CI](https://github.com/ywatanabe1989/ezdsp/actions/workflows/run_example.yml/badge.svg)\n\n# ezDSP: Easy Digital Signal Processing\n\nezDSP is a digital signal processing toolbox written in PyTorch (`./src/ezdsp/nn/`). However, ezDSP not only processes torch.tensors (CPU & GPU) but also handles numpy.ndarray and pd.DataFrame, enabling a consistent and intensive workflow.\n\n## Installation\n```bash\n$ pip install ezdsp\n$ python ./example.py # ./example_outputs/ will be generated.\n```\n\n## Samples\n#### Normalization, Resampling, Noise Addition, Filtering, Hilbert Transformation\n<div align=\"center\">\n  <img src=\"./example_outputs/3_chirp/1_signals.png\" height=\"400\">\n</div>\n\n#### Wavelet Transformation\n<div align=\"center\">\n  <img src=\"./example_outputs/4_ripple/2_wavelet_orig.png\" height=\"400\">\n</div>\n\n#### Power Spectrum Density\n<div align=\"center\">\n  <img src=\"./example_outputs/3_chirp/3_orig.png\" height=\"400\">\n  <img src=\"./example_outputs/3_chirp/3_psd_bandstop_filted%20(20%20-%2050%20Hz).png\" height=\"400\">\n</div>\n\n#### Phase-Amplitude Coupling\n<div align=\"center\">\n  <img src=\"./example_outputs/modulation_index_calculation_with_ezDSP_and_Tensorpac.png\" height=\"400\">\n</div>\n\n## Quick Start\n``` python\nimport ezdsp as ed\n\n# Parameters\nSRC_FS = 1024  # Source sampling frequency\nTGT_FS = 512   # Target sampling frequency\nFREQS_HZ = [10, 30, 100]  # Frequencies in Hz\nLOW_HZ = 20    # Low frequency for bandpass filter\nHIGH_HZ = 50   # High frequency for bandpass filter\nSIGMA = 10     # Sigma for Gaussian filter\nSIG_TYPES = [\n    \"uniform\",\n    \"gauss\",\n    \"periodic\",\n    \"chirp\",\n    \"ripple\",\n    \"meg\",\n    \"tensorpac\",\n] # Available signal types\n\n\n# Demo Signal\nxx, tt, fs = ed.demo_sig(\n    t_sec=T_SEC, fs=SRC_FS, freqs_hz=FREQS_HZ, sig_type=\"chirp\"\n)\n# xx is either of torch.tensor (on cpu / cuda), numpy.ndarray, or pd.DataFrame.\n\n# Normalization\nxx_norm = ed.norm.z(xx)\nxx_minmax = ed.norm.minmax(xx)\n\n# Resampling\nxx_resampled = ed.resample(xx, fs, TGT_FS)\n\n# Noise addition\nxx_gauss = ed.add_noise.gauss(xx)\nxx_white = ed.add_noise.white(xx)\nxx_pink = ed.add_noise.pink(xx)\nxx_brown = ed.add_noise.brown(xx)\n\n# Filtering\nxx_filted_bandpass = ed.filt.bandpass(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)\nxx_filted_bandstop = ed.filt.bandstop(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)\nxx_filted_gauss = ed.filt.gauss(xx, sigma=SIGMA)\n\n# Hilbert Transformation\nphase, amplitude = ed.hilbert(xx) # or envelope\n\n# Wavelet Transformation\nwavelet_coef, wavelet_freqs = ed.wavelet(xx, fs)\n\n# Power Spetrum Density\npsd, psd_freqs = ed.psd(xx, fs)\n\n# Phase-Amplitude Coupling\npac, freqs_pha, freqs_amp = ed.pac(x_3d, fs) # This function is computationally demanding. Please monitor the RAM/VRAM usage.\n```\n\n# Alias\n[`mngs.dsp`](https://github.com/ywatanabe1989/mngs/src/mngs/dsp/) has the same functionalities.\n\n# Contact\nYusuke Watanabe (ywata1989@gmail.com).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Easy digital signal processing",
    "version": "1.3.0",
    "project_urls": {
        "Homepage": "https://github.com/ywatanabe1989/ezdsp"
    },
    "split_keywords": [
        "numpytorch",
        " pandas",
        " lfp",
        " eeg",
        " meg"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8ed278df2dfe0d490e63d78ac451f09c7efe932c5a79caac45c8a734f4237f6",
                "md5": "fad0f39885fbb5dba529b436c6a95ba6",
                "sha256": "ec95448ad67041693baa82ba13a0b1958953f08d339f0524f60675a7d83a1c48"
            },
            "downloads": -1,
            "filename": "ezdsp-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fad0f39885fbb5dba529b436c6a95ba6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 32114,
            "upload_time": "2024-04-08T15:30:30",
            "upload_time_iso_8601": "2024-04-08T15:30:30.275768Z",
            "url": "https://files.pythonhosted.org/packages/c8/ed/278df2dfe0d490e63d78ac451f09c7efe932c5a79caac45c8a734f4237f6/ezdsp-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e87f823afc937fdce6f233b7d58e3f9649f9617fa7de495d738e4657864e869b",
                "md5": "c13279757fd03ae73e83727df7437288",
                "sha256": "5a08533ba57dae2f05b4ddaf883d984fcb9bd3dea52a3fd4a841491a3fda8080"
            },
            "downloads": -1,
            "filename": "ezdsp-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c13279757fd03ae73e83727df7437288",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 24123,
            "upload_time": "2024-04-08T15:30:32",
            "upload_time_iso_8601": "2024-04-08T15:30:32.253538Z",
            "url": "https://files.pythonhosted.org/packages/e8/7f/823afc937fdce6f233b7d58e3f9649f9617fa7de495d738e4657864e869b/ezdsp-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-08 15:30:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ywatanabe1989",
    "github_project": "ezdsp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "julius",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "mne",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "numpy_fn",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "ripple_detection",
            "specs": []
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "tensorpac",
            "specs": []
        },
        {
            "name": "torch",
            "specs": []
        },
        {
            "name": "torch_fn",
            "specs": []
        },
        {
            "name": "torchaudio",
            "specs": []
        },
        {
            "name": "torchsummary",
            "specs": []
        },
        {
            "name": "mngs",
            "specs": [
                [
                    "==",
                    "1.2.3"
                ]
            ]
        }
    ],
    "lcname": "ezdsp"
}
        
Elapsed time: 0.23324s