2
$\begingroup$

I have been trying to find a way to transform my time series data in an equivalent manner to the discrete Fourier transform. What I wish to find is something like:

f_t  # an np.array of length n with the observations

t    # an np.array of length n with time of the observations

f_trans = transform(f_t,t)

f_hat   = inversetransf(f_trans,t)

As a result, I want that if I plot (t,f_t) and also (t,f_hat) the two plots overlap.

Edit: To give more context, I have 70'000+ series of 80 points each, all taken in a time interval of 3 seconds. Each series is independent of the others, and I only need to transform all the series once and untransform them also one time. Currently, I been using the FFT and iFFT routines numpy.fft. Since each series has his own time steps and I'm trying to capture the underlying structure, I consider that using a transformation that incorporates the time values will give smaller errors.

$\endgroup$
4
  • $\begingroup$ how much points are we talking about? thousands? Millions? Billions? And: your signal needs to be bandlimited. What is the bandwidth? What is the resolution of your time stamps? $\endgroup$ Commented Oct 23, 2021 at 22:45
  • $\begingroup$ I'm almost certain that you mean that $t$ is not a uniform sequence, i.e. $t$ is not just $t \in T_s \mathbb Z$. But I have to deduce it from the title. Could you *edit your question with this tidbit? $\endgroup$
    – TimWescott
    Commented Oct 24, 2021 at 4:28
  • $\begingroup$ You could try to interpolate the data. If this is allowed, you could import this into LTspice (for example) as a data/time pair with PWL source (with file=...) and then perform an FFT, which will automatically interpolate the data (since SPICE doesn't work with equally spaced time points). $\endgroup$ Commented Oct 24, 2021 at 17:13
  • $\begingroup$ Numpy has plenty of resources for doing interpolation. $\endgroup$
    – TimWescott
    Commented Oct 24, 2021 at 21:15

1 Answer 1

2
$\begingroup$

A DFT requires equally spaced samples.

However, if you just want a similar spectrum result, you can take dot products of the sample vector against a set of orthogonal in aperture sinusoids (sine and cosine pairs or complex exponential) sampled at the same points or time stamps as the data, with the number of orthogonal basis vectors less than or equal to the number or sample points. As the input samples to this kind of computation approaches equally spaced filling the basis aperture, the result approaches a DFT.

$\endgroup$
2
  • $\begingroup$ If I take an orthogonal basis of sin/cosine, is there any recommended base that I should consider or all bases are more or less as useful? Also, I have been thinking of using interpolation between observations to obtain a uniform in time approximation, Is that a valid approach? $\endgroup$
    – Arrigo
    Commented Oct 24, 2021 at 16:20
  • $\begingroup$ If you knew the order of derivatives (i.e. band limited) then cubic splines would work. As I recall, using the synch sin(x)/x around each data point works but is non-orthogonal. There is a way to orthogonalize such situations, if you're interested. Implementing is easy (in the finite case) but the theory is something else. $\endgroup$
    – rrogers
    Commented Oct 26, 2021 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.