Spectral Analysis in Python

Overview

SPECTRUM : Spectral Analysis in Python

https://github.com/cokelaer/spectrum/actions/workflows/main.yml/badge.svg?branch=master https://coveralls.io/repos/cokelaer/spectrum/badge.png?branch=master
contributions: Please join https://github.com/cokelaer/spectrum
contributors: https://github.com/cokelaer/spectrum/graphs/contributors
issues: Please use https://github.com/cokelaer/spectrum/issues
documentation: http://pyspectrum.readthedocs.io/
Citation: Cokelaer et al, (2017), 'Spectrum': Spectral Analysis in Python, Journal of Open Source Software, 2(18), 348, doi:10.21105/joss.00348

http://www.thomas-cokelaer.info/software/spectrum/html/_images/psd_all.png

Spectrum contains tools to estimate Power Spectral Densities using methods based on Fourier transform, Parametric methods or eigenvalues analysis:

  • The Fourier methods are based upon correlogram, periodogram and Welch estimates. Standard tapering windows (Hann, Hamming, Blackman) and more exotic ones are available (DPSS, Taylor, ...).
  • The parametric methods are based on Yule-Walker, BURG, MA and ARMA, covariance and modified covariance methods.
  • Non-parametric methods based on eigen analysis (e.g., MUSIC) and minimum variance analysis are also implemented.
  • Multitapering is also available

The targetted audience is diverse. Although the use of power spectrum of a signal is fundamental in electrical engineering (e.g. radio communications, radar), it has a wide range of applications from cosmology (e.g., detection of gravitational waves in 2016), to music (pattern detection) or biology (mass spectroscopy).

Quick Installation

spectrum is available on Pypi:

pip install spectrum

and conda:

conda config --append channels conda-forge
conda install spectrum

To install the conda executable itself, please see https://www.continuum.io/downloads .

Contributions

Please see github for any issues/bugs/comments/contributions.

Some notebooks (external contributions)

