nx_crater_quality.nx
buildroot/runtime/nx_crater_quality.nx
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
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
structs
| none |
consts
| 30 | const NX_CR_Q: nx_int = 16384 |
| 32 | const NX_CR_AXIS_POWER_LAW: nx_int = 0 |
| 33 | const NX_CR_AXIS_SPATIAL_UNIF: nx_int = 1 |
| 34 | const NX_CR_AXIS_SIZE_RANGE: nx_int = 2 |
| 35 | const NX_CR_AXIS_DEPTH_RATIO: nx_int = 3 |
| 36 | const NX_CR_AXIS_NON_OVERLAP: nx_int = 4 |
| 37 | const NX_CR_AXIS_COUNT: nx_int = 5 |
| 39 | const NX_CR_CRATER_STRIDE: nx_int = 4 |
| 40 | const NX_CR_OFF_X: nx_int = 0 |
| 41 | const NX_CR_OFF_Y: nx_int = 1 |
| 42 | const NX_CR_OFF_R: nx_int = 2 |
| 43 | const NX_CR_OFF_DEPTH: nx_int = 3 |
functions
| 45 | func _cr_band_score(val: nx_int, lo_q: nx_int, hi_q: nx_int) -> nx_int |
| 64 | func _cr_power_law_q14(craters: *i64, n: nx_int) -> nx_int |
| 93 | func _cr_spatial_unif_q14(craters: *i64, n: nx_int) -> nx_int called by 1: nx_crater_quality_grade |
| 126 | func _cr_size_range_q14(craters: *i64, n: nx_int) -> nx_int called by 1: nx_crater_quality_grade |
| 149 | func _cr_depth_ratio_q14(craters: *i64, n: nx_int) -> nx_int |
| 167 | func _cr_non_overlap_q14(craters: *i64, n: nx_int) -> nx_int called by 1: nx_crater_quality_grade |
| 195 | func nx_crater_quality_grade( |
| 214 | func main() -> i64 |