Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate fastcore functions #150

Merged
merged 34 commits into from
Aug 15, 2024
Merged

Integrate fastcore functions #150

merged 34 commits into from
Aug 15, 2024

Conversation

schlegelp
Copy link
Collaborator

@schlegelp schlegelp commented Jul 8, 2024

This is a work-in-progress PR to integrate functions re-implemented in Rust via navis-fastcore.

List of functions that will now use fastcore under-the-hood if available:

  • geodesic_matrix(): 20x faster (note that this will also speed up a number of downstream functions such as longest_neurite)
  • prune_twigs(): 4x faster
  • strahler_index(): 20x faster
  • synapse_flow_centrality(): 4.5x faster (but importantly much more memory efficient)
  • segments_to_coords(): 3.5x faster (this function is a major bottleneck during plotting)
  • TreeNeuron.cable_length property: 2x faster
  • _connected_components(): 1.4x faster

Potential TODOs:

  • skeletonization (bigger project)
  • NBLAST (protoype working but oddly still slower than implementation in navis)
  • pin fastcore version

Misc:

  • this PR also fixes a couple bugs encountered in the progress:
    • fixed synblast multiprocessing (pickling) issue
    • fixed issue with ax.add_collection3d in plot2d (introduced with in recent matplotlib version)
    • single disconnected nodes will now be ignored during plotting when radius=True (caused error previously)
    • neuPrint interface: fetch_mesh_neuron() will now ignore lod parameter if not supported by mesh source (e.g. for legacy meshes); previously this caused an error
  • fixed a bunch of deprecation warnings e.g. from numpy, igraph and matplotlib
  • subset_neuron now sets ._soma to None if the soma is lost during subsetting

schlegelp added 30 commits July 7, 2024 10:39
- _generate_segments() and _break_segments()
- _connected_components() if input is skeleton
- skeletons.cable_length (via new cable_length() function)
- geodesic_matrix()
- prune_twigs() when precise=False
- segments_to_coords
- synapse_flow_centrality()
- this also changes how the "greedy" method works
no clue why that passed previously - I did investigate but did not find
a reason
- eval_color: make sure numpy arrays are not converted to lists
- prepare_colormap: not sure why this was wrong but it was
- mesh2plotly: deal with rgb vs rgba colors
- remove accidental return
- fix single query target
@schlegelp schlegelp changed the title [WIP] Integrate fastcore functions Integrate fastcore functions Aug 15, 2024
@schlegelp
Copy link
Collaborator Author

There is one remaining failing test: strangely, MovingLeastSquaresTransform.xform return different values depending on whether I run it locally on my machine or whether it runs on Github. Since this problem is unrelated to this PR, I will ignore it and go ahead with the merge.

@schlegelp schlegelp merged commit 5d21d13 into master Aug 15, 2024
13 of 25 checks passed
@schlegelp schlegelp deleted the fastcore branch August 15, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant