nx_skinspectra_lib.nx
buildroot/runtime/nx_skinspectra_lib.nx
about
nx_skinspectra_lib.nx -- MEASURED ABSORPTION SPECTRA, PARSED NOT TRANSCRIBED (2026-09-03, rung ST6)
WHY PARSING AND NOT A TABLE OF CONSTANTS. Every coefficient on /compare/skintwin was a PROBE VALUE, and
pinning the published spectra was supposed to fix that. It nearly fixed it the wrong way: the obvious move
is to read the mirrored table and copy numbers into a conf. That is transcription, and transcription is
exactly the failure this rung exists to remove -- MEASURED THE SAME DAY, the probe melanin coefficients
carried a blue-to-red ratio of 5.0 against the published law's 2.72, so the shape was right and the slope
was 1.8x too steep. A number typed by hand is a number that can be wrong. A number parsed out of a
sha-pinned mirror is the mirror's responsibility.
SO THE ONLY VALUES TYPED HERE ARE THE ONES THE PUBLISHED LAW ITSELF STATES -- 1.70, the decade count 12,
the exponent 3.48, and the source's own conversion constants 2.303 and 64500 -- each written as it appears
in the source rather than pre-multiplied. The haemoglobin numbers are never typed at all; they are read
from the mirror at run time.
SOURCES, BOTH MIRRORED AND PINNED (skintwin.refs):
MELANIN [@omlc_mel] Jacques and McAuliffe 1987; Jacques, Glickman and Schwartz 1996. Melanosome
absorption measured by the threshold for explosive vaporization under pulsed lasers.
Fitted spectrum for skin: mua = 1.70e12 * lambda^-3.48 [cm-1], lambda in nm.
HAEMOGLOBIN [@omlc_hb] Prahl, compiled from Gratzer (MRC Labs, London) and Kollias (Wellman Labs,
Harvard Medical School). Tabulated MOLAR EXTINCTION e in [cm-1/(moles/litre)], converted by
the source's own formula mua = 2.303 * e * x / 64500, x in grams of haemoglobin per litre.
THE PREFACTOR IS A DISTRIBUTION, NOT A CONSTANT, AND THE SOURCE SAYS SO IN ITS OWN WORDS: "The
concentration of melanin within melanosomes is quite variable. Ten-fold variation is to be expected."
So ss_melanin_mua returns the LAW at unit concentration and takes concentration as a caller argument. A
lib that folded a tenfold-variable quantity into a fixed coefficient would publish a constant wearing a
measurement's clothes.
NUMERICAL NOTE THAT MATTERS: 1.70e12 is far outside Q30 and must never exist as a value. mua is computed
as ONE exponential of (ln 1.70 + 12 ln 10 - 3.48 ln lambda), so the huge prefactor is never materialised
and the result lands in range at every visible wavelength. MEASURED: 993.73 / 494.30 / 365.16 per cm at
450 / 550 / 600 nm, and the prefactor-free ratio reproduces (600/450)^3.48 = 2.721365 EXACTLY.
license_tier: ORIGINAL No hw writes (Rule 26). LIB (no main).
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_fixq30_lib.nx
imported by: nx_skinspectra_gate.nx
structs
| none |
consts
| 38 | const SS_REFUSED: i64 = 0 - 1 |
| 40 | const SS_MEL_PREFACTOR_MILLI: i64 = 1700 // 1.70, carried at 1/1000 |
| 41 | const SS_MEL_DECADES: i64 = 12 // the 10^12 |
| 42 | const SS_MEL_EXP_MILLI: i64 = 3480 // 3.48, carried at 1/1000 |
| 43 | const SS_MILLI: i64 = 1000 |
| 44 | const SS_TEN: i64 = 10 |
| 46 | const SS_HB_LN10_MILLI: i64 = 2303 // 2.303, carried at 1/1000 |
| 47 | const SS_HB_GRAM_MOLE: i64 = 64500 // grams per mole of haemoglobin, stated by the source |
| 50 | const SS_LAMBDA_MIN: i64 = 250 |
| 51 | const SS_LAMBDA_MAX: i64 = 1000 |
| 52 | const SS_BOX: i64 = 8 |
| 53 | const SS_DIG0: i64 = 48 |
| 54 | const SS_DIG9: i64 = 57 |
| 55 | const SS_SPACE: i64 = 32 |
| 56 | const SS_TABCH: i64 = 9 |
| 57 | const SS_NL: i64 = 10 |
functions
| 60 | func ss_melanin_mua(fq: *i64, lambda_nm: i64) -> i64 |
| 71 | func ss_melanin_mua_at(fq: *i64, lambda_nm: i64, conc: i64) -> i64 |
| 79 | func ss_hb_mua(e_molar: i64, grams_per_litre: i64) -> i64 called by 1: main |
| 87 | func ss_int_at(buf: *u8, n: i64, p: i64, box: *i64) -> i64 called by 1: ss_hb_lookup |
| 115 | func ss_skip_ws(buf: *u8, n: i64, p: i64) -> i64 called by 1: ss_hb_lookup |
| 133 | func ss_line_end(buf: *u8, n: i64, p: i64) -> i64 called by 1: ss_hb_lookup |
| 150 | func ss_hb_lookup(path: *u8, lambda_nm: i64, out2: *i64) -> i64 |