Test the pure computational functions - #18
Merged
Merged
Conversation
This was referenced Aug 29, 2026
gouwens
marked this pull request as ready for review
August 31, 2026 19:42
Covers every publicly documented name in coordinates, linestring3d, processing, dataset, metrics, morphology and angle, plus the shared voxel-matching helper in projection. These need no fixtures beyond small arrays, so expectations are derived from the domain rather than recorded from the current implementation: a 3-4-5 triangle for segment lengths, a streamline perpendicular to a plane at 90 degrees and one lying in it at 0, one voxel per layer giving 10-micron layers at 10-micron resolution, scale invariance where doubling both inputs must not move the answer. Golden-master values are deliberately absent. One of the two open contributions is a behaviour change whose results match neither architecture's previous answer, so golden values taken from the current branch would fail a correct contribution. Large-allocation helpers are always called with small shapes; their defaults allocate against the full 1320x800x1140 atlas. Two defects are recorded as xfail(strict) tests asserting correct behaviour: - issue #8: load_swc_as_dataframe uses sep=" " and cannot read tab- or column-aligned SWC. It does not fail -- every numeric column comes back NaN, silently. - find_closest_streamline accepts `resolution` and uses it to scale the returned coordinates, but does not forward it to coordinates_to_voxels, so at any resolution other than (10, 10, 10) it voxelises the input against the wrong grid and looks up the wrong streamline. Two behaviours are documented as characterization tests rather than asserted as correct, since neither is knowably a bug: LineString3D.rotation_to_vector divides by 1 + dot and so is undefined for an antiparallel target (cortical streamlines never hit this), and _matching_voxel_indices silently returns wrong answers for an unsorted lookup with no sorter, because np.searchsorted does not check. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The defect now has an issue (#23), so the marker names it. A contributor looking at a reported unexpected pass can find the report, and closing the issue is verifiable by CI rather than by reading the diff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gouwens
force-pushed
the
tests/2-pure-functions
branch
from
August 31, 2026 20:57
c4868a5 to
5bbc79d
Compare
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.
Second of three. Stacked on #17 — review that first; the diff here is only this branch's own commits.
Covers every publicly documented name in
coordinates,linestring3d,processing,dataset,metrics,morphologyandangle, plus_matching_voxel_indices. These need no fixtures beyond small arrays.Expectations come from the domain, not from the current output
A 3-4-5 triangle for segment lengths. A streamline perpendicular to a plane at 90°, one lying in it at 0°, one at 45° at 45°. One voxel per layer giving 10 µm layers at 10 µm resolution. Scale invariance where doubling both inputs must not move the answer.
No golden-master values. #11 is a deliberate behaviour change whose results match neither architecture's previous answer, so golden values captured from the current branch would cause a correct contribution to fail the suite — the precise opposite of what the suite is for.
Large-allocation helpers (
transform_*_to_volume,upscale_ish_volume) are always called with small shapes; their defaults allocate against the full 1320×800×1140 atlas._matching_voxel_indicesgets the most attention — it is pure, takes small arrays, and is the common core beneath the closest-streamline search, surface-voxel collapsing and 2-D coordinate calculation. Both open contributions reduce to its behaviour.Defects recorded (xfail, strict)
Each marker names its tracker issue, so an unexpected pass leads straight to the report.
load_swc_as_dataframeusessep=" "and cannot read tab-separated or column-aligned SWC. It doesn't fail: every numeric column comes back NaN, silently, in a dataframe of the right shape.find_closest_streamlineacceptsresolutionand uses it to scale the returned coordinates, but never forwards it tocoordinates_to_voxels, so at any resolution other than (10, 10, 10) it voxelises the input against the wrong grid and looks up the wrong streamline.Documented, not asserted
Two behaviours are characterization tests rather than xfails, because neither is knowably wrong:
LineString3D.rotation_to_vectordivides by1 + dot, so it is undefined for an antiparallel target and returns non-finite values rather than raising. Cortical streamlines never hit this; a direct caller can._matching_voxel_indicessilently returns wrong answers for an unsorted lookup with nosorter, becausenp.searchsorteddoesn't check. Nothing in the package validates the reference files' ordering.Verification
156 passed, 5 xfailed, ~5s. Green on all four matrix entries.
🤖 Generated with Claude Code