Derive a surface for every body that was never photographed

Fifteen bodies here have a real photograph. Every exoplanet does not, and
never will on current instruments — none has ever been imaged — and nor do
several of the solar system's own moons. Those all shared one crude
stand-in: a few noisy bands tinted by category, cached per colour, so
every exoplanet in the app was literally the same picture.

They now get a surface reasoned from what has actually been measured.

The chain is standard at every link. A host star's luminosity comes from
its catalogued apparent magnitude and its parallax distance — that pair is
exactly an absolute magnitude — plus a bolometric correction for its
spectral class. The correction is not optional: an M dwarf radiates most
of its light in the infrared, so its visual magnitude understates it more
than tenfold, and M dwarfs are what most nearby planet hosts are.
Luminosity and the semi-major axis then give an equilibrium temperature,
mass and radius give a bulk density, and size, temperature and density
together give a class of world.

Checked against the solar system the temperatures land on Earth 255 K,
Jupiter 112 K, Neptune 46 K, all within a kelvin or two of published
values, and 51 Pegasi b comes out at 1227 K against a published 1200.

Each class carries a palette reasoned from its chemistry — methane absorbs
red light, which is why the ice giants are blue — and a structure: zonal
bands for a body with a fluid envelope, because a rapidly rotating
atmosphere organises into them, and fractal terrain for one with a solid
surface. Polar caps grow and shrink with the derived temperature, which is
the clearest visible consequence of the whole chain.

The generator samples three-dimensional noise along the sphere rather than
a flat field, so there is no seam to stitch at the antimeridian and no
pinching at the poles, and it writes into a byte array rather than a
canvas — a pure function, testable, with no 2D context to be unavailable.

