Authors: Andy Tzanidakis, James Davenport Date: 02.15.2022 For general questions or inquiries, please reach out to Andy ([email protected])


Motivation


I really loved the introduction text to your homework #3, so if you didn’t get the chance to fully read it, take a moment to read the big picture of this assignment:

To better understand the processes involved in the light we receive from a star, astronomers spend a lot of time modeling stellar atmospheres. The models range from very simple one layer renderings to complex, multi-layer models. From what you have already seen in this course, there's a lot to consider when constructing an accurate model. For example, a good model needs to accurately represent the myriad of opacity contributions, line broadening mechanisms, and various excitation and ionization states of the atoms and molecules in the atmosphere. A good model also needs to include assumptions about the star, like mass, gravity, composition (metallicity), effective temperature, and micro-turbulence, to name a few. High resolution spectra are also required to reveal the intricate line structure to be modeled. In this exercise you will study spectral line formation in simple one-and two-layer model atmospheres of the Sun. With the use of the provided Python script, you will vary the parameters of the “toy model” atmospheres that determine the emergent line profiles and describe what the various parameters reveal about the Sun. You will plot various profile fits (the fits to the absorption profiles of the spectral lines), after varying the parameters to get the best fit possible. The goal of this exercise is to investigate how the emergent intensity of light through a medium is modified from its original form (the source function) by that medium. We’ll be assuming a Plank (blackbody) function for the initial intensity, imposing a Voigt profile for the opacity, and passing our simple one- and two-layer model atmospheres. The part of the assignment that has you manipulate Voigt profiles will require you to do a little research on them and the significance of both the Gaussian & Lorentzian contributions to the profile to understand how best to manipulate the parameters and how to interpret your results.

TL;DR: Solutions— 😤


Let me first start by importing all my favorite packages for this assignment

import numpy as np
from astropy.io import ascii
import matplotlib.pyplot as plt
from tqdm import tqdm
from scipy.special import wofz
from scipy.optimize import curve_fit

# Pretty plots
from matplotlib import rcParams
from astropy.io import ascii
rcParams["savefig.dpi"] = 100
rcParams["font.size"] = 20
%matplotlib inline
%config InlineBackend.figure_format = "retina"

import astropy.units as u
import astropy.constants as constant
import os

To produce the following plots:

x = np.linspace(-15, 15, 500)
plt.figure(figsize=(5,5))
inc = 0
for i in np.linspace(0.01, 10, 10):
    plt.plot(x, V(x, i, 1), color=j(0.1*i))
    plt.text(7, max(V(x, 0.01, 1))-inc-.01, color=j(0.1*i), s=f"α={i.round(1)}", size=12)
    inc += 0.02
plt.xlim(-15, 15)
plt.ylim(0)
plt.title("Vogit(α, 1)")
plt.xlabel("X")
plt.ylabel("PDF")

Seen in the diagram below, we can make a few observations and distinctions between a Voigt and Cauchy distributions as we tune the $\alpha$ and $\gamma$ parameters of each distribution:

Fig. 1A — Voigt distribution) for increasing/decreasing values of $\alpha$

Fig. 1A — Voigt distribution) for increasing/decreasing values of $\alpha$

Fig 1B — Cauchy distribution (i.e Lorentzian) for increasing/decreasing values of $\gamma$

Fig 1B — Cauchy distribution (i.e Lorentzian) for increasing/decreasing values of $\gamma$

What’s the Deal with the Voigt Profile?