question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

signal.slepian should use definition of digital window

See original GitHub issue

It’s now off by a factor of 2: http://dsp.stackexchange.com/questions/2577/a-few-questions-about-slepian-and-generalized-gaussian-windows

The relation between width and the beta parameter to kaiser should be documented. Here’s a comparison for Matlab, there it looks like width = pi * beta: https://ccrma.stanford.edu/~jos/sasp/Kaiser_DPSS_Windows_Compared.html

There’s a factor 2 between the analog and digital versions, maybe the original implementation worked from a description of the analog window?

See discussion on gh-3679.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rgommerscommented, Oct 23, 2016

dpss sounds fine to me. maybe better indeed to deprecate slepian.

0reactions
endolithcommented, Jun 30, 2017

@Eric89GXL I’m not sure. It doesn’t produce an amplitude-normalized output, so we’d still need to figure that out?

By trial and error, these values all produce similar plots:

  • signal.slepian: width=0.3
  • signal.kaiser: beta=11.2
  • nitime.algorithms.spectral.dpss_windows: NW=3.82

I’m not sure what the relationship is.

import numpy as np
from scipy import signal
from scipy.fftpack import fft, fftshift
import matplotlib.pyplot as plt
import nitime

dpss = nitime.algorithms.spectral.dpss_windows(51, 3.82, 1)[0][0]
dpss /= np.amax(dpss)

for window, label in ((signal.slepian(51, width=0.3), 'signal.slepian'),
                      (dpss, 'nitime...dpss_windows'),
                      (signal.kaiser(51, beta=11.2), 'signal.kaiser')):

    plt.figure('window')
    plt.plot(window, label=label)
    plt.title("Window function")
    plt.ylabel("Amplitude")
    plt.xlabel("Sample")
    plt.legend()

    plt.figure('spectrum')
    A = fft(window, 2048) / (len(window)/2.0)
    freq = np.linspace(-0.5, 0.5, len(A))
    response = 20 * np.log10(np.abs(fftshift(A / abs(A).max())))
    plt.plot(freq, response, label=label)
    plt.axis([-0.5, 0.5, -130, 0])
    plt.title("Frequency response")
    plt.ylabel("Normalized magnitude [dB]")
    plt.xlabel("Normalized frequency [cycles per sample]")
    plt.legend()

window

spectrum

Read more comments on GitHub >

github_iconTop Results From Across the Web

scipy.signal.windows.slepian — SciPy v1.2.1 Reference Guide
Used to maximize the energy concentration in the main lobe. Also called the digital prolate spheroidal sequence (DPSS). Note. Deprecated in ...
Read more >
Slepian or DPSS Window - CCRMA - Stanford University
A window having maximal energy concentration in the main lobe is given by the digital prolate spheroidal sequence (DPSS) of order 0 [256,136]....
Read more >
Slepian or DPSS window - Signal Processing Stack Exchange
However, since the generating function is missing and looking at some online resources was not very helpful. So, I am wondering if someone...
Read more >
Slepian or DPSS Window | Spectral Audio Signal Processing
The digital Slepian window (or DPSS window) is then given by the eigenvector corresponding to the largest eigenvalue. A simple matlab program is...
Read more >
Window Functions and Their Applications in ... - OAPEN Library
Window functions are explicitly or implicitly used in many, if not most, digital signal processing systems, and as such are genuinely important. Even....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found