Comments
  • problem with dpss after update on scipy

    problem with dpss after update on scipy

    Spectrum was working perfectly in python 3.5 until I updated scipy to 0.18.1. Now I get this error:

    In[2]: import spectrum as spec In [3]: spec.dpss(512,3,5)

    TypeError Traceback (most recent call last) in () ----> 1 spec.dpss(512,3,5)

    C:\Python\Anaconda\lib\site-packages\spectrum-0.6.1-py3.5-win-amd64.egg\spectrum \mtm.py in dpss(N, NW, k) 298 299 # The values returned in lam are not exacly the same as in the follo wing methods. --> 300 acvs = _autocov(tapers.transpose(), debias=False) * N 301 nidx = arange(N) 302 W = float(NW)/N

    C:\Python\Anaconda\lib\site-packages\spectrum-0.6.1-py3.5-win-amd64.egg\spectrum \mtm.py in _autocov(s, **kwargs) 386 s = remove_bias(s, axis) 387 kwargs['debias'] = False --> 388 return _crosscov(s, s, **kwargs) 389 390

    C:\Python\Anaconda\lib\site-packages\spectrum-0.6.1-py3.5-win-amd64.egg\spectrum \mtm.py in _crosscov(x, y, axis, all_lags, debias) 422 slicing = [slice(d) for d in x.shape] 423 slicing[axis] = slice(None,None,-1) --> 424 sxy = _fftconvolve(x, y[tuple(slicing)], axis=axis, mode='full') 425 N = x.shape[axis] 426 sxy /= N

    C:\Python\Anaconda\lib\site-packages\spectrum-0.6.1-py3.5-win-amd64.egg\spectrum \mtm.py in _fftconvolve(in1, in2, mode, axis) 506 ret = ifftn(IN1)[fslice].copy() 507 else: --> 508 IN1 = fft(in1,fsize,axis=axis) 509 IN1 *= fft(in2,fsize,axis=axis) 510 ret = ifft(IN1,axis=axis)[fslice].copy()

    C:\Python\Anaconda\lib\site-packages\scipy\fftpack\basic.py in fft(x, n, axis, o verwrite_x) 265 n = tmp.shape[axis] 266 elif n != tmp.shape[axis]: --> 267 tmp, copy_made = _fix_shape(tmp,n,axis) 268 overwrite_x = overwrite_x or copy_made 269

    C:\Python\Anaconda\lib\site-packages\scipy\fftpack\basic.py in _fix_shape(x, n, axis) 151 index[axis] = slice(0,s[axis]) 152 s[axis] = n --> 153 z = zeros(s,x.dtype.char) 154 z[index] = x 155 return z, True

    TypeError: 'numpy.float64' object cannot be interpreted as an integer

    opened by senis000 7
  • Package is not installed on Wondows !!

    Package is not installed on Wondows !!

    I used the command "pip install spectrum" to installing spectrum package but it was not installed and I got error (end of this issue). I use windows 7, MinGW, python 2.7.7 and anaconda distribution.

    last part of error:

    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\240' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\17' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\350' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\3' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\350' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\3' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\36' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\24' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\350' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\3' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\372' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\372' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\36' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\24' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\270' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\36' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\24' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\304' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\36' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\24' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\36' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\24' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\210' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\23' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\364' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\320' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\7' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\36' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\24' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\5' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\5' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\5' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\3' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\3' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\3' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\5' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\5' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\5' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\310' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\311' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\1' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\5' in progr
    am
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\367' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\26' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\227' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\205' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\27' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\312' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\226' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\352' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\20' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\207' in pro
    gram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\22' in prog
    ram
    
    c:\mingw\lib\gcc\mingw32\4.8.1\include\stddef.h:1:29: error: stray '\352' in pro
    gram
    
    
    
    cc1.exe: out of memory allocating 838860800 bytes
    
    error: command 'C:\\MINGW\\BIN\\gcc.exe' failed with exit status 1
    
    ----------------------------------------
    Cleaning up...
    Command D:\Anaconda\python.exe -c "import setuptools, tokenize;__file__='c:\\use
    rs\\mkhm\\appdata\\local\\temp\\pip_build_MKHM\\spectrum\\setup.py';exec(compile
    (getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file_
    _, 'exec'))" install --record c:\users\mkhm\appdata\local\temp\pip-nb46ob-record
    \install-record.txt --single-version-externally-managed --compile failed with er
    ror code 1 in c:\users\mkhm\appdata\local\temp\pip_build_MKHM\spectrum
    Traceback (most recent call last):
      File "D:\Anaconda\Scripts\pip-script.py", line 5, in <module>
        sys.exit(main())
      File "D:\Anaconda\lib\site-packages\pip\__init__.py", line 198, in main
        return command.main(cmd_args)
      File "D:\Anaconda\lib\site-packages\pip\basecommand.py", line 161, in main
        text = '\n'.join(complete_log)
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 5: ordinal
    not in range(128)
    
    opened by mkhm 7
  • Fix loading mydpss under MacOS

    Fix loading mydpss under MacOS

    Using OSX El Capitan and Anaconda Python 3.5 the library is called mydpss.cpython-35m-darwin.so not mydpss.cpython-35m.so.

    Update Use numpy helper function load_library to load library without having to build the library name manually.

    opened by juhasch 6
  • Authorship on JOSS paper

    Authorship on JOSS paper

    @juhasch @anielsen001 @carlkl I've submitted a paper to JOSS describing the Spectrum package. It's currently under review, and you can read the review and response at the link..

    Please let me know by 16 Oct if you'd like to be listed as co-authors on the paper, in which case please send me your current affiliation and ORCID.

    opened by cokelaer 5
  • error while building the package on installation

    error while building the package on installation

    Hi (newbie here) I'm getting an error while trying to install with pip on windows 7, anaconda 2.4.0, python 3.5 pip install spectrum the error seems to be happening during the building of the package since I get something similar if I try to build it myself with "python setup.py install"

    Below the last output lines of pip install.

    Building wheels for collected packages: spectrum Running setup.py bdist_wheel for spectrum Complete output from command C:\Python\Anaconda\python.exe -c "import setuptoo ls;file='C:\Users\senis\AppData\Local\Temp\pip-build-4s5qgf6i\spectru m\setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d C:\Users\senis\AppData\Local\Temp\tmptse64iuppip-wheel -: running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-3.5 creating build\lib.win-amd64-3.5\cpp copying src\cpp__init__.py -> build\lib.win-amd64-3.5\cpp creating build\lib.win-amd64-3.5\spectrum copying src\spectrum\arma.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\burg.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\cholesky.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\cohere.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\correlation.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\correlog.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\covar.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\criteria.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\datasets.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\eigen.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\eigenfre.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\errors.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\levinson.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\linalg.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\linear_prediction.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\lpc.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\minvar.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\modcovar.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\mtm.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\periodogram.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\psd.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\toeplitz.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\tools.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\transfer.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\waveform.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\window.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum\yulewalker.py -> build\lib.win-amd64-3.5\spectrum copying src\spectrum__init__.py -> build\lib.win-amd64-3.5\spectrum running build_ext building 'spectrum.mydpss' extension error: [WinError 2] The system cannot find the file specified


    Failed building wheel for spectrum Failed to build spectrum Installing collected packages: spectrum Running setup.py install for spectrum Complete output from command C:\Python\Anaconda\python.exe -c "import setupt ools, tokenize;file='C:\Users\senis\AppData\Local\Temp\pip-build-4s5qg f6i\spectrum\setup.py';exec(compile(getattr(tokenize, 'open', open)(file). read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\seni s\AppData\Local\Temp\pip-lr7725kt-record\install-record.txt --single-version-ext ernally-managed --compile: running install running build running build_py running build_ext building 'spectrum.mydpss' extension error: [WinError 2] The system cannot find the file specified

    ----------------------------------------
    

    Command "C:\Python\Anaconda\python.exe -c "import setuptools, tokenize;file= 'C:\Users\senis\AppData\Local\Temp\pip-build-4s5qgf6i\spectrum\setup.py' ;exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', ' \n'), file, 'exec'))" install --record C:\Users\senis\AppData\Local\Temp\pip -lr7725kt-record\install-record.txt --single-version-externally-managed --compil e" failed with error code 1 in C:\Users\senis\AppData\Local\Temp\pip-build-4s5qg f6i\spectrum

    opened by senis000 5
  • Error: No module named arma

    Error: No module named arma

    A colleague of mine asked me to install spectrum.

    I get a few errors with Python 3 and an ImportError for arma (that is also there for Python 2).

    $ pip install spectrum --user
    Collecting spectrum
      Downloading spectrum-0.6.0.tar.gz (92kB)
        100% |################################| 94kB 794kB/s 
    Requirement already satisfied (use --upgrade to upgrade): matplotlib in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from spectrum)
    Requirement already satisfied (use --upgrade to upgrade): numpy in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from spectrum)
    Requirement already satisfied (use --upgrade to upgrade): scipy in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from spectrum)
    Collecting easydev (from spectrum)
      Downloading easydev-0.8.3.tar.gz (43kB)
        100% |################################| 45kB 4.0MB/s 
    Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from matplotlib->spectrum)
    Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from matplotlib->spectrum)
    Requirement already satisfied (use --upgrade to upgrade): pytz in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from matplotlib->spectrum)
    Requirement already satisfied (use --upgrade to upgrade): pyparsing>=1.5.6 in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (from matplotlib->spectrum)
    Collecting ordereddict (from easydev->spectrum)
      Downloading ordereddict-1.1.tar.gz
    Installing collected packages: ordereddict, easydev, spectrum
      Running setup.py install for ordereddict
      Running setup.py install for easydev
        Fixing build/lib/easydev/__init__.py build/lib/easydev/codecs.py build/lib/easydev/config_tools.py build/lib/easydev/console.py build/lib/easydev/copybutton.py build/lib/easydev/decorators.py build/lib/easydev/dependencies.py build/lib/easydev/doc.py build/lib/easydev/easytest.py build/lib/easydev/logging_tools.py build/lib/easydev/misc.py build/lib/easydev/multicore.py build/lib/easydev/multigit.py build/lib/easydev/multisetup.py build/lib/easydev/package.py build/lib/easydev/paths.py build/lib/easydev/progressbar.py build/lib/easydev/setuptools.py build/lib/easydev/sphinx_themes.py build/lib/easydev/tools.py build/lib/easydev/url.py
        Fixing build/lib/easydev/__init__.py build/lib/easydev/codecs.py build/lib/easydev/config_tools.py build/lib/easydev/console.py build/lib/easydev/copybutton.py build/lib/easydev/decorators.py build/lib/easydev/dependencies.py build/lib/easydev/doc.py build/lib/easydev/easytest.py build/lib/easydev/logging_tools.py build/lib/easydev/misc.py build/lib/easydev/multicore.py build/lib/easydev/multigit.py build/lib/easydev/multisetup.py build/lib/easydev/package.py build/lib/easydev/paths.py build/lib/easydev/progressbar.py build/lib/easydev/setuptools.py build/lib/easydev/sphinx_themes.py build/lib/easydev/tools.py build/lib/easydev/url.py
        Can't parse docstring in build/lib/easydev/codecs.py line 83: TokenError: ('EOF in multi-line statement', (2, 0))
        Can't parse docstring in build/lib/easydev/codecs.py line 85: ParseError: bad input: type=13, value=';', context=('', (85, 24))
        Can't parse docstring in build/lib/easydev/codecs.py line 87: ParseError: bad input: type=13, value=';', context=('', (87, 24))
        Can't parse docstring in build/lib/easydev/codecs.py line 89: ParseError: bad input: type=13, value=';', context=('', (89, 19))
        Can't parse docstring in build/lib/easydev/multigit.py line 173: ParseError: bad input: type=1, value='multigit', context=(' ', (173, 7))
        Can't parse docstring in build/lib/easydev/multisetup.py line 29: ParseError: bad input: type=1, value='multisetup', context=(' ', (29, 7))
        Can't parse docstring in build/lib/easydev/multisetup.py line 30: ParseError: bad input: type=1, value='multisetup', context=(' ', (30, 7))
        Can't parse docstring in build/lib/easydev/multisetup.py line 31: ParseError: bad input: type=1, value='multisetup', context=(' ', (31, 7))
        Can't parse docstring in build/lib/easydev/multisetup.py line 141: ParseError: bad input: type=1, value='multisetup', context=(' ', (141, 7))
        Can't parse docstring in build/lib/easydev/multisetup.py line 144: ParseError: bad input: type=1, value='multisetup', context=(' ', (144, 7))
        Can't parse docstring in build/lib/easydev/multisetup.py line 147: ParseError: bad input: type=1, value='multisetup', context=(' ', (147, 7))
        Can't parse docstring in build/lib/easydev/tools.py line 169: ParseError: bad input: type=11, value=':', context=('', (169, 20))
        Installing multigit script to /Users/deil/Library/Python/3.4/bin
        Installing easydev_buildPackage script to /Users/deil/Library/Python/3.4/bin
      Running setup.py install for spectrum
        building 'spectrum.mydpss' extension
        /usr/bin/clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -I/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/cpp/mydpss.c -o build/temp.macosx-10.10-x86_64-3.4/src/cpp/mydpss.o
        /usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names build/temp.macosx-10.10-x86_64-3.4/src/cpp/mydpss.o -o build/lib.macosx-10.10-x86_64-3.4/spectrum/mydpss.so
          File "/Users/deil/Library/Python/3.4/lib/python/site-packages/spectrum/psd.py", line 303
            print """To be use with care. THis function is there just to help, it
                    does not populate the proper attribute except psd."""
                                                                        ^
    Successfully installed easydev-0.8.3 ordereddict-1.1 spectrum-0.6.0
    eduroam-3-163:associations deil$ ipython
    Python 3.4.3 (default, Mar 10 2015, 14:53:35) 
    Type "copyright", "credits" or "license" for more information.
    
    IPython 3.0.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    
    In [1]: import spectrum
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-1-c2dabc14c746> in <module>()
    ----> 1 import spectrum
    
    /Users/deil/Library/Python/3.4/lib/python/site-packages/spectrum/__init__.py in <module>()
          2 default_NFFT = 4096
          3 
    ----> 4 import arma
          5 import burg
          6 import cholesky
    
    ImportError: No module named 'arma'
    
    opened by cdeil 5
  • Python version supported

    Python version supported

    Hey everyone, I would like to use Spectrum, but my analysis are all in python 3.9+, and I wouldn't like to send it back to <3.9. I see that the package works until 3.7? Is that correct?

    Any plans of making this compatible with newer versions soon?

    big thanks, Best.

    opened by eduardacenteno 4
  • What is the output of pmtm?

    What is the output of pmtm?

    I'm unclear what exactly the pmtm function is outputting? It returns three np.arrays and the documentation doesn't say what it returns.

    I'm not sure what to do to those output arrays to get the actual multitapered output and produce a plot similar to what is returned from the show=True parameter. Do I need to average one of the arrays in the output? This doesn't seem to match the plot. Any advice or examples would be much appreciated!

    opened by patrickcgray 3
  • initialized wk before adapt loop

    initialized wk before adapt loop

    pmtm with "adapt" method crashes if data is a constant vector Loop is not entered (since convergence criterion is already met), so wk should be initialized before it.

    opened by yuvlyg 3
  • scipy fftn produces warning that numpy fftn does not

    scipy fftn produces warning that numpy fftn does not

    When working on addressing the deprecation warning announced in #49 , I found that the scipy.fftpack.fftn produces a different warning:

    import numpy as np
    from scipy.fftpack import fftn
    a = np.random.random([16,16])
    fftn(a, [32,32])      
    

    /home/apn/proj/spectrum/lib/python3.6/site-packages/scipy-1.1.0-py3.6-linux-x86_64.egg/scipy/fftpack/basic.py:160: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result. z[index] = x

    If you use the numpy version of fftn, this warning goes away, and the answers are the same:

    np.allclose(np.fft.fftn(a,[32,32]) , fftn(a, [32,32]))

    is True

    I'm not sure if there's a reason to choose one of the fftn over another, but the warning appears to come from scipy and could be removed by switching to the numpy version.

    I'm suing scipy 1.1.0, numpy 1.15.2 and python 3.6.5

    enhancement 
    opened by anielsen001 3
  • Made matplotlib+pylab dependencies optional

    Made matplotlib+pylab dependencies optional

    Motivation

    Since the matplotlib/pylab dependency pulls in graphical dependencies such as Tk, Qt, etc. which are not desirable on a headless server environment (with regards to scaling issues).

    Changes

    To reach optional dependency on matplotlib/pylab, the following changes were made:

    • In setup.py the matplotlib dependency was moved from required to optional.
    • Most pylab functions are mere shortcuts to actual functions of the numpy library. Those dependencies were replaced by their respective numpy replacements.
    • Plotting functions that really need matplotlib functionality now have these respective imports directly in their function's body. Thus, the matplotlib is only required, if one (or more) of these functions is called.
    • None of the changes made produces any semantic change of the library, except for one thing: pmtm()'s show parameter's default value was changed from True to False.
    opened by moritz-ritter 3
  • Times sampling or divides in the Capon method of minvar function.

    Times sampling or divides in the Capon method of minvar function.

    1. Describe the bug A clear and concise description of what the bug is.

    2. To Reproduce If you are facing a bug or installation problem, I cannot help yo without some information of way to reproduce the errors. Please complete the following information as much as possible

    • OS: [e.g. Fedora, windows version, mac version]
    • Python version. for example 3.7.2 (please provide X.Y.Z numbers)
    • Version of spectrum:

    you can figure out the version using this python code::

    import spectrum spectrum.version

    3.Expected behavior A clear and concise description of what you expected to happen.

    4.Screenshots If applicable, add screenshots to help explain your problem.

    5.What you think may explain the pbl

    I like this module and it is so powerful. I have one question/confusion.

    math:: P_{MV}(f) = \frac{T}{e^H(f) R^{-1}p e(f)} def minvar(X, order, sampling=1., NFFT=default_NFFT): .. math:: P{MV}(f) = \frac{T}{e^H(f) R^{-1}_p e(f)} ...... # Invert the psi terms at this point to get PSD values PSD = sampling / np.real(psi)

    It times T in the math, but it times sampling in the PSD calculation inside the minvar function. I believe T=1/sampling. When sampling=1, there is no problem. If sampling !=1, it will get wrong answer for power or PSD. I may misunderstand, but can you please verify that.

    Thanks.

    Steve

    opened by xifenglu 0
  • A suggestion to remove confusion regarding periodograms

    A suggestion to remove confusion regarding periodograms

    Hi there, I've been recently reading about this Python library, because I needed to plot some periodograms. And it has proven to be a very frustrating experience. At first glance it seemed that WelchPeriodogram was a class, just like Periodogram itself. The same goes for DaniellPeriodogram. That caused me quite a lot of confusion until I read the souce code. And at least DaniellPeriodogram does have a class one can call, pdaniell, why not WelchPeriodogram? What am I missing?

    Thank you for your effort though!

    question 
    opened by goznalo-git 1
  • Extract dominant periods from data

    Extract dominant periods from data

    hello, I would like to use the spectrum library for extracting periods from data of time series as I understand it, the strongest frequencies (in the case below) is: 0.2, 0.33 and 0.36 Please, tell me is this correct understanding? Or maybe there is a better way to do this? And the second question: method p.plot() allows you to plot frequencies, but where can you find the power values?

    test case:

    import numpy as np
    import pandas as pd
    
    data=[77943,119335,562383,29789,20429,40612,20523,722055,40659,6521,20008,
          20605,130027,1172649,29964,22227,80446,20008,518405,16597,20322,24951,
          70791,1224887,51838,38906,20258,630595,12250,40800]
    data=np.asarray(data)
    
    p=Periodogram(data)
    p.periodogram()
    p.plot()
    
    p.periodogram()
    f=p.frequencies()
    f=pd.Series(f)
    pd.DataFrame([1/f,f], index=['period', 'freq'])
    

    Result:

    image

    opened by q121212 0
