Skip to content

Erroneous ifft1d x-axis computation when shift=False #241

@StefanoPierini-Codra

Description

@StefanoPierini-Codra

When computing ftt1d and ifft1d using Datalab algorithms with shift=False, the x axis of the reverse fourier transform is erroneous. Indeed the reconstruction algorithm present in ifft1d function suppose the frequency array, x, to be sorted. This is not the case if the fft1d was calculated with the parameter shift=False. In addition, in not-shifted fft, fist and last element of the frequency vector has the same module but opposite sign.

The result is that the denominator of the following fraction is zero:
dt = 1.0 / (x[-1] - x[0] + (x[1] - x[0]))

To reproduce
Execute the fourier transform and its reverse on a signal, with shift=False

Proposed Fix
The solution I propose is to sort x before computing dt in ifft1d.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions