omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / calibration / scripts / envelope_summary.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Summarise turing-coder envelope CSVs (DIR/seed-<S>.<candidate>.csv) per candidate and coder: |
| 18 | # the largest |overhead - 448| in bits over every file and every crumb, and the worst margin |
| 19 | # |overhead - 448| - (64 + 1.0e-3 x N) (<= 0 means inside the envelope; CODER_SPEC section 9). |
| 20 | # overhead = 8 x coded_bytes - ideal_ub / 1e6. No Python: POSIX sh + awk. |
| 21 | set -eu |
| 22 | dir="$1" |
| 23 | echo "candidate coder units max_abs_dev_bits worst_margin_bits violations" |
| 24 | for f in "$dir"/seed-*.*.csv; do |
| 25 | c="${f##*/seed-}"; c="${c#*.}"; c="${c%.csv}" |
| 26 | awk -F, -v c="$c" 'NR > 1 { print c, $1, $4, $5, $6, $7 }' "$f" |
| 27 | done | awk ' |
| 28 | function upd(k, n, ub, b, o, d, m) { |
| 29 | o = 8 * b - ub / 1e6; d = o - 448; if (d < 0) d = -d; m = d - (64 + 1.0e-3 * n) |
| 30 | if (!(k in U) || d > D[k]) D[k] = d |
| 31 | if (!(k in U) || m > M[k]) M[k] = m |
| 32 | U[k]++; if (m > 0) V[k]++ |
| 33 | } |
| 34 | { upd($1 " range", $3, $4, $5); upd($1 " rans", $3, $4, $6) } |
| 35 | END { for (k in U) printf "%s %d %.3f %.3f %d\n", k, U[k], D[k], M[k], V[k] + 0 }' | sort |