<jupyter_start><jupyter_text>Sinusoidal functionsAs we said in the introduction and seen in the recommended websites, the objective of Fourier analysis is to tell us what fundamental **sinusoidal functions** (sines and cosines) a signal $f(x)$ is made of. For this, we need to have a basic understanding of these sinusoidal functions.The best brief overview I could find is on this MIT OpenCourseware website:- https://ocw.mit.edu/courses/mathematics/18-03sc-differential-equations-fall-2011/unit-i-first-order-differential-equations/sinusoidal-functions/MIT18_03SCF11_s7_1text.pdf [3]If you want to interactively play with the different parameters of sinusiodal functions, you can do this on this Desmos application and visual explanation:- https://www.desmos.com/calculator/absl7xylcv- http://setosa.io/ev/sine-and-cosine/Let's see how we can represent those kind of functions in Python. We will be using the sine and cosine functions from the `numpy` package.<jupyter_code>import numpy as np                 # numerical python with lots of math and array functionality
import matplotlib.pyplot as plt    # for plotting
# for inline plots without having to write plt.show() every time
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Let's prepare an array for the independent spatial variable $x$, then take the cosine of that and display it. It doesn't really matter whether we do the cosine or the sine, since they're properties are the same. In fact, they are exactly the same except for a $\pi/2$ phase shift, as we will see later.<jupyter_code># Create array for independent spatial variable x
x = np.linspace(-10, 10, 1000)
print("Shape of x: {}".format(x.shape))<jupyter_output><empty_output><jupyter_text>The different parameters<jupyter_code># Calculate the cosine of x
y = np.cos(x)

plt.figure(figsize=(15, 8))
plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x) = cos(x)")

plt.plot(x, y)
plt.title("$cos(x)$")<jupyter_output><empty_output><jupyter_text>What we plotted here is the function:$$f(x) = cos(x)$$Comparing that to the general form of a sinusoidal function from link [3]:$$f(x) = A\ cos(\omega x - \phi)$$we can see that in our particular example, $A = 1$, $\omega = 1$ and $\phi = 0$. We can show this on the plot we made.<jupyter_code>A = 1
phi = 0
omega = 1
P = 2*np.pi/omega

plt.figure(figsize=(15, 8))
plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x) = cos(x)")

# the function
plt.plot(x, y)
plt.title("$cos(x)$")

# pointing out A
plt.axhline(1, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, 1), xytext=(3, 0.75), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(0, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')
#TODO: visualize omega?

# pointing out nu ?
# TODO: point out nu

# pointing out P
plt.axvline(P, linestyle="-.", linewidth="0.9", c='k')
plt.fill_betweenx([-A,A], 0, P, color="y", alpha=0.2)
plt.annotate('period P', xy=(P, 2*(A/5)), xytext=(7.5, 0.15), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)

# TODO: add ticks on x-axis at pi and 1<jupyter_output><empty_output><jupyter_text>The shaded area indicates the $x=[0, 2\pi]$ interval.As explained in the MIT link:- $A$, amplitude: describes how high the graph of $f(x)$ rises above the x-axis at its maximum values.- $\phi$, phaselag: value of $\omega x$ by which the function is shifted along $x$  Note that for a cosine, this will coincide with the value of $x$ for which the graph has its maximum, whereas dor a sine this will be the value of $x$ where $f(x)$ has a zero. (For a cosine: if $\phi = 0$, the graph has the position of $cos(\omega x)$; if $\phi = \pi / 2$, it has the position of $sin(\omega x)$; for a sine, it is the other way around. We will show this later.)- $\omega$, angular frequency: number of complete oscillations $f(x)$ makes in a spatial interval of length $2 \pi$; that is, the number of radians per unit length- $\nu = \omega / 2 \pi$, frequency of $f(x)$: the number of complete oscillations the graph makes in a spatial interval of length 1; that is, the number of cycles per unit time- $P = 2\pi/\omega = 1/\nu$, period: the x-interval required for one complete oscillation.One can make a choice to look at things by introducing the spatial lag $\tau = \phi / \omega$, then we get an alternative representation of a sinudoidal function:$$f(x) = A\ cos(\omega (x - \tau))$$$$f(x) = A\ cos(2\pi \nu (x - \tau))$$You chose one purely on what you are more comfortable with or what makes more sense in your resoective application.-- TODO: Add a description of a real-world example of a spatial sine wave. -- Changing the amplitudeWe will stick to our first definition of a sinusoidal function and we can chose whatever numbers we want for $A$, $\phi$ and $\nu$ (note how I am switching to frequencies per unit lenght as opposed to radians, since I find that more intuitive).$$f(x) = A\ cos(2\pi \nu x - \phi)$$<jupyter_code>A = 3.45
phi = 0
nu = 1/(2*np.pi)   # with this, omega = 1, like in the above case
P = 1/nu

y1 = A * np.cos(2*np.pi * nu * x - phi)   # 2pi is needed for conversion nu = omega/2pi --> omega = 2pi * nu

# Plot
plt.figure(figsize=(15, 8))

plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, y, linestyle="dotted", label="original")
plt.plot(x, y1, label="changed amplitude")
plt.title("$cos(x)$")
plt.legend()

