Git Product home page Git Product logo

pyspectrum's Introduction

PySpectrum

Code PythonVersion License

PySpectrum is a Python package for spectral analyses:

  • sampling rate conversion and its potential aliasing artifacts;
  • spectral rescaling and spectral peak detection by robust log-log linear regression.

PySpectrum is distributed under the open source 3-clause BSD license.

Description

Sample-rate conversion (SRC)

In signal processing, sample-rate conversion (SRC) (also called resampling) is the process of changing the sampling rate of a discrete signal: downsampling or upsampling. SRC can generate aliasing artifacts when Nyquist–Shannon sampling theorem is not respected.

This module implements several functions to complete the Signal processing module of SciPy:

2D image

Image downsampled without anti-aliasing filter shows aliasing artifacts. This kind of downsampling is present in max-pooling, strided-convolution and more generally in strided-layers. These architectural components are widely used in convolutional neural networks like ResNets, DenseNets, MobileNets, degrading performances in terms of shift-invariance and classification accuracy.

See examples\downsample_img.py for the complete analysis.

Time series

Time series of this example is an electrocardiogram (ECG) signal, downsampled from 360 Hz to 180 Hz. Signal downsampled without anti-aliasing filter shows aliasing artifacts, ie. a huge artifact peak at 80 Hz. This kind of downsampling can be present in quickly coded drivers.

See examples\downsample_ecg.py for the complete analysis.

Spectral processing

This module implements several functions:

  • rescale to rescale spectra using a robust log-log linear regression,
  • detect_peak to detect peak on spectra following a power law.

Spectral rescaling

Many analyses require a normalization / standardization step of spectra, to remove inter-spectra variabilities.

See examples\rescale_simulated.py for the complete analysis.

Alpha peak detection in EEG spectrum

Automatic detection of alpha peak in the spectrum of an electroencephalogram (EEG), compared to peak finders provided by SciPy and MNE-Python.

See examples\find_peak_eeg.py for the complete analysis.

Installation

From sources

To install PySpectrum as a standard module:

pip install path/to/PySpectrum

To install PySpectrum in editable / development mode, in the folder:

pip install poetry
poetry install

Testing

Use pytest.

pyspectrum's People

Contributors

qbarthelemy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.