Skip to content

Add Canonical spectra examples to docs, README #33

Closed

Description

@jbphyswx

We have no clear examples of SF calcs matching known truth.
It would be great to add some for classic spectra, flows, etc.

And a hero highlight story of how to use the package, how you can get relevant spectra, infer energy fluxes etc.

Activity

  1. jbphyswx commented on Sep 6, 2026

    @jbphyswx
    OwnerAuthor

    Added.

    docs/src/validation.md — the oracle table, strongest first, and what each one can and cannot catch. Thirteen oracles, with the reasoning for the ordering: an oracle exact to round-off catches defects a percent-level physical check never notices, and most defects in this package's history were exactly that kind.

    docs/src/walkthrough.md — one analysis end to end in three acts: six invariants in one pass over 18.0 M pairs → the Helmholtz split → directional S(r, θ) → the exact-law inversions → into spectral space via both routes. Every number on the page was produced by the page's own code, extracted from the markdown and re-run; that caught two defects that would otherwise have shipped as copy-pasteable code that errors.

    Canonical spectra, specifically:

    • a field built with a prescribed E(k) ~ k^(-5/3), binned into S₂ and transformed back — the recovered spectrum carries the slope it was built with (local slope −1.65 against −1.667) across 1.5 decades
    • the isotropic transform against a closed form: a Gaussian correlation has an analytic spectral density in every dimension, reproduced to 6.6e-05, 2.3e-09, 9.9e-14 in 1-D/2-D/3-D
    • ∫₀^∞ E(k) dk = variance, which is what fixes the normalisation convention

    Eleven new figures in docs/src/assets, referenced from the README and regenerated by docs/generate_assets/generate_feature_figures.jl: spectra, missing-data robustness, directional output, Helmholtz spectra, channels, transform-vs-sweep, advective flux, the third-order exact laws, spherical transport, culling, covariance.

    One thing deliberately not asserted. The isotropic relation D_LL(r) = ∫ E(k) f(kr) dk is documented but not used as a test. Both available constructions were built and measured: a cubic-grid shell is 0.4–5 % anisotropic and does not improve with shell radius, and quadrature directions on scattered points converge only as sampling allows (5–8 % at N = 16 000). In both the residual belongs to the mode set and the sampling, not to the package, so an assertion at that tolerance would mostly test the test. The kernel itself was verified numerically as a by-product — the direction average equals ½ f(k₀r) at every r, constant to 4e-6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions