feat(kode): add the levelised equations, the parameter reader and the draws

One pure function per equation for chapters 1 to 3 of the specification
(S1-S21, S36, S43-S47), a strict reader for the frozen parameter file with
checksum, validation and unit conversion, and the 10 000 Monte Carlo draws of
the 87 drawn quantities, stored in data/ and reproducible bit for bit.

Tests: unit tests and edge cases per equation, the reader, the draws, and
known answers from Argonne, NOU 2026: 4, Epoch and NVE with the sources' own
assumptions. Five comparisons miss the 5 % tolerance and are kept as strict
expected failures with the measured deviation. No result for the hypothesis
is computed. ruff ALL and mypy strict pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-11-12 10:08:47 +01:00
commit a63f66c416
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
14 changed files with 3656 additions and 0 deletions

59
pyproject.toml Normal file
View file

@ -0,0 +1,59 @@
# Tool configuration only. The pinned versions live in requirements.txt (runtime)
# and requirements-dev.txt (tests and checks); the code is run from src/ without
# being installed.
[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]
addopts = "-ra --strict-markers"
markers = [
"fasit: reproduces a published number with the source's own assumptions",
]
[tool.mypy]
strict = true
mypy_path = "src"
files = ["src", "tests"]
python_version = "3.11"
[tool.ruff]
line-length = 100
target-version = "py311"
src = ["src", "tests"]
# Text files (sources, specification, pre-registration) are never touched by the formatter.
extend-exclude = ["*.md"]
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Formatter conflicts (ruff's own recommendation).
"COM812",
"ISC001",
# Docstring style: Google convention is selected below; these two contradict it.
"D203",
"D213",
# Argument and variable names follow the symbols of the specification
# (P_u, KF, PUE, L_N, D_avv ...), so that every function can be read against
# its equation. Lower-casing them would break that link.
"N802",
"N803",
"N806",
# One function per equation: an equation with twelve symbols has twelve arguments.
"PLR0913",
# The licence is stated once, in LICENSE; files carry no copyright header.
"CPY001",
]
# The parameter file writes "no unit" and ranges with an en dash; the code must match it.
allowed-confusables = ["–"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"S101", # assert is what a test is
"PLR2004", # published numbers are compared as literals, with the source next to them
"INP001", # tests are not a package
"D103", # the name of a test says what it tests
"PLR0917", # helpers that mirror a source's table take its columns in order
]