Releases(v0.8.1)
Owner
Thomas Cokelaer
Bioinformatician, Scientific Software Developer, Python developer
Thomas Cokelaer
Improving your data science workflows with

Make Better Defaults Author: Kjell Wooding [email protected] This is the git re

Kjell Wooding 18 Dec 23, 2022
Making the DAEN information accessible.

The purpose of this repository is to make the information on Australian COVID-19 adverse events accessible. The Therapeutics Goods Administration (TGA) keeps a database of adverse reactions to medica

10 May 10, 2022
simple way to build the declarative and destributed data pipelines with python

unipipeline simple way to build the declarative and distributed data pipelines. Why you should use it Declarative strict config Scaffolding Fully type

aliaksandr-master 0 Jan 26, 2022
Python dataset creator to construct datasets composed of OpenFace extracted features and Shimmer3 GSR+ Sensor datas

Python dataset creator to construct datasets composed of OpenFace extracted features and Shimmer3 GSR+ Sensor datas

Gabriele 3 Jul 05, 2022
PySpark bindings for H3, a hierarchical hexagonal geospatial indexing system

h3-pyspark: Uber's H3 Hexagonal Hierarchical Geospatial Indexing System in PySpark PySpark bindings for the H3 core library. For available functions,

Kevin Schaich 12 Dec 24, 2022
ped-crash-techvol: Texas Ped Crash Tech Volume Pack

