Repository navigation
Record the rect axis order [y, x] and the length-unit catalog; conformance data, validator and tests - #115
Merged
Conversation
…sions; conformance data, tests and sabotage rows follow Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN
Contributor
Author
|
Local full suite as the non-root user tester, private TMPDIR (cleaned up afterwards): all tests pass except 2 in test_tools_features (test_register_writes_them_into_the_entry_and_the_cached_schema, test_doctor_prints_them_and_does_not_call_an_upgrade_stale). Those fail only in this sandbox, unrelated to this PR: the app interpreter /usr/bin/python imports an old editable install of Tools from /tmp/wt_versions (no retention_prune feature). CI is green on every job. Generated by Claude Code |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN
…validator, tests, sabotage rows and 'How to add a unit' Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docs, data and tests, plus the validator for the new catalog. No other production code of Tools changes.
Decisions recorded (SPEC_WRONG_SCIENCE section 8, "Decided (user, 12 Oct)")
rectregion is[y, x], like the image arrays; protocol shapes stay[x, y](GeoJSON). The fixtures say which pairs are[width, height](server_wh) and which are[rows, columns].conformance.json, edited by data change (replaces the strict list of the first version of this PR). Match rule: symbols (m,nm,um,mm,cm, the micro signs U+00B5 / U+03BC, the Angstrom signs U+00C5 / U+212B) are exact, case-sensitive, untrimmed; words are matched case-insensitively after trimming surrounding whitespace. Anything not in the catalog is unknown calibration. The 72 / 96 dpi and INCH / CENTIMETER rules are unchanged.What changed
labconstrictor_tools/conformance.json:calibration.length_unitsreplaceslength_units_um: canonical unit ->{um_per_unit, symbols, words}for nm, um (micron(s), micrometer(s), micrometre(s), um, µm, μm), mm, cm, m (each with its -meter/-metre words and plurals) and angstrom (Å, Å, angstrom(s), 0.0001).calibration.unit_matchholds the rule and the base unit;calibration.unit_match_refusedthe pinned unknown names (case variants and spaced forms of symbols, plurals of symbols, words split by a space, inch, pixel, kilometer, a damaged micro sign).coordinate.axis_orderandserver_shape_yx(additive next toserver_wh) stay.labconstrictor_tools/conformance.py(the only production file touched):_length_unitsvalidates the catalog: positiveum_per_unit, symbol / word lists, a name owned by two units, a word not lower case or not trimmed, a symbol that is also a word of another unit, a name starting with U+FFFD, and a missing base unit (unit_match.canonical, factor 1.0). It replaces the oldlength_units_umcheck.docs/SPEC_WRONG_SCIENCE.md: section 8, 2.1.4 and the CAL table follow the catalog.docs/CONFORMANCE.md: layout table; new "How to add a unit" (one data line, one test row inCalibrationData.ORACLE, which hosts change: all of them load the catalog); rect axis order and length units removed from the Gaps list.tests/test_conformance.py: every catalog name converts to the factor of a hand-written oracle (symbols exact, words any case and trimmed, no space inside a word); the same length written in every unit agrees; every refused name stays unknown; the validator rejects each kind of malformed catalog (duplicate symbol, duplicate word in another case, non-positive factor, names not a list, untrimmed or non-lower-case names, a symbol that is a word of another unit, damaged sign, unknown or non-base canonical unit, missing catalog); a new unit or alias added as data validates and resolves with no code change; plus the rect[y, x]and[width, height]tests from before.tests/test_sabotage.py: rows that break the table (millimetre factor,inchas a word of the metre,UMas a symbol), the validator (duplicate name, missing base unit) and the rect / CF-09 data.Contradictions with production code
None in Tools production code: Tools converts no units and has no
rectcode. Hosts must change once to read the catalog instead of their own list (other repositories, not touched): Napari reads units through pint (any pint unit, e.g. inch, also accepted), so it contradicts the catalog; Fiji and QuPath were not checked. HOST_PARITY C18 (an audit table) lists the old set and is left as history.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y2SN8SuEakTdiWy3F2WUqN
Generated by Claude Code