{ "info": { "author": "Henrik Blidh", "author_email": "henrik.blidh@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Scientific/Engineering" ], "description": "\n# LSPOpt\n\n[![Build Status](https://dev.azure.com/hbldh/github/_apis/build/status/hbldh.lspopt?branchName=master)](https://dev.azure.com/hbldh/github/_build/latest?definitionId=7&branchName=master)\n[![Coverage Status](https://coveralls.io/repos/github/hbldh/lspopt/badge.svg?branch=master)](https://coveralls.io/github/hbldh/lspopt?branch=master)\n[![PyPI version](https://img.shields.io/pypi/v/lspopt.svg)](https://pypi.org/project/lspopt/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nThis module is a Python implementation of the multitaper window method \ndescribed in [\\[1\\]](#references) for estimating Wigner spectra for certain locally\nstationary processes.\n\nAbstract from [\\[1\\]](#references):\n\n> This paper investigates the time-discrete multitapers that give a mean square error optimal Wigner spectrum estimate for a class\n> of locally stationary processes (LSPs). The accuracy in the estimation of the time-variable Wigner spectrum of the LSP is evaluated\n> and compared with other frequently used methods. The optimal multitapers are also approximated by Hermite functions, which is\n> computationally more efficient, and the errors introduced by this approximation are studied. Additionally, the number of windows\n> included in a multitaper spectrum estimate is often crucial and an investigation of the error caused by limiting this number is made.\n> Finally, the same optimal set of weights can be stored and utilized for different window lengths. As a result, the optimal multitapers\n> are shown to be well approximated by Hermite functions, and a limited number of windows can be used for a mean square error\n> optimal spectrogram estimate.\n\n## Installation\n\nInstall via pip:\n\n pip install lspopt\n\n## Testing\n\nTest with `pytest`:\n\n pytest tests/ \n\nTests are run at every commit to GitHub and the results of this, as well as test \ncoverage, can be studied at [Azure Pipelines](https://dev.azure.com/hbldh/github/_build/latest?definitionId=7&branchName=master).\n\n## Usage\n\nTo generate the taper windows only, use the `lspopt` method:\n\n```python\nfrom lspopt import lspopt\nH, w = lspopt(N=256, c_parameter=20.0)\n```\n\nThere is also a convenience method for using the [SciPy spectrogram method](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectrogram.html#scipy.signal.spectrogram)\nwith the `lspopt` multitaper windows:\n\n```python\nfrom lspopt import spectrogram_lspopt\nf, t, Sxx = spectrogram_lspopt(x, fs, c_parameter=20.0)\n```\n\nThis can then be plotted with e.g. [matplotlib](http://matplotlib.org/).\n\n### Example\n\nOne can generate a [chirp](https://docs.scipy.org/doc/scipy-0.16.0/reference/generated/scipy.signal.chirp.html)\nprocess realisation and run spectrogram methods on this. \n\n```python\nimport numpy as np\nfrom scipy.signal import chirp, spectrogram\nimport matplotlib.pyplot as plt\n\nfrom lspopt.lsp import spectrogram_lspopt\n\nfs = 10e3\nN = 1e5\namp = 2 * np.sqrt(2)\nnoise_power = 0.001 * fs / 2\ntime = np.arange(N) / fs\nfreq = np.linspace(1e3, 2e3, N)\nx = amp * chirp(time, 1e3, 2.0, 6e3, method='quadratic') + \\\n np.random.normal(scale=np.sqrt(noise_power), size=time.shape)\n\nf, t, Sxx = spectrogram(x, fs)\n\nax = plt.subplot(211)\nax.pcolormesh(t, f, Sxx)\nax.set_ylabel('Frequency [Hz]')\nax.set_xlabel('Time [sec]')\n\nf, t, Sxx = spectrogram_lspopt(x, fs, c_parameter=20.0)\n\nax = plt.subplot(212)\nax.pcolormesh(t, f, Sxx)\nax.set_ylabel('Frequency [Hz]')\nax.set_xlabel('Time [sec]')\n\nplt.show()\n```\n\n![Spectrogram plot](https://hbldh.github.com/lspopt/images/plot.png)\n*Top: Using SciPy's spectrogram method. Bottom: Using LSPOpt's spectrogram solution.*\n\n## References\n\n\\[1\\] [Hansson-Sandsten, M. (2011). Optimal multitaper Wigner spectrum \nestimation of a class of locally stationary processes using Hermite functions. \nEURASIP Journal on Advances in Signal Processing, 2011, 10.](http://asp.eurasipjournals.com/content/pdf/1687-6180-2011-980805.pdf)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hbldh/lspopt", "keywords": "Mathematical Statistics,Multitaper,Spectrogram", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lspopt", "package_url": "https://pypi.org/project/lspopt/", "platform": "", "project_url": "https://pypi.org/project/lspopt/", "project_urls": { "Homepage": "https://github.com/hbldh/lspopt" }, "release_url": "https://pypi.org/project/lspopt/1.1.0/", "requires_dist": [ "numpy", "scipy", "six" ], "requires_python": ">=2.7.10", "summary": "A Python implementation of a multitaper window method for estimating Wigner spectra for certain locally stationary processes", "version": "1.1.0" }, "last_serial": 5418910, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "03b047713490d032db40ced6e46aa590", "sha256": "ed16100c47fabb5bb03658ddec17901299a7541fc2074219c42e3fb7d537df28" }, "downloads": -1, "filename": "lspopt-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "03b047713490d032db40ced6e46aa590", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.10", "size": 34847, "upload_time": "2019-06-19T06:56:23", "url": "https://files.pythonhosted.org/packages/98/fc/042e87e10252681282dc29be2d67c431759823246d190a7f9f6ecc953645/lspopt-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "929a14f9353ab30f556949f39b938e39", "sha256": "efddaef0ae67d8327ff466a384537c92e305c771a73dc8d3eab44cfbf8bda845" }, "downloads": -1, "filename": "lspopt-1.1.0.tar.gz", "has_sig": false, "md5_digest": "929a14f9353ab30f556949f39b938e39", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.10", "size": 8108, "upload_time": "2019-06-19T06:56:25", "url": "https://files.pythonhosted.org/packages/48/34/135e305e77e4039c43efbfcdadd8ac7267338a3aa3a36cb4cd0f84e77561/lspopt-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "03b047713490d032db40ced6e46aa590", "sha256": "ed16100c47fabb5bb03658ddec17901299a7541fc2074219c42e3fb7d537df28" }, "downloads": -1, "filename": "lspopt-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "03b047713490d032db40ced6e46aa590", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.10", "size": 34847, "upload_time": "2019-06-19T06:56:23", "url": "https://files.pythonhosted.org/packages/98/fc/042e87e10252681282dc29be2d67c431759823246d190a7f9f6ecc953645/lspopt-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "929a14f9353ab30f556949f39b938e39", "sha256": "efddaef0ae67d8327ff466a384537c92e305c771a73dc8d3eab44cfbf8bda845" }, "downloads": -1, "filename": "lspopt-1.1.0.tar.gz", "has_sig": false, "md5_digest": "929a14f9353ab30f556949f39b938e39", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.10", "size": 8108, "upload_time": "2019-06-19T06:56:25", "url": "https://files.pythonhosted.org/packages/48/34/135e305e77e4039c43efbfcdadd8ac7267338a3aa3a36cb4cd0f84e77561/lspopt-1.1.0.tar.gz" } ] }