Re: Wanting to take a FFT transform of a irregularly spaced sample

Robert Kern <[email protected]> Wed, 13 Apr 2022 10:52:29 -0400
Newsgroups gmane.comp.python.scientific.user
Message-ID <CAF6FJitQ9QyS-JrF=4ZuHYP7vzzd6PVta0KRFngyFmMJHp9JOQ@mail.gmail.com>
--===============6792893150229372481==
Content-Type: multipart/alternative; boundary="00000000000025b5af05dc8a55b1"

--00000000000025b5af05dc8a55b1
Content-Type: text/plain; charset="UTF-8"

On Wed, Apr 13, 2022 at 10:34 AM ashwin .D <[email protected]> wrote:

> Based on this github issue I had to make one modification -
> https://github.com/scipy/scipy/issues/13812
> as shown below. I had to remove the zero frequency
> signal.lombscargle(minutes,df1.to_numpy().ravel(),freq[1:])
>

Indeed. Sorry, I have not actually used lombscargle() in anger, and that
requirement is not mentioned in the docstring (though it is manifest in the
example).


> and the code works just fine now. The interpretation task awaits me now .
>
> For the record here is the code -
>
> times = df.view(np.int64)/6E10
>
>
> df1 = (data[['Pressure_hPa']])
>
> # I also added a 2 to the angular frequency value
> freq = np.linspace(0, 2*np.pi/300.0,8928//2)
>

You only want to go up to the Nyquist frequency of the original sampling.
If `times` is in units of seconds and the sampling period is 5 minutes
(300s), then the (angular) Nyquist frequency is np.pi/300.

-- 
Robert Kern

--00000000000025b5af05dc8a55b1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Wed, Apr 13, 2022 at 10:34 AM ashwin .=
D &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrot=
e:<br></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex"><div dir=3D"ltr"><div>Based on this github issue I had to mak=
e one modification -=C2=A0<a href=3D"https://github.com/scipy/scipy/issues/=
13812" target=3D"_blank">https://github.com/scipy/scipy/issues/13812</a></d=
iv><div>as shown below. I had to remove the zero frequency=C2=A0</div>signa=
l.lombscargle(minutes,df1.to_numpy().ravel(),freq[1:])</div></blockquote><d=
iv><br></div><div>Indeed. Sorry, I have not actually used lombscargle() in =
anger, and that requirement is not mentioned in the docstring (though it is=
 manifest in the example).</div><div>=C2=A0</div><blockquote class=3D"gmail=
_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204=
,204);padding-left:1ex"><div dir=3D"ltr"><div>and the code works just fine =
now. The interpretation task awaits me now .=C2=A0</div><div><br></div><div=
>For the record here is the code -=C2=A0</div><div><br></div><div>times =3D=
 df.view(np.int64)/6E10<br><br><br>df1 =3D (data[[&#39;Pressure_hPa&#39;]])=
<br><br># I also added a 2 to the angular frequency value=C2=A0</div><div>f=
req =3D np.linspace(0, 2*np.pi/300.0,8928//2)</div></div></blockquote><div>=
<br></div><div>You only want to go up to the Nyquist frequency of the origi=
nal sampling. If `times` is in units of seconds and the sampling period is =
5 minutes (300s), then the (angular) Nyquist frequency is np.pi/300.</div><=
div><br></div></div>-- <br><div dir=3D"ltr" class=3D"gmail_signature">Rober=
t Kern</div></div>

--00000000000025b5af05dc8a55b1--

--===============6792893150229372481==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
SciPy-User mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-user.python.org/
Member address: [email protected]

--===============6792893150229372481==--