From 83694635838e1eec420dc39c5a3c107adbd7b938 Mon Sep 17 00:00:00 2001 From: Per A Brodtkorb Date: Mon, 15 Feb 2016 11:03:42 +0100 Subject: [PATCH] Fixed a bug. --- wafo/objects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wafo/objects.py b/wafo/objects.py index 51cf4c5..c5756b1 100644 --- a/wafo/objects.py +++ b/wafo/objects.py @@ -1208,7 +1208,6 @@ class TimeSeries(PlotData): yy = tr.dat2gauss(yy) yy = detrend(yy) if hasattr(detrend, '__call__') else yy n = len(yy) - L = min(L, n - 1) estimate_L = L is None if method == 'cov' or estimate_L: @@ -1219,6 +1218,7 @@ class TimeSeries(PlotData): # add a nugget effect to ensure that round off errors # do not result in negative spectral estimates spec = R.tospecdata(rate=rate, nugget=nugget) + L = min(L, n - 1) if method == 'psd': nfft = 2 ** nextpow2(L) pad_to = rate * nfft # Interpolate the spectrum with rate