# pointing out A
plt.axhline(A, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, A), xytext=(3, A-(A/5)), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(0, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')

# pointing out P
plt.fill_betweenx([-A,A], 0, P, color="y", alpha=0.2)
plt.axvline(P, linestyle="-.", linewidth="0.9", c='k')
plt.annotate('period P', xy=(P+phi, 2*(A/5)), xytext=(P+(P/5)+phi, 0+(A/5)), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)<jupyter_output><empty_output><jupyter_text>We can see how everything stays the same, except for how "strong" the signal is - its amplitude. Changing the phase<jupyter_code>A = 1
phi = 2.3
nu = 1/(2*np.pi)   # still omega = 1
P = 1/nu

y2 = A * np.cos(2*np.pi * nu * x - phi)   # 2pi is needed for conversion nu = omega/2pi --> omega = 2pi * nu

# Plot
plt.figure(figsize=(15, 8))

plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, y, linestyle="dotted", label="original")
plt.plot(x, y2, label="changed phase")
plt.title("$cos(x)$")
plt.legend()

# pointing out A
plt.axhline(A, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, A), xytext=(3, A-(A/5)), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(phi, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')

# pointing out P
plt.fill_betweenx([-A,A], 0, P, color="y", alpha=0.2)
plt.axvline(P, linestyle="-.", linewidth="0.9", c='k')
plt.annotate('period P', xy=(P, 2*(A/5)), xytext=(P+(P/5), 0+(A/5)), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)<jupyter_output><empty_output><jupyter_text>Everything is the same like in the first example, except for the shift of the signal.Note how it doesn't really matter where we shade the plot for the period, trying to visualizing $P$. The important thing is that $f(x)$ is exactly the same at the beginning and at the end of that period interval. It is visually usually easier to measure from one maximum to the next though, so we could also display it like this:<jupyter_code># Plot with different shaded area for P and omega
plt.figure(figsize=(15, 8))

plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, y, linestyle="dotted", label="original")
plt.plot(x, y2, label="changed phase")
plt.title("$cos(x)$")
plt.legend()