Two things the derivation cannot do, both stated on screen next to the
measurements it rests on. Equilibrium temperature ignores greenhouse
warming and internal heat, so Venus comes out at 300 K against a real
surface of 737 K and Io, kept molten by tides, classifies as ice. And
these are illustrations: reasoned, but not observations.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WaySiNst4HhDXBHnMy8p5G
This commit is contained in:
Claude
2026-08-05 06:52:22 +00:00
parent a84e2d3a69
commit ac296f5133
17 changed files with 1566 additions and 92 deletions
+108
View File
@@ -0,0 +1,108 @@
import { describe, expect, it } from 'vitest';
import { absoluteMagnitude, bolometricCorrection, luminositySolar, SOLAR_ABSOLUTE_MAGNITUDE_V, SOLAR_BOLOMETRIC_MAGNITUDE } from './stellar';
/** Real catalogue rows, with the published luminosity each one should reproduce. */
const SIRIUS = { magnitude: -1.44, distancePc: 2.6371, spectralType: 'A0m...', publishedLuminosity: 25.4 };
const VEGA = { magnitude: 0.03, distancePc: 7.68, spectralType: 'A0Vvar', publishedLuminosity: 40 };
const PROXIMA = { magnitude: 11.01, distancePc: 1.2959, spectralType: 'M5Ve', publishedLuminosity: 0.0015 };
const ALPHA_CEN_A = { magnitude: -0.01, distancePc: 1.3247, spectralType: 'G2V', publishedLuminosity: 1.52 };
describe('absoluteMagnitude', () => {
it('is the apparent magnitude at the reference distance of ten parsecs', () => {
expect(absoluteMagnitude(5, 10)).toBeCloseTo(5, 12);
});
it('brightens a star as it is placed further away for the same apparent magnitude', () => {
expect(absoluteMagnitude(5, 100)).toBeLessThan(absoluteMagnitude(5, 10)!);
});
it('reproduces the published absolute magnitude of Sirius', () => {
expect(absoluteMagnitude(SIRIUS.magnitude, SIRIUS.distancePc)).toBeCloseTo(1.45, 1);
});
it('has no answer at zero distance, which in this catalogue is the Sun', () => {
expect(absoluteMagnitude(-26.7, 0)).toBeNull();
expect(absoluteMagnitude(5, -3)).toBeNull();
expect(absoluteMagnitude(Number.NaN, 10)).toBeNull();
});
});
describe('bolometricCorrection', () => {
it('is never positive: a star always radiates outside the V band as well as in it', () => {
for (const type of ['O5V', 'B2V', 'A0V', 'F5V', 'G2V', 'K5V', 'M5V', 'M9V', 'Unknown', '']) {
expect(bolometricCorrection(type)).toBeLessThanOrEqual(0);
}
});
it('is small for the Sun and large for a red dwarf, which is the whole reason it is applied', () => {
// An M dwarf emits most of its light in the infrared: taking its V magnitude at face value
// understates it by more than a factor of ten.
expect(Math.abs(bolometricCorrection('G2V'))).toBeLessThan(0.2);
expect(bolometricCorrection('M5V')).toBeLessThan(-2);
});
it('reproduces the Sun own correction closely enough to close the loop on the zero point', () => {
// The two solar magnitudes differ by exactly this correction, so a solar twin must come out
// at one solar luminosity.
expect(SOLAR_ABSOLUTE_MAGNITUDE_V + bolometricCorrection('G2V')).toBeCloseTo(SOLAR_BOLOMETRIC_MAGNITUDE, 1);
});
it('deepens monotonically from F through M, following the shift into the infrared', () => {
const sequence = ['F0V', 'G0V', 'K0V', 'M0V', 'M5V'].map((type) => bolometricCorrection(type));
for (let index = 1; index < sequence.length; index++) {
expect(sequence[index]).toBeLessThan(sequence[index - 1]);
}
});
it('falls back to a solar correction for an unclassified star rather than inventing one', () => {
expect(bolometricCorrection('Unknown')).toBeCloseTo(bolometricCorrection('G0V'), 6);
expect(bolometricCorrection(undefined)).toBeCloseTo(bolometricCorrection('G0V'), 6);
});
});
describe('luminositySolar', () => {
it('returns exactly one for the Sun, which defines the unit', () => {
expect(luminositySolar({ magnitude: -26.7, distancePc: 0, spectralType: 'G2V' })).toBe(1);
});
it('lands within a factor of two of the published luminosity for real stars', () => {
// The documented tolerance. It is looser than it sounds: equilibrium temperature goes as the
// fourth root of this, so a factor of two is under a fifth in temperature.
for (const star of [SIRIUS, VEGA, PROXIMA, ALPHA_CEN_A]) {
const derived = luminositySolar(star)!;
const ratio = derived / star.publishedLuminosity;
expect(ratio).toBeGreaterThan(0.5);
expect(ratio).toBeLessThan(2);
}
});
it('gets a solar analogue essentially exactly right', () => {
// Alpha Centauri A is the nearest star to a second Sun there is, so this is the case where
// an error would be a mistake rather than a tolerance.
expect(luminositySolar(ALPHA_CEN_A)!).toBeCloseTo(ALPHA_CEN_A.publishedLuminosity, 0);
});
it('orders stars the way their published luminosities do', () => {
const derived = [PROXIMA, ALPHA_CEN_A, SIRIUS, VEGA].map((star) => luminositySolar(star)!);
for (let index = 1; index < derived.length; index++) {
expect(derived[index]).toBeGreaterThan(derived[index - 1]);
}
});
it('applies the bolometric correction rather than taking V at face value', () => {
// Without it a red dwarf comes out more than ten times too dim.
const uncorrected = Math.pow(10, (SOLAR_BOLOMETRIC_MAGNITUDE - absoluteMagnitude(PROXIMA.magnitude, PROXIMA.distancePc)!) / 2.5);
expect(luminositySolar(PROXIMA)!).toBeGreaterThan(uncorrected * 5);
});
it('clamps a pathological record instead of producing an absurd luminosity', () => {
const absurd = luminositySolar({ magnitude: -40, distancePc: 5000, spectralType: 'O5V' })!;
expect(Number.isFinite(absurd)).toBe(true);
expect(absurd).toBeLessThanOrEqual(1e7);
});
it('has no answer for a star with no usable distance', () => {
expect(luminositySolar({ magnitude: 5, distancePc: -1 })).toBeNull();
});
});