ped-crash-techvol: Texas Ped Crash Tech Volume Pack In conjunction with the Final Report "Identifying Risk Factors that Lead to Increase in Fatal Pede

Network Modeling Center; Center for Transportation Research; The University of Texas at Austin 2 Sep 28, 2022
Pyspark Spotify ETL

This is my first Data Engineering project, it extracts data from the user's recently played tracks using Spotify's API, transforms data and then loads it into Postgresql using SQLAlchemy engine. Data

16 Jun 09, 2022
2019 Data Science Bowl

Kaggle-2019-Data-Science-Bowl-Solution - Here i present my solution to kaggle 2019 data science bowl and how i improved it to win a silver medal in that competition.

Deepak Nandwani 1 Jan 01, 2022
Multiple Pairwise Comparisons (Post Hoc) Tests in Python

scikit-posthocs is a Python package that provides post hoc tests for pairwise multiple comparisons that are usually performed in statistical data anal

Maksim Terpilowski 264 Dec 30, 2022
BinTuner is a cost-efficient auto-tuning framework, which can deliver a near-optimal binary code that reveals much more differences than -Ox settings.

BinTuner is a cost-efficient auto-tuning framework, which can deliver a near-optimal binary code that reveals much more differences than -Ox settings. it also can assist the binary code analysis rese

