Commit 8b834d90 authored by Stefano Covino's avatar Stefano Covino
Browse files

05032025 commit

parent 9f54cec8
Loading
Loading
Loading
Loading

Course.html

deleted100644 → 0
+0 −20

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −17

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −4
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ using Markdown
using InteractiveUtils

# ╔═╡ dfdaa2c2-58bc-4911-8e3b-de854e5d56fa
# ╠═╡ show_logs = false
import Pkg; Pkg.activate(".")

# ╔═╡ f419b967-f090-4f5a-9db7-3f9f1a80f8bb
@@ -194,9 +195,6 @@ md"""
This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebook for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the examples, unless obtained from other properly quoted sources, under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Stefano Covino, Time Domain Astrophysics - Lecture notes featuring computational examples, 2025*.
"""

# ╔═╡ 7b6c4bfd-786a-40b1-bdd3-eb4570f7d1aa


# ╔═╡ Cell order:
# ╟─d0fdd5a1-5989-471c-86f4-4516645331e6
# ╟─8eac6af6-0e5c-43c7-8781-e97b02d3813f
@@ -211,4 +209,3 @@ This notebook is provided as [Open Educational Resource](https://en.wikipedia.or
# ╟─4a49d01f-0138-4ecd-b5af-a9328cfcbd5c
# ╟─9ed9be7b-e2cc-40a0-a4e1-1298a71a8cc3
# ╟─72a28ae9-0fda-4f87-bf1c-e7e133ceec30
# ╠═7b6c4bfd-786a-40b1-bdd3-eb4570f7d1aa
+22 −17
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ using Markdown
using InteractiveUtils

# ╔═╡ 419e9d2c-f5df-49a3-b0ce-9804aacda4b7
# ╠═╡ show_logs = false
import Pkg; Pkg.activate(".")

# ╔═╡ 6a59a8e6-39fc-44b3-9921-8976c677f4b1
@@ -212,29 +213,29 @@ A(t) = \int\limits_{-\infty}^{+\infty} f(\tau) f(t+\tau) d\tau \Longleftrightarr
"""

# ╔═╡ e087bf1e-dd1a-41f3-8154-bfb39325d905
md"""
cm"""
## Discrete Fourier transform
***

- In the real world, we only have discrete measurements, the time series, commonly called, in astronomy, “light curves”. They consist of $N$ measurements $x_k$ taken (now) at equally-spaced times $t_k$ from $0$ to $T$.
- In the real world, we only have discrete measurements, the time series, commonly called, in astronomy, “light curves”. They consist of ``N`` measurements ``x_k`` taken (now) at equally-spaced times ``t_k`` from ``0`` to ``T``.

- In this case we can define the discrete Fourier transform (and its inverse) as:

```math
a_j =            \sum\limits_{k=0}^{N-1} x_k e^{-2\pi ijk/N} \quad\quad (j=-N/2,...,N/2-1)
a_j = \sum\limits_{k=0}^{N-1} x_k e^{-2\pi ijk/N}   \quad   (j=-N/2,...,N/2-1)
```

```math
x_k = {1\over N} \sum\limits_{k=-N/2}^{N/2-1} a_j e^{2\pi ijk/N} \quad\quad (k=0,...,N-1)
```

- Since the data are equally spaced, the times are $kT/N$ and the frequencies are $j/T$.
- Since the data are equally spaced, the times are ``kT/N`` and the frequencies are ``j/T``.

- The time step is $δt = T/N$ and the frequency step is $δν = 1/T$.
- The time step is ``δt = T/N`` and the frequency step is ``δν = 1/T``.

- As the discrete time series has a time step $δt$ and a duration $T$, there are limitations to the frequencies that can be examined:
    - The lowest frequency is $1/T$, corresponding to a sinusoid with a period equal to the signal duration.
    - The highest frequency that can be sampled, is called *Nyquist frequency*: $\nu_\rm{Nyq} = \frac{1}{2\delta T} = \frac{1}{2}\frac{N}{T} $.
- As the discrete time series has a time step ``δt`` and a duration ``T``, there are limitations to the frequencies that can be examined:
    - The lowest frequency is ``1/T``, corresponding to a sinusoid with a period equal to the signal duration.
    - The highest frequency that can be sampled, is called *Nyquist frequency*: ``\nu_\rm{Nyq} = \frac{1}{2\delta T} = \frac{1}{2}\frac{N}{T} ``.

- At the zero frequency, the FT value is just the sum of the signal values:

@@ -242,10 +243,18 @@ x_k = {1\over N} \sum\limits_{k=-N/2}^{N/2-1} a_j e^{2\pi ijk/N} \quad\quad (k=0
a_0 = \sum\limits_{k=0}^{N-1} x_k e^{-2\pi i0k/N} = \sum\limits_{k=0}^{N-1} x_k
```

- *Parseval’s theorem* applies also to the discrete case and one can see that the variance of a signal is $1/N$ times the sum of the $a_j$ over all indices besides zero (also known as *Plancherel Theorem*):
- *Parseval’s theorem* applies also to the discrete case and one can see that the variance of a signal is ``1/N`` times the sum of the ``a_j`` over all indices besides zero (also known as *Plancherel Theorem*):

```math
Var(x_k) = \sum_k (x_k - \bar{x})^2 = \sum_k x_k^2 + \sum_k \bar{x}^2 - \sum_k 2\bar{x}x_k = \sum_k x_k^2 + N \bar{x}^2 -  2N\bar{x}^2 = \sum_k x_k^2 - N\bar{x}^2 = \sum_k x_k^2 - \frac{1}{N}(\sum_k x_k)^2 = \frac{1}{N} \sum_j |a_j|^2 - \frac{1}{N}a_0^2 \Longrightarrow Var(x_k) = \frac{1}{N}\sum_{j=-\frac{N}{2}}^{j=\frac{N}{2}-1} |a_j|^2, \quad j\ne0
Var(x_k) = \sum_k (x_k - \bar{x})^2 = \sum_k x_k^2 + \sum_k \bar{x}^2 - \sum_k 2\bar{x}x_k = \sum_k x_k^2 + N \bar{x}^2 -  2N\bar{x}^2 = 
```

```math
= \sum_k x_k^2 - N\bar{x}^2 = \sum_k x_k^2 - \frac{1}{N}(\sum_k x_k)^2 = \frac{1}{N} \sum_j |a_j|^2 - \frac{1}{N}a_0^2 =
```

```math
\Longrightarrow Var(x_k) = \frac{1}{N}\sum_{j=-\frac{N}{2}}^{j=\frac{N}{2}-1} |a_j|^2,  j\ne0
```

"""
@@ -268,7 +277,7 @@ md"""

- In the following exercize, we are going to analyse weather data spanning about 20 years in France obtained from the US National Climatic Data Center.

- Data are imported http://www.ncdc.noaa.gov/cdo-web/datasets#GHCND. The number "-9999" is used for N/A values. And we need to parse dates contained in the DATE column
- Data are imported [http://www.ncdc.noaa.gov/cdo-web/datasets#GHCND](http://www.ncdc.noaa.gov/cdo-web/datasets#GHCND). The number "-9999" is used for N/A values. And we need to parse dates contained in the DATE column
"""

# ╔═╡ 3d75fecb-157b-408a-aa32-2d2096a766ba
@@ -330,8 +339,8 @@ begin
	temp_psd = abs.(temp_fft).^2
	
	# 1 is the sampling frequency
	temp_freq = fftfreq(length(temp_psd), 1) * 365;
end
	temp_freq = fftfreq(length(temp_psd), 1) * 365
end;

# ╔═╡ c601e37c-c08d-4ce4-8843-6fd52bd1e812
md"""
@@ -1120,9 +1129,6 @@ md"""
This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebook for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the examples, unless obtained from other properly quoted sources, under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Stefano Covino, Time Domain Astrophysics - Lecture notes featuring computational examples, 2025*.
"""

# ╔═╡ 4e16a939-2389-4a07-959e-843290445c49


# ╔═╡ Cell order:
# ╟─d9329a8d-b07c-4207-93a6-1668da23e296
# ╟─3307644d-e875-4f15-a140-a41f7ca82a8f
@@ -1197,4 +1203,3 @@ This notebook is provided as [Open Educational Resource](https://en.wikipedia.or
# ╟─22c6e22a-4b5d-47cd-b4b1-97543a7c9d74
# ╟─27d77a9f-afa4-4b79-87f8-f8a92b87381e
# ╟─321154fd-5092-4d93-ba82-1bcde10efcb5
# ╠═4e16a939-2389-4a07-959e-843290445c49
+239 −233

File changed.

Preview size limit exceeded, changes collapsed.

Loading