# pointing out A
plt.axhline(A, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, A), xytext=(3, A-(A/5)), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(phi, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')

# pointing out P
plt.fill_betweenx([-A,A], phi, P+phi, color="y", alpha=0.2)
plt.axvline(P+phi, linestyle="-.", linewidth="0.9", c='k')
plt.annotate('period P', xy=(P+phi, 2*(A/5)), xytext=(P+(P/5)+phi, 0+(A/5)), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)<jupyter_output><empty_output><jupyter_text>Changing the spatial frequencyNow, one thing I realized confused me a lot is when people talk about "spatial frequency". Obviously, in whatever context this is used, it will mean a **number of cycles per spatial unit**. The things is though, that we can talk about spatial frequencies in the Fourier domain, which we decided to be $s$ here, the independent variable of our FT $F(s)$, but if our original signal $f(s)$ is a sinusoidal function, than it will also have a spatial frequency - the $\nu$. Fundamentally, both of them are the same thing, but physically they have a different meaning, especially in optics: theh spatial frequency of a sine phase ripple in our pupil plane simply means how "dense" those ripples are, while the spatial frequencies in the image plane (the Fourier domain of the pupil plane) are the phase space of the FT.<jupyter_code>A = 1
phi = 0
nu = 0.7 / (2*np.pi)
P = 1/nu

y3 = A * np.cos(2*np.pi * nu * x - phi)   # 2pi is needed for conversion nu = omega/2pi --> omega = 2pi * nu

# Plot
plt.figure(figsize=(15, 8))

plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, y, linestyle="dotted", label="original")
plt.plot(x, y3, label="changed frequency")
plt.title("$cos(x)$")
plt.legend()

# pointing out A
plt.axhline(A, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, A), xytext=(3, A-(A/5)), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(phi, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')

# pointing out P
plt.fill_betweenx([-A,A], phi, P+phi, color="y", alpha=0.2)
plt.axvline(P+phi, linestyle="-.", linewidth="0.9", c='k')
plt.annotate('period P', xy=(P+phi, 2*(A/5)), xytext=(P+(P/5)+phi, 0+(A/5)), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)<jupyter_output><empty_output><jupyter_text>The frequency is the harder one of the three fundamental parameters. Remember to differentiate between the *angular frequency $\omega$*, which tells us how many full cycles the signal completes over the interval $x = [0, 2\pi]$ and just *the frequency $\nu$*, which tells us how many full cycles the signal completes over the interval $x=[0, 1]$. The fundamental difference here is that $\omega$ tells us the number of **radians per unit length** and $\nu$ gives as a number of **cycles per unit length**. And the period $P$ tells us, on what interval $x_2 - x_1$ the signal completes **one full cycle**.We can see this clearly in our last plot. While the yellow shaded area always went exactly up to the $2\pi$ mark so far, this time, it does not. This is because we changed our angular frequency not to be 1 anymore, meaning it will not finish exactly one cycle over $2\pi$. In fact, we have made our angluar frequency (and frequency $\nu$) smaller, which means that the period becomes larger. The same holds true for othe frequency $\nu$, except over the interval $x=[0,1]$. (Frequency and phase) A random exampleWhile dealing with the amplitude is very straight forward, it's just a slightly bit more complicated when dealing with the frequency and phase together. So I am showing an example here in which we change both.<jupyter_code>#TODO: Why does phase lag line in third plot not show up at max of the function?

# Exploring interplay between frequency and phase
A = 1
phi = 0
nu = 2.5/ (2*np.pi)
P = 1/nu

y4 = A * np.cos(2*np.pi * nu * x - phi)

# Plot
plt.figure(figsize=(15, 10))

# first one
plt.subplot(3, 1, 1)

plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, y, linestyle="dotted", label="original")
plt.plot(x, y4, label="random example")
plt.title("$cos(x)$")
plt.legend()

# pointing out A
plt.axhline(A, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, A), xytext=(3, A-(A/5)), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(phi, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')

# pointing out P
plt.fill_betweenx([-A,A], phi, P+phi, color="y", alpha=0.2)
plt.axvline(P+phi, linestyle="-.", linewidth="0.9", c='k')
plt.annotate('period P', xy=(P+phi, 2*(A/5)), xytext=(P+(P/5)+phi, 0+(A/5)), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)

# second one

A = 1
phi = 1.1
nu = 1/ (2*np.pi)
P = 1/nu

y5 = A * np.cos(2*np.pi * nu * x - phi)

plt.subplot(3, 1, 2)

plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, y, linestyle="dotted", label="original")
plt.plot(x, y5, label="random example")
plt.title("$cos(x)$")
plt.legend()