BinTuner 42 Dec 16, 2022
A Streamlit web-app for a data-science project that aims to evaluate if the answer to a question is helpful.

How useful is the aswer? A Streamlit web-app for a data-science project that aims to evaluate if the answer to a question is helpful. If you want to l

1 Dec 17, 2021
CINECA molecular dynamics tutorial set

High Performance Molecular Dynamics Logging into CINECA's computer systems To logon to the M100 system use the following command from an SSH client ss

J. W. Dell 0 Mar 13, 2022
Evaluation of a Monocular Eye Tracking Set-Up

Evaluation of a Monocular Eye Tracking Set-Up As part of my master thesis, I implemented a new state-of-the-art model that is based on the work of Che

Pascal 19 Dec 17, 2022
💬 Python scripts to parse Messenger, Hangouts, WhatsApp and Telegram chat logs into DataFrames.

Chatistics Python 3 scripts to convert chat logs from various messaging platforms into Pandas DataFrames. Can also generate histograms and word clouds

Florian 893 Jan 02, 2023
Using Data Science with Machine Learning techniques (ETL pipeline and ML pipeline) to classify received messages after disasters.

Using Data Science with Machine Learning techniques (ETL pipeline and ML pipeline) to classify received messages after disasters.

1 Feb 11, 2022
A lightweight, hub-and-spoke dashboard for multi-account Data Science projects

A lightweight, hub-and-spoke dashboard for cross-account Data Science Projects Introduction Modern Data Science environments often involve many indepe

AWS Samples 3 Oct 30, 2021
A data structure that extends pyspark.sql.DataFrame with metadata information.

MetaFrame A data structure that extends pyspark.sql.DataFrame with metadata info

Invent Analytics 8 Feb 15, 2022
pandas: powerful Python data analysis toolkit

pandas is a Python package that provides fast, flexible, and expressive data structures designed to make working with "relational" or "labeled" data both easy and intuitive.

pandas 36.4k Jan 03, 2023
bigdata_analyse 大数据分析项目

bigdata_analyse 大数据分析项目 wish 采用不同的技术栈,通过对不同行业的数据集进行分析,期望达到以下目标: 了解不同领域的业务分析指标 深化数据处理、数据分析、数据可视化能力 增加大数据批处理、流处理的实践经验 增加数据挖掘的实践经验

Way 2.4k Dec 30, 2022
Powerful, efficient particle trajectory analysis in scientific Python.

freud Overview The freud Python library provides a simple, flexible, powerful set of tools for analyzing trajectories obtained from molecular dynamics

Glotzer Group 195 Dec 20, 2022