<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi everyone,</p>
<p>In my work I do a lot with Slepian functions, and I find scipy's
current capability to make those functions very limited, so I
propose to expand it.</p>
I'll start with a little motivation for why I think Slepians are
great and why it's worth to expand scipy's Slepian capabilities, and
then I propose the changes I would make and the new code I would
add.<br>
<br>
<b>1. Motivation</b><br>
<br>
Slepians (or, using the official term: "discrete, prolate,
spheroidal sequences (DPSS)") are the provably optimal solution to
the so-called spectral concentration problem [1], so they have a lot
of application in frequency analysis [2] and recently my group and I
started working on them in the context of ambient noise analysis for
quantum computers [3, 4].<br>
<p>Slepians are the eigensolutions of the so-called Toelpitz matrix
and there are therefor many of them. The different eigenvectors
are called "orders" of the Slepians. In frequency analysis and in
my work, it is very common to use multiple orders because (given
the right bandwidth parameter) a set of Slepian orders forms a
maximally spectrally concentrated "rectangle" in frequency space.
Based on those Slepian orders, Thompson [2] developed the
"multitaper" spectral reconstruction technique, in which multiple
orders are applied as window functions and the optimal guess for
the frequency spectrum is obtained by combining individual order
estimates.</p>
<p><b>2. What's the current implementation</b><br>
</p>
<p>The current implementation of Slepians in scipy's signal module
only offers the zeroth order, so it is not possible to use for
e.g. the multitaper spectral analysis. In addition to that,
because of the way the eigensystem is solved, it breaks with a
MemoryError when using high numbers of points (i.e. a few
thousand). The request for high numbers of points is not
unreasonable: people do take long time-traces and the FFT makes it
possible to compute Fourier transforms on those.</p>
<p><br>
</p>
<p><b>3. How could it be expanded?</b></p>
<p>I suggest to re-implement the existing function in order to:</p>
<p>a) calculate a variable number of Slepian orders</p>
<p>b) allow for higher point numbers by using a Newtonian solver for
the eigenvalues</p>
<p>I have working code for this, which is based on the
implementation suggested in [5] but is in pure Python. It consists
of three functions: the main Slepian function plus two little
helper functions which would not be exposed to the user. Most of
the code is linted and pep8'd but I haven't got unit tests yet.</p>
<p>Once we have the full set of Slepians available, from there we
(or I) could also implement the multitaper spectral analysis
technique, but let's do one step at a time.</p>
<p>On a side node, not sure if this is a good argument for expanding
the library, but both a Slepian function and a multitaper function
exist in Matlab as well.<br>
</p>
<p><br>
</p>
<p><b>4. What's next?</b></p>
<p>So, what do you guys think of my proposal? If you like it, please
advise me on how to proceed as this is the first time I'm planning
to contribute. From what I took of the web page, I'll start by
downloading the repo - and then should I make a new branch? I'm
also happy to send some code through via email for your review
first.</p>
<p><br>
</p>
<p>Thanks, and I'm looking forward to hearing back from you,</p>
<p>Virginia (from sunny Sydney)</p>
<p><br>
</p>
<p>----<br>
</p>
<p>References:</p>
<p>[1] <a moz-do-not-send="true"
href="https://en.wikipedia.org/wiki/Spectral_concentration_problem">https://en.wikipedia.org/wiki/Spectral_concentration_problem</a></p>
<p>[2] Thompson, "Spectrum estimation and harmonic analysis". Proc.
IEEE 70(9), 1982 DOI: <a target="_blank" class="ng-binding
ng-isolate-scope" href="https://doi.org/10.1109/PROC.1982.12433">10.1109/PROC.1982.12433</a></p>
<p>[3] V. Frey et al. "Application of optimal band-limited control
protocols to quantum noise sensing", Nature Comms 8, 2189, 2017.
DOI: <a moz-do-not-send="true" href="10.1038/s41467-017-02298-2">10.1038/s41467-017-02298-2</a></p>
<p>[4] L.M. Norris et al. "Optimally band-limited spectroscopy of
control noise using a qubit sensor", arXiv preprint at <a
href="https://arxiv.org/abs/1803.05538">https://arxiv.org/abs/1803.05538</a></p>
<p>[5] W.H. Press "Numerical Recipes in C++: The Art of Scientific
Computing" Cambrige University Press, 3rd Edition</p>
</body>
</html>