[SciPy-Dev] Pull Req: Add periodogram and welch functions

Eric Moore ewm@redtetrahedron....
Thu Dec 6 20:50:51 CST 2012

Daniele Nicolodi wrote:
> On 04/12/2012 03:54, Eric Moore wrote:
>> The biggest question I have with my implementation is whether welch
>> should support padded FFTs and detrending.  But I'm happy to hear any
>> feedback.
> I think detrending is a required functionality for the welch method.
> Global detrending can be easily applied before feeding the data to
> welch, but what is required in most application is the independent
> detrending of each data segment used in the estimator.  Detrending up to
> an arbitrary polynomial order, in addition to the common linear
> detrending, would be a nice addition too.
> PS: the lack of segment by segment detrending in Matlab's welch()
> function forces me to maintain a forked version of it.
> Cheers,
> Daniele

I've added detrending.  The relevant part of the docstring is:

detrend : string or function, optional
     Specifies how to detend each segment. If `detrend` is a string,
     it is passed as the `type` argument to scipy.signal.detrend.
     If it is a function, it takes a segment and returns a detrended
     segment.  Defaults to 'constant'

Supporting polynomial detrending would be best done by extending 
detrend, I think. (Also I'd love to see an actual use case for it's `bp` 

Looking at matplotlib's psd again, it also supports setting the length 
of the fft separately from the segment length.  Would we also like to 
support that option?


More information about the SciPy-Dev mailing list