# pointing out A
plt.axhline(A, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, A), xytext=(3, A-(A/5)), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(phi, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')

# pointing out P
plt.fill_betweenx([-A,A], phi, P+phi, color="y", alpha=0.2)
plt.axvline(P+phi, linestyle="-.", linewidth="0.9", c='k')
plt.annotate('period P', xy=(P+phi, 2*(A/5)), xytext=(P+(P/5)+phi, 0+(A/5)), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)

# third one

A = 1
phi = 1.1
nu = 2.5/ (2*np.pi)
P = 1/nu

y6 = A * np.cos(2*np.pi * nu * x - phi)

plt.subplot(3, 1, 3)

plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, y, linestyle="dotted", label="original")
plt.plot(x, y6, label="random example")
plt.title("$cos(x)$")
plt.legend()

# pointing out A
plt.axhline(A, c='r', linewidth='0.9')
plt.annotate('amplitude A', xy=(2, A), xytext=(3, A-(A/5)), size=15,
            arrowprops=dict(facecolor='red', edgecolor='red', width=0.7, shrink=0.05),)

# pointing out phi
plt.axvline(phi, c='g', linewidth='0.9', linestyle='--')
plt.annotate('phase lag $\phi$', xy=(phi, A-(A/5)), xytext=(-4, A-2*(A/5)), size=15,
            arrowprops=dict(facecolor='green', edgecolor='green', width=0.7, shrink=0.05),)

# pointing out omega
#plt.annotate('$\omega$', xy=(0,0), xytext=(np.pi, A/3), size=35, color='brown')

# pointing out P
plt.fill_betweenx([-A,A], phi, P+phi, color="y", alpha=0.2)
plt.axvline(P+phi, linestyle="-.", linewidth="0.9", c='k')
plt.annotate('period P', xy=(P+phi, 2*(A/5)), xytext=(P+(P/5)+phi, 0+(A/5)), size=15,
            arrowprops=dict(facecolor='black', edgecolor='black', width=0.7, shrink=0.05),)<jupyter_output><empty_output><jupyter_text>I don't understand why in the third plot, the maximum of the new cosine function is not at the number I set for the phase shift... (indicated by the green dashed line)<jupyter_code>#TODO: Why isn't maximum at the phase shift position?<jupyter_output><empty_output><jupyter_text>A sine instead of a cosineSo what is the difference between using a sine or a cosine? As indicated above - nothing really. Except for their phase.Let's redo our plots from above, but this time comparing a sine and a cosine with the same parameters.<jupyter_code># Original plot where all parameters are 1 or 0
c1 = np.cos(x)
s1 = np.sin(x)

# Using random parameters
A = 3.63
phi = 1.5
nu = 1.5 / (2*np.pi)
P = 1/nu

c2 = A * np.cos(2*np.pi * nu * x - phi) 
s2 = A * np.sin(2*np.pi * nu * x - phi) 
# Original plot
plt.figure(figsize=(15, 6))
plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, c1, label="cos(x)")
plt.plot(x, s1, label="sin(x)")
plt.title("Everything the same")
plt.legend()<jupyter_output><empty_output><jupyter_text>We can already see that the phase is different between the two, even if they have the same input for phase, $\phi=0$. The amplitude and frequency are the same though, as we have defined them to be the same.<jupyter_code># Random parameters
plt.figure(figsize=(15, 6))
plt.axhline(0, color='grey', linewidth='0.5')
plt.axvline(0, color='grey', linewidth='0.5')
plt.plot(0, 0, "o", c="k", mfc="white", ms=5)
plt.xlabel("x")
plt.ylabel("f(x)")

