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) * 1Peak Wavelength
peak_nm = 2.8978e6 / temperatureVariables
| Variable | Description | Default |
|---|---|---|
temperature | Effective Temperature(K) | 5778 |
How It Works
Spectral Classification (OBAFGKM)
Stars are classified by surface temperature into spectral types:
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
- 015778 K falls between 5200 and 6000 K.
- 02Spectral class: G (code 3)
- 03Peak wavelength: 2897800 / 5778 = 501.5 nm (green)
- 04The Sun is a G2V star.
Frequently Asked Questions
What does OBAFGKM stand for?
The mnemonic "Oh Be A Fine Guy/Girl, Kiss Me" helps remember the order from hottest to coolest.
What are the subclasses (0-9)?
Each letter class is divided into 10 subclasses (0 = hotter, 9 = cooler). The Sun is G2, meaning near the hot end of the G class.
What about L, T, and Y classes?
These extend the sequence below M for brown dwarfs: L (1300-2000 K), T (500-1300 K), Y (< 500 K).
Ready to run the numbers?
Open Spectral Class Estimator