nperseg = 2*L-1 if hasattr(window, 'lower') or type(window) is tuple else len(window)