plt.plot(x, c2, label="cos(x)")
plt.plot(x, s2, label="sin(x)")
plt.title("Random parameters")
plt.legend()<jupyter_output><empty_output><jupyter_text>In this case too, the two curves are exactly the same - they both have the new amplitude, a new frequency and a new phase. The phase offset between the two has remained the same though, because the difference between the two is that one is a sine and the other a cosine, so we have illustrated that the one is just a $90^{\circ} = \pi/2$ phase offset from the other.$$sin(x) = cos(x - 90^{\circ})$$or$$cos(x) = sin(x + \frac{\pi}{2})$$ For our purposes, this means that we can essentially use them interchangeably - only if we are talking about real signals though! When we deal with complex numbers, it is actually important to know that the cosine is the real part and the sine the imaginary part of a complex number, due to the Euler identity:$$e^{ix} = cos(x) + i sin(x)$$ See also the link to the complex math primer in notebook 1.  Why does this matter?Except for knowing this fundamental math, this is super useful when we are talking about ripples in the pupil of a telescope. Sometimes we will talk about that because we want to put a phase ripple on DM that sits in the pupil plane, because the Fourier transform of that sine/cosine will be a single speckle in the image plane. Note how I call this a "phase ripple" - this is another exampling of recycling words for different things. This phase ripple is a phase because it is a phase $\psi$ in the electric field $E = A e^{i\psi}$, where $\psi$ is a physical quantity that is part of our optical system, as is the amplitude $A$. And with the Euler identity, we can see directly how this phase goes into being the phase of sinusoidal functions:$$E = A e^{i\psi} = cos(\psi) + i sin(\psi)$$But oh... it looks like this $\psi$ is actually the *independent variable* of those sines and cosines, equivalent to the $x$ in all of our examples above.What's going on?This is because the optical phase $\psi$ is actually itself a function of the pupil plane coordinates, which would be in a one-dimensional case: $\psi = \psi(x)$. This means that the optical phase here actually has nothing to do with the phase $\phi$ in the examples of our sinusoids above. It is a function of $x$ that **can** be a sinusoid if we're talking about phase ripples, but it doesn't have to be. Again, this is a point that confused me a lot in the beginning, so I wanted to point it out here. Especially since the standard variable for the **optical phase** is usually $\phi$... You can see where I am going with this.I totally want to find out now what it means to have a **phase shift** on the **optical phase**. Well, let's remind ourselves of the definition of the phase shift we took from the MIT link:"The phase lag (or phase shift) is the value of $\omega x$ for which the graph has its maximum."And since in the case of phase ripples, the optical phase is a sine: $\psi = sin(x)$, if we introduce a phase shift $\phi$, it means that the sinusoidal phase ripples on our pupil plane will literally be shifted by that "phase lag".$$\psi(x) = sin(x + \phi)$$And I guess to finalize this though, yes, this means that the $sin(x)$ that is actually $\psi$ will end up being a sine inside a sine if we look at the complex function that is the E-field:$$E(x) = A e^{i \psi(x)} = A [cos(\psi(x)) + i sin(\psi(x))] = A [cos(sin(x)) + i sin(sin(x))]$$where the **inner** sine is the spatial function which *happens to be* a sine, and the **outer** cosine and sine are the *real and imaginary components* of a complex number. Those are two very different things, although they are mathematically similar. We can nicely see here how the optical phase $\psi$ is a real function (of $x$) and the how the E-field is a complex function (of $x$).I think I want to come back to this when I start talking about 2D functions, which are the actual functions we deal with in imaging. A mathematical phase shift in the spatial sine function is then a left-right shift of the ripple on the DM, while an optical phase difference will be a change in the z-direction of the optical phase.<jupyter_code>#TODO: Ask someone whether my explanation above actually makes sense.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16640107355531325, 'fraction_numerical': 0.028013083955380356, 'mean_word_length': 4.644260355029586, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 56, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '610998', 'license': 'MIT', 'n_tokens_mistral': 8862, 'n_tokens_neox': 8268, 'n_words': 2907, 'path': '02_Sinusoidal functions.ipynb', 'repo_name': 'ivalaginja/FouFourier', 'size': '23846'}