Pin the M giants' corrections from M4 on, a colour off the table, and a phone held sideways

Three rules the suite passed without, each a test only:

- ef20991 credits its M-giant corrections with M4 going from 0.82 to 1.00 of van Belle's measured
  radii and M5 from 0.71 to 1.00, but only its M6 entry was tested. Reverting M0-M5.5 to the
  dwarf's correction, the M4 or M5 entry to the dwarf's, or the M7.5 entry to M6's, all passed; so
  did reading the table's first entry past its end, which six M8 III stars in the catalogue take
  (28 times too faint, 5.3 times too small). stellar.spec now draws three of van Belle's own
  giants, HD 118669 (M4), HD 104207 (M5) and HIP 68357 (M7), from their median Johnson V, parallax
  and radius in his tables 6 and 4, none behind more than 0.02 mag of dust. They come out at 1.00,
  1.00 and 0.91 of their measured 103.1, 103.2 and 173.3 R; the window is 15 %, since the
  dwarf's correction at M4 only moves the radius by 18 %. And M8 III takes M7.5 III's correction.
- 6a45c91 says a derived radius came "from its type" for a dwarf whose colour the table does not
  read, but no case had one. star-readouts.spec adds HD 49748, G5 V at B-V -0.32; 26 cards in the
  catalogue read this way.
- The phone framing test used a portrait canvas, where the width is the shorter side. A landscape
  one, 844x390, now expects the camera at the framing the 390 px side gives.

Guarded mutants, each failing only the test named, 1 of 837: M0-M5.5 on the dwarf's correction
(`index < 72`); M4 entry -2.2 -> -1.78; M5 entry -2.68 -> -2.025; M7.5 entry -4.86 -> -3.94; past
the end, the first entry (all "draws van Belle's own M4, M5 and M7 giants..."); any colour counted
as read ("says a radius was derived, and from what..."); shorterSidePx the canvas width ("frames
it by the shorter side on a phone held sideways too").

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-30 21:45:46 +02:00
co-authored by Claude Opus 5.5
parent 74913d844d
commit 0f659af5b3
3 changed files with 35 additions and 0 deletions
@@ -1132,6 +1132,18 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => {
expect(engine.getCamera().position.length()).toBeCloseTo(onPhone, 6);
});
it('frames it by the shorter side on a phone held sideways too', async () => {
// 844x390: framed by the width, the disc took the desktop's half again, 8.49 AU out, not 14.97.
const canvas = (fixture.nativeElement as HTMLElement).querySelector('canvas')!;
Object.defineProperty(canvas, 'clientWidth', { value: 844 });
Object.defineProperty(canvas, 'clientHeight', { value: 390 });
const scene = await enter(ANTARES);
const camera = engine.getPerspectiveCamera();
const gridOuterRadiusAu = (scene.systemRenderer as unknown as { gridOuterRadiusAu: number }).gridOuterRadiusAu;
const radius = scene.starMarkerGeometry.parameters.radius;
expect(engine.getCamera().position.length()).toBeCloseTo(systemFramingDistanceAu(gridOuterRadiusAu, { fovDegrees: camera.fov, aspect: camera.aspect, shorterSidePx: 390 }, radius), 6);
});
it('draws a star nothing gives a size or temperature for as a grey point, not as the Sun', async () => {
const scene = await enter(PROCYON_B);
expect(scene.starMarkerGeometry.parameters.radius).toBeLessThan(SUN_RADIUS_AU / 1000);
@@ -93,6 +93,9 @@ describe('starReadouts', () => {
expect(value(starReadouts(betelgeuse, { radiusSolar: 584.3, radiusDerived: true, temperatureK: 3590, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~580 solar radii, from its type and brightness');
const gj3655 = { ...HYG_STAR, name: 'GJ 3655', spectralType: 'M8', colorIndex: null, colorSystem: undefined };
expect(value(starReadouts(gj3655, { radiusSolar: 0.106, radiusDerived: true, temperatureK: 2570, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~0.11 solar radii, from its type and brightness');
// Nor a dwarf's whose colour is off the table: HD 49748, G5 V at B−V −0.32.
const hd49748 = { ...HYG_STAR, name: 'HD 49748', spectralType: 'G5V', colorIndex: -0.32 };
expect(value(starReadouts(hd49748, { radiusSolar: 1.2, radiusDerived: true, temperatureK: 5660, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~1.2 solar radii, from its type and brightness');
const kepler445 = { ...HYG_STAR, spectralType: 'M4', colorIndex: 1.66, colorFromTemperature: true, source: 'exoplanet-archive' };
expect(value(starReadouts(kepler445, { radiusSolar: 0.21, radiusDerived: true, temperatureK: 3157, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~0.21 solar radii, from its temperature and brightness');
expect(value(starReadouts(HYG_STAR, { radiusSolar: 1, radiusDerived: false, temperatureK: 5772, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('1.00 solar radii');
+20
View File
@@ -5,6 +5,7 @@ import {
blackbodyColor,
bolometricCorrection,
effectiveTemperatureK,
giantSurface,
luminositySolar,
radiusFromLuminositySolar,
SOLAR_ABSOLUTE_MAGNITUDE_V,
@@ -161,6 +162,25 @@ describe('luminositySolar', () => {
}
});
it("draws van Belle's own M4, M5 and M7 giants at their measured radii, and holds the correction past M7.5", () => {
// Median Johnson V, parallax and radius from van Belle et al. (2021) tables 6 and 4, none behind
// more than 0.02 mag of dust: 103.1, 103.2 and 173.3 R☉, drawn at 1.00, 1.00 and 0.91 of that.
// A dwarf's correction draws M4 18 % smaller and M5 26 %, and M6's −3.94 draws M7 25 % smaller;
// hence 15 %, not the M6 case's 20 %.
const giants = [
[{ magnitude: 7.72, distancePc: 1000 / 1.87, spectralType: 'M4III', magnitudeBand: 'V' }, 103.11], // HD 118669
[{ magnitude: 6.97, distancePc: 1000 / 3.45, spectralType: 'M5III', magnitudeBand: 'V' }, 103.15], // HD 104207
[{ magnitude: 9.29, distancePc: 1000 / 2.17, spectralType: 'M7III', magnitudeBand: 'V' }, 173.31] // HIP 68357
] as const;
for (const [star, measured] of giants) {
const radius = radiusFromLuminositySolar(luminositySolar(star)!, effectiveTemperatureK(star)!);
expect(radius / measured).toBeGreaterThan(1 / 1.15);
expect(radius / measured).toBeLessThan(1.15);
}
// Six M8 III stars in the catalogue, past the table's last type, take its −4.86, not its first.
expect(giantSurface('M8III')!.bolometricCorrectionV).toBe(giantSurface('M7.5III')!.bolometricCorrectionV);
});
it('reads a hot giant reddened by dust at its type, not at the cool star its colour reads as', () => {
// Menkib, O7.5 Iab at B−V 0.02: 14 R☉ (Krtička & Kubát 2010). At its colour's 9 517 K and its
// type's correction it was drawn at 95; the dust it is behind still leaves it dimmer than it is.