Give a star no survey measured no luminosity, so its planets get no temperature from a stand-in
luminosityOf derived a luminosity from any magnitude, including the stand-in the ETL writes for the 309 stars with neither a V nor a G. starSurfaceOf already refused it for the radius; the card, the system view's planet appearances and the body pages did not. The 265 archive hosts among them came out at a median 33 L☉: KMT-2016-BLG-1107L, a 0.087 M☉ star, at 36.8, and OGLE-2005-BLG-390L b, published at about 50 K, read 388 K and a sub-Neptune. Their cards printed "Magnitude: Not measured" beside a luminosity derived from that magnitude. The guard now sits in luminosityOf, which every caller goes through, so the one in starSurfaceOf is gone. The Sun keeps its 1 whatever band it is filed under. Measured on the shipped catalogue: of the 275 planets on those 265 hosts, 268 had an equilibrium temperature and 0 now do; before the archive stars were added they had no host, and so none either. Controls: without the guard, "has none from a magnitude no survey measured, and gives its planets no temperature from it" fails (with the radius test beside it, 2 of 777); without the Sun's exemption, "is 1 for the Sun, whatever its magnitude is filed under" fails (1 of 777). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest';
|
|||||||
import { BodyRecord, OrbitalElements } from '../../shared/models/body.model';
|
import { BodyRecord, OrbitalElements } from '../../shared/models/body.model';
|
||||||
import { ExoplanetRecord } from '../../shared/models/exoplanet.model';
|
import { ExoplanetRecord } from '../../shared/models/exoplanet.model';
|
||||||
import { StarRecord, SUN_STAR_ID } from '../../shared/models/star.model';
|
import { StarRecord, SUN_STAR_ID } from '../../shared/models/star.model';
|
||||||
import { buildBodyViewModel, heliocentricPeriodDays, starSurfaceOf } from './body-view-model';
|
import { buildBodyViewModel, heliocentricPeriodDays, luminosityOf, starSurfaceOf } from './body-view-model';
|
||||||
|
|
||||||
const orbit = (overrides: Partial<OrbitalElements> = {}): OrbitalElements => ({
|
const orbit = (overrides: Partial<OrbitalElements> = {}): OrbitalElements => ({
|
||||||
semiMajorAxisAu: 1,
|
semiMajorAxisAu: 1,
|
||||||
@@ -123,6 +123,23 @@ describe('buildBodyViewModel', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('luminosityOf', () => {
|
||||||
|
// KMT-2016-BLG-1107L as the ETL adds it from the archive: no V, no G, so the stand-in 15.
|
||||||
|
const lens: StarRecord = { id: 1070000536, name: 'KMT-2016-BLG-1107L', x: 6651, y: 0, z: 0, magnitude: 15, spectralType: 'Unknown', colorIndex: null, source: 'exoplanet-archive' };
|
||||||
|
const lensB: ExoplanetRecord = { id: 'lens-b', hostStarId: lens.id, hostStarName: lens.name, name: 'KMT-2016-BLG-1107L b', orbit: { semiMajorAxisAu: 0.342 } };
|
||||||
|
|
||||||
|
it('has none from a magnitude no survey measured, and gives its planets no temperature from it', () => {
|
||||||
|
expect(luminosityOf(lens)).toBeNull();
|
||||||
|
expect(buildBodyViewModel('lens-b', { bodies: [], exoplanets: [lensB], stars: [lens] })?.appearance.equilibriumTemperatureK).toBeNull();
|
||||||
|
// The same figure measured in V is a star, 37 L☉ at that distance.
|
||||||
|
expect(luminosityOf({ ...lens, magnitudeBand: 'V' })).toBeCloseTo(36.8, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is 1 for the Sun, whatever its magnitude is filed under', () => {
|
||||||
|
expect(luminosityOf(sun)).toBe(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('starSurfaceOf', () => {
|
describe('starSurfaceOf', () => {
|
||||||
// Proxima Centauri as HYG describes it, and one of its planets' archive rows.
|
// Proxima Centauri as HYG describes it, and one of its planets' archive rows.
|
||||||
const proxima: StarRecord = { id: 70666, name: 'Proxima Centauri', x: 1.2959, y: 0, z: 0, magnitude: 11.01, magnitudeBand: 'V', spectralType: 'M5Ve', colorIndex: 1.807, colorSystem: 'B-V' };
|
const proxima: StarRecord = { id: 70666, name: 'Proxima Centauri', x: 1.2959, y: 0, z: 0, magnitude: 11.01, magnitudeBand: 'V', spectralType: 'M5Ve', colorIndex: 1.807, colorSystem: 'B-V' };
|
||||||
|
|||||||
@@ -18,9 +18,14 @@ export interface BodyCatalogues {
|
|||||||
* Bolometric luminosity of a star in solar units, from what the catalogue measured: apparent
|
* Bolometric luminosity of a star in solar units, from what the catalogue measured: apparent
|
||||||
* magnitude in its band, parallax distance, and a bolometric correction read off the colour, or
|
* magnitude in its band, parallax distance, and a bolometric correction read off the colour, or
|
||||||
* off the spectral type where there is no colour.
|
* off the spectral type where there is no colour.
|
||||||
|
*
|
||||||
|
* None where no survey measured the star and its magnitude is the ETL's stand-in, which is all
|
||||||
|
* 309 stars without a band have. The 265 archive hosts among them came out at a median 33 L☉
|
||||||
|
* from it, KMT-2016-BLG-1107L, a 0.087 M☉ star, at 37, and OGLE-2005-BLG-390L b, published at
|
||||||
|
* about 50 K, read 388 K. The Sun is the unit, whatever its magnitude is filed under.
|
||||||
*/
|
*/
|
||||||
export function luminosityOf(star: StarRecord | undefined): number | null {
|
export function luminosityOf(star: StarRecord | undefined): number | null {
|
||||||
return star ? luminositySolar(photometryOf(star)) : null;
|
return star && (star.magnitudeBand || star.id === SUN_STAR_ID) ? luminositySolar(photometryOf(star)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function photometryOf(star: StarRecord): StellarPhotometry {
|
function photometryOf(star: StarRecord): StellarPhotometry {
|
||||||
@@ -60,9 +65,9 @@ export function starSurfaceOf(star: StarRecord, planets: readonly ExoplanetRecor
|
|||||||
if (measured) {
|
if (measured) {
|
||||||
return { radiusSolar: measured, radiusDerived: false, temperatureK };
|
return { radiusSolar: measured, radiusDerived: false, temperatureK };
|
||||||
}
|
}
|
||||||
// Not from the ETL's stand-in magnitude, which is all 309 stars without a band have: PSR
|
// None from a stand-in magnitude: PSR J1719-1438 came out 2.3 solar radii, wider than its
|
||||||
// J1719-1438 came out 2.3 solar radii, wider than its planet's orbit.
|
// planet's orbit.
|
||||||
const luminosity = star.magnitudeBand ? luminosityOf(star) : null;
|
const luminosity = luminosityOf(star);
|
||||||
return {
|
return {
|
||||||
radiusSolar: luminosity !== null && temperatureK !== null ? radiusFromLuminositySolar(luminosity, temperatureK) : null,
|
radiusSolar: luminosity !== null && temperatureK !== null ? radiusFromLuminositySolar(luminosity, temperatureK) : null,
|
||||||
radiusDerived: true,
|
radiusDerived: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user