Spectral Class Estimator Formula

Understand the math behind the spectral class estimator. Each variable explained with a worked example.

Formulas Used

Spectral Class Code

class_number = (temperature > 30000) * 7 + (temperature > 10000) * (temperature <= 30000) * 6 + (temperature > 7500) * (temperature <= 10000) * 5 + (temperature > 6000) * (temperature <= 7500) * 4 + (temperature > 5200) * (temperature <= 6000) * 3 + (temperature > 3700) * (temperature <= 5200) * 2 + (temperature <= 3700) * 1

Peak Wavelength

peak_nm = 2.8978e6 / temperature

Variables

VariableDescriptionDefault
temperatureEffective Temperature(K)5778

How It Works

Spectral Classification (OBAFGKM)

Stars are classified by surface temperature into spectral types:

| Class | Temperature Range | Colour | |-------|------------------|--------| | O | > 30 000 K | Blue | | B | 10 000 - 30 000 K | Blue-white | | A | 7 500 - 10 000 K | White | | F | 6 000 - 7 500 K | Yellow-white | | G | 5 200 - 6 000 K | Yellow | | K | 3 700 - 5 200 K | Orange | | M | < 3 700 K | Red |

The output code: 7=O, 6=B, 5=A, 4=F, 3=G, 2=K, 1=M.

Worked Example

The Sun at 5778 K.

temperature = 5778
  1. 015778 K falls between 5200 and 6000 K.
  2. 02Spectral class: G (code 3)
  3. 03Peak wavelength: 2897800 / 5778 = 501.5 nm (green)
  4. 04The Sun is a G2V star.

Ready to run the numbers?

Open Spectral Class Estimator