code wiki / (root) / nx_crater_quality.nx

nx_crater_quality.nx

buildroot/runtime/nx_crater_quality.nx

10121 B263 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_crater_quality.nx -- per-kind grader for nx_crater_field output. Reads a crater array (4 i64 per crater: cx, cy, r, depth) and grades on 5 axes: 0. POWER_LAW_FIT: Neukum 1983 N(>D) ~ D^-2. We check that the count above the median radius is roughly 25% of the total (consistent with -2 exponent). 1. SPATIAL_UNIFORMITY: nearest-neighbour distance distribution suggests Poisson (vs. clustered). Sample N pairs. 2. SIZE_RANGE: max_r / min_r should be >= 4 (real cratering covers multiple decades of size). 3. DEPTH_RATIO: mean(depth/r) should match Pike 1977 value 0.20 (fresh) or be lower (eroded); tolerance band. 4. NON_OVERLAP: fraction of craters whose centres are NOT inside another crater (catches generators that emit duplicates). EMITS LAYER_VERDICT (kind = NX_LAYER_KIND_CRATER).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_layer_verdict.nx nx_crater_quality.nx

imports: nx_syscalls.nxnx_tier.nxnx_layer_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_crater_quality_grade _cr_power_law_q14 _cr_band_score _cr_spatial_unif_q14 _cr_size_range_q14 _cr_depth_ratio_q14 _cr_band_score ↻ _cr_non_overlap_q14 nx_layer_verdict_init nx_layer_verdict_finalize nx_layer_grade_from_axes nx_lv_axis_verdict

structs

none

consts

30const NX_CR_Q: nx_int = 16384
32const NX_CR_AXIS_POWER_LAW: nx_int = 0
33const NX_CR_AXIS_SPATIAL_UNIF: nx_int = 1
34const NX_CR_AXIS_SIZE_RANGE: nx_int = 2
35const NX_CR_AXIS_DEPTH_RATIO: nx_int = 3
36const NX_CR_AXIS_NON_OVERLAP: nx_int = 4
37const NX_CR_AXIS_COUNT: nx_int = 5
39const NX_CR_CRATER_STRIDE: nx_int = 4
40const NX_CR_OFF_X: nx_int = 0
41const NX_CR_OFF_Y: nx_int = 1
42const NX_CR_OFF_R: nx_int = 2
43const NX_CR_OFF_DEPTH: nx_int = 3

functions

45func _cr_band_score(val: nx_int, lo_q: nx_int, hi_q: nx_int) -> nx_int
64func _cr_power_law_q14(craters: *i64, n: nx_int) -> nx_int
93func _cr_spatial_unif_q14(craters: *i64, n: nx_int) -> nx_int
126func _cr_size_range_q14(craters: *i64, n: nx_int) -> nx_int
149func _cr_depth_ratio_q14(craters: *i64, n: nx_int) -> nx_int
167func _cr_non_overlap_q14(craters: *i64, n: nx_int) -> nx_int
195func nx_crater_quality_grade(
214func main() -> i64