Backfill missing quantities + hand-written log-scale companions (SPL/SIL/SWL/DI/pH)#92
Merged
Merged
Conversation
…from main
New generated dimensions: Permittivity (F/m), ElectricConductivity (S/m),
ElectricFlux (V·m, with ElectricField x Area relationship),
ElectricPowerDensity (W/m³, with x Volume => Power), Sensitivity (V/Pa,
with x Pressure => Voltage), ThermalResistance (K/W), RateConstant (s⁻¹),
Luminance (cd/m², Nit, FootLambert, with x Area => LuminousIntensity),
and the psychoacoustic Loudness (sone) and Sharpness (acum).
New semantic overloads: Impedance on Resistance (mirrors Admittance on
Conductance), SoundPressure on Pressure, SoundPower on Power,
SoundAbsorption / NoiseReductionCoefficient / SoundTransmissionClass on
Ratio, and the signed ReflectionCoefficient on SignedRatio.
Also fixes two latent metadata bugs:
- Luminance was modelled as an overload of Illuminance; lux (light
arriving) and cd/m² (light leaving) are different quantities, so the
overload is replaced by the proper Luminance dimension.
- The generator emits an identity factory for the first availableUnits
entry, but Concentration listed Molar (x1000) and NuclearCrossSection
listed Barn (x1e-28) first, so From{Base} and In(unit) disagreed about
the storage unit. Both now lead with the true SI base unit
(MolePerCubicMeter, SquareMeter); FromMolars and FromBarns now scale
into SI storage as documented.
RateConstant deliberately has no Time integral: Frequency already owns
Ratio / Duration, and a second result type for the same operands cannot
compile.
https://claude.ai/code/session_01AUgbNJjDBDCwcbUfPK3pGW
Locks in the log-scale decision: decibel and pH scales don't obey linear arithmetic, so they are self-contained record structs (like the audio-engineering types) that convert to and from their linear generated counterparts, not dimensions.json entries. - SoundPressureLevel (dB re 20 µPa) <-> SoundPressure - SoundIntensityLevel (dB re 1e-12 W/m²) <-> SoundIntensity - SoundPowerLevel (dB re 1e-12 W) <-> SoundPower - DirectionalityIndex (dB) <-> intensity Ratio - PH <-> hydrogen-ion Concentration (plus pOH and acidity checks) Documented as resolved design decision #5 in CLAUDE.md. https://claude.ai/code/session_01AUgbNJjDBDCwcbUfPK3pGW
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Steps 3 and 4 of the parity plan: the quantities main had that vectors lacked, plus the log-scale architecture decision and its implementation.
New generated dimensions (10)
PermittivityElectricConductivityElectricFluxElectricField × Area => ElectricFluxElectricPowerDensity× Volume => PowerSensitivity× Pressure => Voltage(mic sensitivity)ThermalResistanceRateConstantRatio / Durationis already owned byFrequency; a second result type for the same operands can't compileLuminance× Area => LuminousIntensityLoudnessSharpnessNew semantic overloads
ImpedanceonResistance(mirrorsAdmittanceonConductance— Ohm's law works through widening),SoundPressureonPressure,SoundPoweronPower,SoundAbsorption/NoiseReductionCoefficient/SoundTransmissionClassonRatio, and signedReflectionCoefficientonSignedRatio.Log-scale decision (now resolved design decision #5 in CLAUDE.md)
Decibel and pH scales don't obey linear arithmetic, so they're hand-written companions (in the style of the audio-engineering types), not generated dimensions:
SoundPressureLevel(dB re 20 µPa) ⇄SoundPressureSoundIntensityLevel(dB re 10⁻¹² W/m²) ⇄SoundIntensitySoundPowerLevel(dB re 10⁻¹² W) ⇄SoundPowerDirectionalityIndex(dB) ⇄ intensityRatioPH⇄ hydrogen-ionConcentration, plusToPOH()and acidity checksAll reference values come from the
PhysicalConstantsdomains added in #90.Two latent metadata bugs fixed
Luminancewas an overload ofIlluminance— lux (light arriving at a surface) and cd/m² (light leaving one) are different quantities with different units. Replaced by the properLuminancedimension.availableUnitsentry, butConcentrationled withMolar(×1000) andNuclearCrossSectionwithBarn(×10⁻²⁸), soFromMolars/FromBarnsstored non-SI values whileIn(unit)assumed SI storage. Both dimensions now lead with the true SI base (MolePerCubicMeter,SquareMeter), making factories andIn()agree —FromMolars(1)now stores 1000 mol/m³ as documented.Remaining parity gap
With this PR the quantity-type parity audit is complete: every type main had now exists on vectors (as a generated dimension/overload, a log-scale companion, or a deliberate rename). Next step is release prep (2.0.0, package-validation baseline, migration guide).
Testing
QuantityBackfillTests): factories and operators for every new dimension, overload widening (incl. Ohm's law throughImpedance), round-trips for all five log-scale types, pH chemistry.Microsoft.CodeAnalysis.CSharp5.3.0 requires a compiler this container doesn't have, so local verification was done with a temporarily pinned 4.12.0 (not committed). CI's toolchain builds 5.3.0 natively.https://claude.ai/code/session_01AUgbNJjDBDCwcbUfPK3pGW
Generated by Claude Code