Skip to main content

Crafter Research

khipu-null

Rank khipus against a reference pattern and test whether the match is chance.

License: MIT Python 3.11+

You describe a pattern (group sizes, which cords hold totals, colour repeats, attachment, value ranges). khipu-null scores every khipu in a corpus, ranks them, and compares each score against null versions of the same khipu where only the field that feature reads is permuted. Groups, positions and levels never move.

It answers three questions directly. Which khipus match the pattern? Which top k are the best candidates, and is that top k better than what you would pick by chance from the same corpus? Is any single match unlikely to be a coincidence, after correcting for testing hundreds of khipus?

Developed by Crafter Research from the null designs validated in the khipu colour and number analyses.

Quickstart

Requires uv.

uvx --from git+https://github.com/crafter-research/khipu-null khipu-null --help

Try it on the public Open Khipu Repository:

curl -sL -o khipu.db https://raw.githubusercontent.com/khipulab/open-khipu-repository/v2.1.0/data/khipu.db
uvx --from git+https://github.com/crafter-research/khipu-null khipu-null import-okr khipu.db -o okr.csv --errata confirmed
curl -sLO https://raw.githubusercontent.com/crafter-research/khipu-null/main/examples/santa-valley.yaml
uvx --from git+https://github.com/crafter-research/khipu-null khipu-null rank okr.csv santa-valley.yaml -o out --top 6

out/ gets report.md, ranking.csv and summary.json.

Input format

Any CSV with one row per cord works:

Column Meaning
khipu_id khipu identifier
cord_id cord identifier, unique
group_id cord group (cluster)
position order along the khipu
level 1 pendant, 2+ subsidiary
color colour code as recorded
value decoded knot value, empty if no knots
attachment optional, recto/verso code

Patterns and nulls

Start from examples/template.yaml. Keep only the features your model predicts.

Feature Question Null
first_cord_range Are the first cords of runs in [min, max] more often than cords at random? values shuffled across the khipu
group_sum Does the first (or last) cord equal the sum of the others? values shuffled among cords in the same slot of their group
color_repeat Do colours repeat with this period? Single-colour groups are excluded. colours rotated along the khipu (bands kept)
attachment_split Are run-first cords tied with this code more than cords at random places? attachments rotated along the khipu
group_size Are groups made of whole units of this size? none (structure)
value_range Share of values in [min, max] none (whole-khipu distribution)

A feature spec can override its null with null: within_khipu | within_group | within_slot | rotate.

Reading the report

  • Per khipu: score, null mean, p (one-sided permutation) and q (Benjamini-Hochberg across all scored khipus).
  • Top-k test: the mean score of your top k against the top k picked from null versions of every khipu. This is the honest answer to "are these five special, or would any five look this good?".
  • draws: auto uses enough draws that a top-k khipu could reach q <= 0.05 if it beat every draw. With fewer draws, no khipu can be significant across a large corpus.

Example on the OKR (v2.1.0, KH0326 errata fixed), with a pattern written from the Santa Valley khipus. This is a sanity check, since the pattern comes from those khipus. Five of the six Santa khipus rank in the top 6 of 328; the top-6 mean is 0.994 against a null of [0.954, 0.986], p = 0.001; no single khipu reaches q <= 0.05.

Limits

  • A low p says the match is unlikely under that null, given each khipu's structure. It does not say what a khipu means.
  • Structural features cannot be tested by permuting a khipu. They rank, they do not prove.
  • Shuffling colours cord by cord breaks colour bands and makes chance matches look rare. That is why colours rotate.
  • Shuffling values across the whole khipu ignores position effects, such as larger first cords. That is why group_sum shuffles within slots.

Data notes

OKR v2.1.0 and the Khipu Field Guide give single knots a different decimal place on KH0326 and KH0472 (OKR 100, Field Guide 10). import-okr --errata confirmed applies the Field Guide reading to KH0326, which Urton (2017, Appendix B) supports; --errata all also applies it to KH0472. This is an open discrepancy, not a confirmed error in OKR. Details: audit-okr-kfg.md.

Citation

If you use khipu-null, please cite it (GitHub's "Cite this repository" button reads CITATION.cff): Crafter Research (2026), khipu-null, https://github.com/crafter-research/khipu-null

License

Code: MIT. Documentation and examples: CC BY 4.0.

Metadata

Release files for khipu-null 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for khipu-null 0.1.0
File Size Uploaded Provenance Actions
khipu_null-0.1.0.tar.gz 42.2 kB With provenance Details for khipu_null-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for khipu-null 0.1.0
File Interpreter ABI Platform Actions
khipu_null-0.1.0-py3-none-any.whl Python 3 none any Details for khipu_null-0.1.0-py3-none-any.whl

Total release size: 55.8 kB

Release files / khipu_null-0.1.0.tar.gz

Download URL khipu_null-0.1.0.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d3d8775fb8013328168434acf05d8fa7e2a834a718def729a3d415a46a28dc18
BLAKE2b-256 checksum
How to use checksums
5b8b54d2e26051341a95a0be512e13913f41a9a143c824dfec6888ce3b6ae286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / khipu_null-0.1.0-py3-none-any.whl

Download URL khipu_null-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bedfbca4913527eb47324bc2cca96a31712747a3a6aac64d80edd5c10b2d757
BLAKE2b-256 checksum
How to use checksums
c4cfc73696541812f0302d734a64284948e2fd90c6e66a669cad792a13cf2b62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for khipu-null 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for khipu_null-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page