Skip to content

temporian.EventSet.experimental_fast_fourier_transform #

    num_events: int,
    hop_size: Optional[int] = None,
    window: Optional[str] = None,
    num_spectral_lines: Optional[int] = None
) -> EventSetOrNode

Computes the Fast Fourier Transform of an EventSet with a single tp.float32 feature.

WARNING: This operator is experimental. The implementation is not yet optimized for speed, and the operator signature might change in the future.

The window length is defined in number of events, instead of timestamp duration like most other operators. The 'num_events' argument needs to be specified by warg i.e. fast_fourier_transform(num_events=5) instead of fast_fourier_transform(5).

The operator returns the amplitude of each spectral line as separate tp.float32 features named "a0", "a1", "a2", etc. By default, num_events // 2 spectral line are returned.

>>> a = tp.event_set(
...    timestamps=[1,2,3,4,5,6],
...    features={"x": [4.,3.,2.,6.,2.,1.]},
... )
>>> b = a.experimental_fast_fourier_transform(num_events=4, window="hamming")
>>> b
indexes: []
features: [('a0', float64), ('a1', float64)]
     (2 events):
        timestamps: [4. 6.]
        'a0': [4.65 6.4 ]
        'a1': [2.1994 4.7451]


Name Type Description Default
num_events int

Size of the FFT expressed as a number of events.

window Optional[str]

Optional window function applied before the FFT. if None, no window is applied. Supported values are: "hamming".

hop_size Optional[int]

Step, in number of events, between consecutive outputs. Default to num_events//2.

num_spectral_lines Optional[int]

Number of returned spectral lines. If set, the operators returns the num_spectral_lines low frequency spectral lines. num_spectral_lines should be between 1 and num_events.



Type Description

EventSet containing the amplitude of each frequency band of the Fourier Transform.