Repository navigation
VIS-4a: remove braincell.vis; Morphology.to_vis_data, NodeTree.to_topology_data, Cell.topology_data - #198
Merged
Conversation
…ology_data, Cell.topology_data Plotting lives in braintools.visualize.morphology. vis2d/vis3d keep their signatures and call bvm.plot2d/plot3d; the three adapters convert braincell objects into its neutral data, and Morphology / NodeTree implement the protocols, so every plot accepts them directly. The cell_topology tests are rewritten against Cell.topology_data; the pixel baselines and the two SWC 3D tests move to vis_baseline_test.py and draw through the adapters with the same images and tol=0. Breaking, no deprecation; changelog has the old-to-new tables.
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.
VIS-4a:
braincell.visis deleted. Plotting lives inbraintools.visualize.morphology(bvm), which arrived with braintools 0.5.0 (chaobrain/braintools#143). braincell converts its objects with three adapter methods, andvis2d/vis3ddraw throughbvm. This is breaking with no deprecation, by the maintainers' decision for 0.3. The migration is the pair of tables in the changelog.Changes
braincell/vis/(81 files, −18 447 lines).braincell/__init__.pyno longer imports or exportsvis.import braincell.visraisesModuleNotFoundError.import braincellloads nobraintools.visualize.morphologymodule (subprocess test).Morphology.to_vis_data()→MorphologyData, also exposed as__morphology_data__.indexis the position inMorphology.branches, so evaluated masks keep their branch indices.MorphoBranch.childrenorder; the root'sparent_x/child_xareNone.(revision): same object until an edit, a new one after.NodeTree.to_topology_data()→TopologyGraph(level="node"), also exposed as__topology_data__.Cell.topology_data(level="node", *, value=None, region=None, locset=None)→TopologyGraph.plot_cell_topology, calling the existingfield_resolutionfunctions unchanged.Cell.topology_data(level=...).(T, n)value array gives one frame per row.bvm.plot_topology_graph(it checksgraph.level == "branch").vis2d/vis3dkeep the same signatures. Their bodies dofrom braintools.visualize import morphology as bvm, andshow=Truestill callsplt.show().morph/__init___test.py:_UPWARD = ("braincell.io", "braincell.filter", "braintools.visualize.morphology")dropsbraincell.visand addsbraintools.visualize.morphology.morph/_testing.pygainsmake_root_split_treeandmake_projected_node_tree, moved from the deleted vis fixtures.braincell/vis_baseline_test.pyandbraincell/vis_baselines/hold the VIS-2 baselines (the same 9 PNGs,tol=0, Linux only). They are now drawn through the adapters:morpho.vis2d,bvm.plot2d(morpho, values=...),bvm.plot_dendrogram/plot_sholl(morpho),bvm.plot_topology_graph(cell.topology_data("cv", region=...))andbvm.plot_topology_graph(cell.node_tree). The two counter-examples still fail the comparison. The two SWC 3D tests (scene building, and PyVista off-screen) moved into the same file.vis2d/vis3dtests: they patchbraintools.visualize.morphology.plot2d/plot3d, assert that every argument is forwarded, and checkshow. No braintools test doubles are imported.pyproject.tomlhasvis = ["braintools[morphology]>=0.5"];dependenciesalready hadbraintools>=0.5from QUAD-2b.MANIFEST.inprunesbraincell/vis_baselines.docs/apis/vis.rstis now a short page listing the adapters and wrappers.README.md(features, example, extras table),docs/index.rst,docs/developer/{testing,troubleshooting,project_layout}.md, and docstrings inmorph/morphology.py,morph/branch.py,morph/_testing.py,field_resolution.py,filter/_testing.py,io/_testing.pyandquad/_testing.py.braincell.viscalls do not run; the docs build does not execute notebooks.How the 33
cell_topologytests mapThe new tests are in
_multi_compartment/cell_test.py(CellTopologyData*):test_an_unknown_level_names_the_valid_ones;init_state→test_node_level_requires_init_state.test_node_is_the_default_level.test_graph_before_init(ids, edges, root);test_region_gives_area_coverage_fractions(0.5833…);anymode forwarding: dropped (coverage_modestays a plot argument);test_locset_is_full_intensity;V, raw point values,layout_id, value plus region, and more than one root CV each map 1:1.(T, n)frames, unknownlayout_id→KeyError, wrong length →ValueError.test_graph_before_init;test_region_gives_length_coverage_fractions;allmode forwarding: dropped (a plot argument);test_the_plot_rejects_colormap_arguments_for_a_branch_graph, now asserted onbvm.plot_topology_graph;test_both_unsupported_arguments_are_reported_together(value plus locset now hits the value-with-highlight guard first).V(label"V"), ambiguous channel,layout_id, ionna.E: 1:1;test_the_graph_draws(topology_data(value="V")andcell.node_treeboth draw).test_graph_matches_the_node_tree, missing field →AttributeError.Cell.topology_data(level='cv').vis_baseline_test.py.Counter-example for the deferred import
Hoisting
from braintools.visualize import morphology as bvmto the module level ofmorph/morphology.pyfailsUpwardImportsAreDeferredTest:Verification
pytest braincell(local, braintools atbdff413): 2741 passed, 12 skipped, 1 failed. The one failure istest_braincell_vis_no_longer_exists. It is an artefact of my local environment: braincell is installed editable from another checkout, and the editable finder still resolvesbraincell.visthere. With that finder removed, the import raisesModuleNotFoundError. CI installs this branch.pytest braincell/vis_baseline_test.py: 13 passed (9 baselines attol=0, 2 counter-examples, 2 SWC tests).pre-commit run --all-filespasses.ci-oksuccess, including docs, coverage, lint, build_package, the Linux/macOS/Windows matrix and the NEURON compare jobs.