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
Flood modeling by 2D shallow water equation

hydraulicmodel Flood modeling by 2D shallow water equation. Refer to Hunter et al (2005), Bates et al. (2010). Diffusive wave approximation Local iner

6 Nov 30, 2022
This repo contains a simple but effective tool made using python which can be used for quality control in statistical approach.

This repo contains a powerful tool made using python which is used to visualize, analyse and finally assess the quality of the product depending upon the given observations

SasiVatsal 8 Oct 18, 2022
Generates a simple report about the current Covid-19 cases and deaths in Malaysia

Generates a simple report about the current Covid-19 cases and deaths in Malaysia. Results are delay one day, data provided by the Ministry of Health Malaysia Covid-19 public data.

Yap Khai Chuen 7 Dec 15, 2022
Python package for analyzing behavioral data for Brain Observatory: Visual Behavior

Allen Institute Visual Behavior Analysis package This repository contains code for analyzing behavioral data from the Allen Brain Observatory: Visual

Allen Institute 16 Nov 04, 2022
MotorcycleParts DataAnalysis python

We work with the accounting department of a company that sells motorcycle parts. The company operates three warehouses in a large metropolitan area.

NASEEM A P 1 Jan 12, 2022
🧪 Panel-Chemistry - exploratory data analysis and build powerful data and viz tools within the domain of Chemistry using Python and HoloViz Panel.

🧪📈 🐍. The purpose of the panel-chemistry project is to make it really easy for you to do DATA ANALYSIS and build powerful DATA AND VIZ APPLICATIONS within the domain of Chemistry using using Python a

Marc Skov Madsen 97 Dec 08, 2022
Uses MIT/MEDSL, New York Times, and US Census datasources to analyze per-county COVID-19 deaths.

Covid County Executive summary Setup Install miniconda, then in the command line, run conda create -n covid-county conda activate covid-county conda i

Ahmed Fasih 1 Dec 22, 2021
peptides.py is a pure-Python package to compute common descriptors for protein sequences

peptides.py Physicochemical properties and indices for amino-acid sequences. 🗺️ Overview peptides.py is a pure-Python package to compute common descr

Martin Larralde 32 Dec 31, 2022
A Big Data ETL project in PySpark on the historical NYC Taxi Rides data

Processing NYC Taxi Data using PySpark ETL pipeline Description This is an project to extract, transform, and load large amount of data from NYC Taxi

Unnikrishnan 2 Dec 12, 2021
Extract Thailand COVID-19 Cluster data from daily briefing pdf.

Thailand COVID-19 Cluster Data Extraction About Extract Clusters from Thailand Daily COVID-19 briefing PDF Download latest data Here. Data will be upd

Noppakorn Jiravaranun 5 Sep 27, 2021
MoRecon - A tool for reconstructing missing frames in motion capture data.

MoRecon - A tool for reconstructing missing frames in motion capture data.

Yuki Nishidate 38 Dec 03, 2022
INF42 - Topological Data Analysis

TDA INF421(Conception et analyse d'algorithmes) Projet : Topological Data Analysis SphereMin Etant donné un nuage des points, ce programme contient de

2 Jan 07, 2022
Flenser is a simple, minimal, automated exploratory data analysis tool.

Flenser Have you ever been handed a dataset you've never seen before? Flenser is a simple, minimal, automated exploratory data analysis tool. It runs

John McCambridge 79 Sep 20, 2022
A distributed block-based data storage and compute engine

Nebula is an extremely-fast end-to-end interactive big data analytics solution. Nebula is designed as a high-performance columnar data storage and tabular OLAP engine.

Columns AI 131 Dec 26, 2022
WAL enables programmable waveform analysis.

This repro introcudes the Waveform Analysis Language (WAL). The initial paper on WAL will appear at ASPDAC'22 and can be downloaded here: https://www.

Institute for Complex Systems (ICS), Johannes Kepler University Linz 40 Dec 13, 2022
talkbox is a scikit for signal/speech processing, to extend scipy capabilities in that domain.

talkbox is a scikit for signal/speech processing, to extend scipy capabilities in that domain.

David Cournapeau 76 Nov 30, 2022
CaterApp is a cross platform, remotely data sharing tool created for sharing files in a quick and secured manner.

CaterApp is a cross platform, remotely data sharing tool created for sharing files in a quick and secured manner. It is aimed to integrate this tool with several more features including providing a U

Ravi Prakash 3 Jun 27, 2021
Demonstrate the breadth and depth of your data science skills by earning all of the Databricks Data Scientist credentials

Data Scientist Learning Plan Demonstrate the breadth and depth of your data science skills by earning all of the Databricks Data Scientist credentials

Trung-Duy Nguyen 27 Nov 01, 2022
A forecasting system dedicated to smart city data

smart-city-predictions System prognostyczny dedykowany dla danych inteligentnych miast Praca inżynierska realizowana przez Michała Stawikowskiego and

Kevin Lai 1 Nov 08, 2021
Data Scientist in Simple Stock Analysis of PT Bukalapak.com Tbk for Long Term Investment

Data Scientist in Simple Stock Analysis of PT Bukalapak.com Tbk for Long Term Investment Brief explanation of PT Bukalapak.com Tbk Bukalapak was found

Najibulloh Asror 2 Feb 10, 2022