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

More efficient calculation of axial currents #460

Merged
merged 6 commits into from Feb 21, 2024
Merged

Conversation

torbjone
Copy link
Contributor

Fixes #459.

The calculation of axial currents from membrane potentials is very slow, and I found that most of the time was spent on recalculating the ''children_dict" and "connection_dict" for each segment, which is unnecessary since these do not change.

This PR moves the calculation of ''children_dict" and "connection_dict" outside the loop. All tests pass locally, and I get identical answers as before for a Hay model example. Importantly, the execution time went from 13 seconds to 0.4 seconds.

@coveralls
Copy link

coveralls commented Feb 15, 2024

Coverage Status

coverage: 98.666%. remained the same
when pulling 8eeedf8 on torbjone:ax-fix
into e362072 on LFPy:master.

@espenhgn
Copy link
Collaborator

Looks good to me! Before merging, can you bump the version file so we can make available a new tag/release?

@torbjone torbjone merged commit 2573856 into LFPy:master Feb 21, 2024
14 checks passed
@torbjone torbjone deleted the ax-fix branch February 21, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More efficient calculation of axial currents
3 participants