Skip to content

specgram(x) should warn if x.size < 256 #6064

Closed
@roger-

Description

@roger-

The default NFFT size of 256 gives misleading results if x.size << 256, for example this chirp:

import numpy as np
import pylab as pyl
from scipy.signal import chirp

fs = 200
t = np.arange(0, 1, 1/fs)

signal = chirp(t, t1=1, f0=0, f1=100)

pyl.specgram(signal, Fs=fs)
pyl.show()

Gives this. Passing NFFT=32, noverlap=16 to specgram() gives this more reasonable result.

Simplest fix is probably just to warn users when their data is too small.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions