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

New Motility interface #82

Merged
merged 40 commits into from
May 19, 2024
Merged

New Motility interface #82

merged 40 commits into from
May 19, 2024

Conversation

mastrof
Copy link
Owner

@mastrof mastrof commented May 18, 2024

Closes #78 and closes #77

Full rewrite of the motility interface.
Current version is extremely more flexible although the complexity of microbe_step! has increased a bit.

  • New Motility{N} type represents a motile pattern as a series of N MotileStates with prescribed transition probabilities.
  • Arbitrary motile patterns can be created easily by concatenation of base states (Run, Tumble, Reverse, Flick, Stop) or custom ones (via RunState or TurnState)
  • The field turn_rate has been removed from microbe types; instead, each MotileState has a duration field. With this approach, also rotations can have finite durations (Tumbles of finite duration #77)
  • AbstractMicrobe now has two type parameters: D for dimensionality and N for the number of steps in the motile pattern.
  • No default values for speed and duration when motility patterns are generated
  • No default values for motility when generating a microbe instance

The potential problems raised in #78 are not crucial and the usage of the Motility{N} even if not fully concrete brings, per se, even some minor performance improvements and significant improvements in memory usage.
However, a performance bottleneck comes from the need to allow instantaneous turns (i.e. TurnState instances with duration=0) by branching inside microbe_step!; this is inefficient but it's the easiest way I have found to recover the past behavior (which I want to keep because it's the limit where simulations can be compared with theoretical results).

All in all, the performance is on par with v0.3, but memory usage is improved and the library is much more flexible. Will may be work on performance optimizations further down the road

@mastrof mastrof added the breaking Breaking change label May 18, 2024
@mastrof mastrof added the milestone Relevant addition to functionality label May 18, 2024
Copy link

codecov bot commented May 19, 2024

Codecov Report

Attention: Patch coverage is 66.91729% with 44 lines in your changes are missing coverage. Please review.

Project coverage is 41.58%. Comparing base (29daeb2) to head (ef97f68).
Report is 2 commits behind head on main.

Current head ef97f68 differs from pull request most recent head 9425d40

Please upload reports for the commit 9425d40 to get more accurate results.

Files Patch % Lines
src/chemotaxis/xie.jl 0.00% 18 Missing ⚠️
src/microbe_step.jl 58.97% 16 Missing ⚠️
src/chemotaxis/brown-berg.jl 0.00% 2 Missing ⚠️
src/chemotaxis/brumley.jl 0.00% 2 Missing ⚠️
src/chemotaxis/celani.jl 71.42% 2 Missing ⚠️
src/microbes.jl 33.33% 2 Missing ⚠️
src/motility.jl 96.15% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
+ Coverage   38.71%   41.58%   +2.86%     
==========================================
  Files          22       22              
  Lines         452      505      +53     
==========================================
+ Hits          175      210      +35     
- Misses        277      295      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mastrof mastrof merged commit 07f2634 into main May 19, 2024
2 checks passed
@mastrof mastrof deleted the motility branch May 19, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking change milestone Relevant addition to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better motility implementation Tumbles of finite duration
1 participant