The Spooky Spectral

Jed Rembold

February 2, 2026

Announcements

  • Homework 2 due tonight!
  • Homework 1 feedback went out over the weekend!
  • Debriefing form coming your way by end of tomorrow.
  • Starting Unit 2: Stars today!
    • Homework 3 will be posted by end of day
    • New partners! Giving you some time at the end of class today to touch base with them

Today’s Plan

  • What is light?
  • The electromagnetic spectrum
  • Black Bodies and Planck’s Law
    • Wien’s Law
    • Fitting

What is Light?

How do we see?

  • We see an object when light from that object reaches our eyes
    • Either because the object itself emits light
    • Or because that object reflected light

Some Light Processing

  • We get two pieces of information:
    • The direction the light enters the eyes gives us positional information
    • The color of the light gives us information about the composition of the light

This thing is yellow!This thing is red!

Tricks of Light

  • A single image gives no distance information
  • Light can bend, which can confuse your brain

The Electromagnetic Spectrum

But what IS it?

  • Light is, first and foremost, a wave
    • Similar to an ocean wave, in that it travels in a direction
    • Affects both electric charges and magnets “floating” atop itself
      • Accordingly referred to as an electromagnetic wave

Properties of Waves

  • All light waves move at the speed of light, \(c\): \[ c = 3\times 10^8 \text{ m/s}\]
  • Amplitude corresponds to brightness
  • Wavelength corresponds to color or portion of spectrum

The Rainbow

You’re (Mostly) Blind!

Everything the light touches…

  • The general term electromagnetic radiation describes all the wavelengths of electromagnetic waves, not just the visible ones we generally refer to as “light”
  • Everything that emits or reflects radiation we can observe
  • The visible bits are just a tiny fraction of the huge spectrum of possibilities
  • Gives rise to different forms of astronomy:
    • Optical
    • Radio
    • Microwave
    • High Energy (Gamma/X Ray)

Black Bodies

Recipe: How to make some light

  • How does one produce electromagnetic radiation?
    • Microscopically: by accelerating electric charges
    • Macroscopically: by making something hot
      • By “hot” we just really mean “not 100% cold”…
      • Heat excites the particles, bouncing them around and thus accelerating charges
  • What wavelengths are emitted depends on the object’s temperature
    • Hot objects produce more radiation, so greater amplitudes overall
    • Hot objects produce more radiation at shorter wavelengths

A Shining Example

  • The color of a star depends on its temperature!
  • Brightness also depends on the temperature, but is also dependent on the star’s size and distance from us

Planck’s Law

  • The brightness at a given wavelength emitted from a body in thermal equilibrium at some temperature is governed by Planck’s Law: \[ B(\lambda, T) = \frac{2hc^2}{\lambda^5} \frac{1}{\exp\left(\frac{hc}{\lambda k_B T}\right) - 1} \] where \[ \begin{aligned} h &= 6.6261 \times 10^{-34} \text{ J}\cdot\text{s}\\ c &= 3\times10^8 \text{ m/s} \\ k_B &= 1.381 \times 10^{-23} \text{ J/K}\\ \lambda &= \text{wavelength in meters} \\ T &= \text{temperature in kelvin} \end{aligned} \]

Planck’s Law Visualized

Nothing is Perfect

  • Most things are not perfectly in thermal equilibrium, which will reduce the amount of radiation
  • How well an object radiates is called its emissivity (\(\varepsilon\))
  • Reduces the amount of radiation, but doesn’t change wavelengths
    • Does mean that often you’ll have an extra unknown parameter though \[ B(\lambda, T) = \varepsilon \cdot \frac{2hc^2}{\lambda^5} \frac{1}{\exp\left(\frac{hc}{\lambda k_B T}\right) - 1} \]

Wien’s Law

  • Wien’s Law relates the wavelength at the peak of the spectral black body curve to a temperature
  • Can be useful if you only care about the temperature, and can observe the peak of the curve
  • Has a very simple expression: \[ \lambda_{peak} = \frac{2.8977\times10^{-3}\text{ m}\cdot\text{K}}{T} \] in standard units, where \(T\) is measured in kelvin

Nonlinear Fitting

Fitting Planck

  • A spectra is an observable quantity
    • Even if the star is far away so that it’s brightness is lower, that just scales down the entire curve
  • Spectra can thus be used to determine the approximate temperature of stars though either:
    • Use of Wien’s Law
    • Fitting Plancks law directly
  • Use of Wien’s Law is usually simpler, but there can be times when you need to fit the entire blackbody curve
    • Requires a nonlinear fit, but can still be done using common least squares algorithms (at least for the precision we need here)

Least Squares Nonlinear Fitting (Python)

  • In Python, you want curve_fit from scipy.optimize for this probably (docs here)
  • Need to define the function you want to fit, where the first parameter is the independent variable, and subsequent parameters are any desired fit parameters
    • For Planck’s law, that means wavelength is the first parameter, and amplitude and temperature the second
  • When using curve_fit need to provide:
    • The function name you want to fit
    • The xdata
    • The ydata
    • An initial guess for any fit parameters (else starts at 1)

Least Squares Nonlinear Fitting (R)

  • In R, you’ll likely want to use the nls function

  • Give it a formula, using the column names where appropriate:

    brightness ~ A / wavelength^5 ...
  • Specify what dataframe you are pulling the column names from:

    data=df
  • Need to provide a list of starting values for the parameters

    start = list(e=100, T=1000)

Fitting Demos

  • For a demonstration, we are going to use the data here
    • Noisy black body data with some general reduction in brightness
    • Want to fit both the temperature and the emissivity
  • We can compare our fits to what we’d have gotten from Wein’s law

New Groups!

New Unit, new Groups

  • While you may still be finishing up HW2 with your past partners, I wanted to make you aware of the new partnerships, so that you can make arrangements for this week
  • Rebecca and KJ
  • Mac and Ben
  • Kaylee and Jack
  • Yumi and Aby
  • Cordelia and Florian
  • Saul and Deana
  • Liam and Maiti
  • Morgyn and Cody
  • Laken, Normandy, and Lev
// reveal.js plugins // Added plugins ,