API
Microbes
Base.position
— Functionposition(m::AbstractMicrobe)
Return the position of the microbe.
MicrobeAgents.direction
— Functiondirection(m::AbstractMicrobe)
Return the direction versor of the microbe.
MicrobeAgents.speed
— Functionspeed(m::AbstractMicrobe)
Return the speed of the microbe.
speed(motility::Motility)
Return the speed distribution of the current motile state.
MicrobeAgents.velocity
— Functionvelocity(m::AbstractMicrobe)
Return the velocity vector of the microbe (direction times speed).
MicrobeAgents.motilepattern
— Functionmotilepattern(m::AbstractMicrobe)
Return the motile pattern of the microbe.
MicrobeAgents.rotational_diffusivity
— Functionrotational_diffusivity(m::AbstractMicrobe)
Return the rotational diffusivity of the microbe.
MicrobeAgents.radius
— Functionradius(m::AbstractMicrobe)
Return the radius of the microbe.
MicrobeAgents.state
— Functionstate(m::AbstractMicrobe)
Return the internal state of the microbe.
state(motility::Motility)
Return the index of active motile state.
MicrobeAgents.motilestate
— Functionmotilestate(microbe)
Return the current motile state of microbe
.
MicrobeAgents.states
— Functionstate(motility::Motility)
Return the list of all motile states.
MicrobeAgents.transition_weights
— Functiontransition_weights(motility::Motility, i::Integer)
Return the transition weights from the state with index i
towards the other motile states.
MicrobeAgents.duration
— Functionduration(motility::Motility)
Return the average unbiased duration of the current motile state.
MicrobeAgents.polar
— Functionpolar(motility::Motility)
Return the distribution of polar reorientation angles of the current motile state.
MicrobeAgents.azimuthal
— Functionazimuthal(motility::Motility)
Return the distribution of azimuthal reorientation angles of the current motile state.
MicrobeAgents.distance
— Functiondistance(a, b, model)
Evaluate the euclidean distance between a
and b
respecting the boundary conditions of the model
MicrobeAgents.distancevector
— Functiondistancevector(a, b, model)
Evaluate the distance vector from a
to b
respecting the boundary conditions of the model
.
MicrobeAgents.random_speed
— Functionrandom_speed(microbe, model)
Generate a random speed from the motile pattern of microbe
.
MicrobeAgents.random_velocity
— Functionrandom_velocity(model)
Generate a random velocity vector with unit norm respecting the dimensionality of model
.
Chemoattractants
MicrobeAgents.AbstractChemoattractant
— TypeAbstractChemoattractant{D,T}
Abstract type for chemoattractants. Requires dimensionality (D
) and number type (T
, typically Float64
).
The interface is defined by four core functions that operate on AgentBasedModel
s:
chemoattractant
: returns the chemoattractant objectconcentration
: returns the function for the concentration fieldgradient
: returns the function for the concentration gradienttime_derivative
: returns the function for the concentration rampchemoattractant_diffusivity
: returns the thermal diffusivity of the chemoattractant
MicrobeAgents.GenericChemoattractant
— TypeGenericChemoattractant{D,T} <: AbstractChemoattractant{D,T}
Type for a generic chemoattractant field. Concentration field, gradient and time derivative default to zero values. Diffusivity defaults to 608 μm^2/s.
MicrobeAgents.chemoattractant
— Functionchemoattractant(model)
Returns the chemoattractant object from model
.
MicrobeAgents.concentration
— Functionconcentration(model)
Returns the function f
that defines the concentration field. The returned function has signature f(pos, model)
and returns a scalar.
MicrobeAgents.gradient
— Functiongradient(model)
Returns the function f
that defines the gradient of the concentration field. The returned function has signature f(pos, model)
and returns a SVector
with the same dimensionality as the microbe position pos
.
MicrobeAgents.time_derivative
— Functiontime_derivative(model)
Returns the function f
that defines the time derivative of the concentration field. The returned function has signature f(pos, model)
and returns a scalar.
MicrobeAgents.chemoattractant_diffusivity
— Functionchemoattractant_diffusivity(model)
Returns the thermal diffusivity of the chemoattractant compound.
Utils
MicrobeAgents.Analysis.adf_to_matrix
— Functionadf_to_matrix(adf, sym)
Collect quantity sym
from the agent dataframe adf
and return it in matrix form with dimensions (times, microbes). Requires all microbes to exist from start to end of the simulations (no removals or insertions).
MicrobeAgents.Analysis.adf_to_vectors
— Functionadf_to_vectors(adf, sym)
Collect quantity sym
from the agent dataframe adf
and return a vector of such quantity for each microbe id.
Missing docstring for Analysis.unfold
. Check Documenter's build log for details.
MeanSquaredDisplacement.unfold!
— Functionunfold!(adf, model; key=:position)
+API · MicrobeAgents.jl API
Microbes
Base.position
— Functionposition(m::AbstractMicrobe)
Return the position of the microbe.
sourceMicrobeAgents.direction
— Functiondirection(m::AbstractMicrobe)
Return the direction versor of the microbe.
sourceMicrobeAgents.speed
— Functionspeed(m::AbstractMicrobe)
Return the speed of the microbe.
sourcespeed(motility::Motility)
Return the speed distribution of the current motile state.
sourceMicrobeAgents.velocity
— Functionvelocity(m::AbstractMicrobe)
Return the velocity vector of the microbe (direction times speed).
sourceMicrobeAgents.motilepattern
— Functionmotilepattern(m::AbstractMicrobe)
Return the motile pattern of the microbe.
sourceMicrobeAgents.rotational_diffusivity
— Functionrotational_diffusivity(m::AbstractMicrobe)
Return the rotational diffusivity of the microbe.
sourceMicrobeAgents.radius
— Functionradius(m::AbstractMicrobe)
Return the radius of the microbe.
sourceMicrobeAgents.state
— Functionstate(m::AbstractMicrobe)
Return the internal state of the microbe.
sourcestate(motility::Motility)
Return the index of active motile state.
sourceMicrobeAgents.motilestate
— Functionmotilestate(microbe)
Return the current motile state of microbe
.
sourceMicrobeAgents.states
— Functionstate(motility::Motility)
Return the list of all motile states.
sourceMicrobeAgents.transition_weights
— Functiontransition_weights(motility::Motility, i::Integer)
Return the transition weights from the state with index i
towards the other motile states.
sourceMicrobeAgents.duration
— Functionduration(motility::Motility)
Return the average unbiased duration of the current motile state.
sourceMicrobeAgents.polar
— Functionpolar(motility::Motility)
Return the distribution of polar reorientation angles of the current motile state.
sourceMicrobeAgents.azimuthal
— Functionazimuthal(motility::Motility)
Return the distribution of azimuthal reorientation angles of the current motile state.
sourceMicrobeAgents.distance
— Functiondistance(a, b, model)
Evaluate the euclidean distance between a
and b
respecting the boundary conditions of the model
sourceMicrobeAgents.distancevector
— Functiondistancevector(a, b, model)
Evaluate the distance vector from a
to b
respecting the boundary conditions of the model
.
sourceMicrobeAgents.random_speed
— Functionrandom_speed(microbe, model)
Generate a random speed from the motile pattern of microbe
.
sourceMicrobeAgents.random_velocity
— Functionrandom_velocity(model)
Generate a random velocity vector with unit norm respecting the dimensionality of model
.
sourceChemoattractants
MicrobeAgents.AbstractChemoattractant
— TypeAbstractChemoattractant{D,T}
Abstract type for chemoattractants. Requires dimensionality (D
) and number type (T
, typically Float64
).
The interface is defined by four core functions that operate on AgentBasedModel
s:
chemoattractant
: returns the chemoattractant objectconcentration
: returns the function for the concentration fieldgradient
: returns the function for the concentration gradienttime_derivative
: returns the function for the concentration rampchemoattractant_diffusivity
: returns the thermal diffusivity of the chemoattractant
sourceMicrobeAgents.GenericChemoattractant
— TypeGenericChemoattractant{D,T} <: AbstractChemoattractant{D,T}
Type for a generic chemoattractant field. Concentration field, gradient and time derivative default to zero values. Diffusivity defaults to 608 μm^2/s.
sourceMicrobeAgents.chemoattractant
— Functionchemoattractant(model)
Returns the chemoattractant object from model
.
sourceMicrobeAgents.concentration
— Functionconcentration(model)
Returns the function f
that defines the concentration field. The returned function has signature f(pos, model)
and returns a scalar.
sourceMicrobeAgents.gradient
— Functiongradient(model)
Returns the function f
that defines the gradient of the concentration field. The returned function has signature f(pos, model)
and returns a SVector
with the same dimensionality as the microbe position pos
.
sourceMicrobeAgents.time_derivative
— Functiontime_derivative(model)
Returns the function f
that defines the time derivative of the concentration field. The returned function has signature f(pos, model)
and returns a scalar.
sourceMicrobeAgents.chemoattractant_diffusivity
— Functionchemoattractant_diffusivity(model)
Returns the thermal diffusivity of the chemoattractant compound.
sourceUtils
MicrobeAgents.Analysis.adf_to_matrix
— Functionadf_to_matrix(adf, sym)
Collect quantity sym
from the agent dataframe adf
and return it in matrix form with dimensions (times, microbes). Requires all microbes to exist from start to end of the simulations (no removals or insertions).
sourceMicrobeAgents.Analysis.adf_to_vectors
— Functionadf_to_vectors(adf, sym)
Collect quantity sym
from the agent dataframe adf
and return a vector of such quantity for each microbe id.
sourceMissing docstring. Missing docstring for Analysis.unfold
. Check Documenter's build log for details.
MeanSquaredDisplacement.unfold!
— Functionunfold!(adf, model; key=:position)
unfold!(adf, extent; key=:position)
unfold!(gdf, model; key=:position)
-unfold!(gdf, extent; key=:position)
Unfold the periodic trajectories contained in the agent dataframe adf
or in the grouped dataframe gdf
where each microbe trajectory was grouped by :id
. The second argument can be either the spatial extent of the model, or the model itself from which the extent is automatically extracted.
The keyword argument key=:position
determines what column of the dataframe has to be unfolded.
sourceData analysis
MicrobeAgents.Analysis.detect_turns!
— Functiondetect_turns!(adf; threshold_angle=0.0, kwargs...)
Detect reorientations in the microbe trajectories in adf
. Requires adf
to have a velocity column. In order to be detected, a reorientation must be larger than the threshold_angle
(in radians); the threshold defaults to 0.
A new column is added to the dataframe, with values true
when the microbe has turned with respect to the previous frame, or false
otherwise.
Keywords
vel_key::Symbol = :velocity
: name of the column containing microbe velocitiesnew_key::Symbol = :has_turned
: name of the new column storing turn statistics
sourceMicrobeAgents.Analysis.run_durations
— Functionrun_durations(adf; turns_key=:has_turned)
Evaluate the duration (in frames) of all runs detected during a simulation. The dataframe should already contain a column of Bools with values true
for frames when a turn has occurred and false
otherwise (see detect_turns!
). The function returns a vector of run durations for each microbe.
turns_key
defines the name of the column where the turn statistics is stored (defaults to :has_turned
).
sourceMicrobeAgents.Analysis.driftvelocity_point!
— Functiondriftvelocity_point!(adf, target; normalize=false, kwargs...)
-driftvelocity_point!(gdf, target; normalize=false, kwargs...)
Evaluate the drift velocity of microbes towards a target
point, extracting their positions and velocities from the agent dataframe adf
or from the grouped dataframe gdf
(grouped by :id
). Requires the existence of columns containing the position and velocity of microbes. By convention the drift velocity will be positive for motion towards the target point.
Keywords
normalize = false
: whether drift velocities should be normalized by the instantaneous speed of the microbespos_key::Symbol = :position
: name of the column containing microbe positionsvel_key::Symbol = :velocity
: name of the column containing microbe velocities
sourceMicrobeAgents.Analysis.driftvelocity_direction!
— Functiondriftvelocity_direction!(adf, target; normalize=false, kwargs...)
-driftvelocity_direction!(gdf, target; normalize=false, kwargs...)
Evaluate the drift velocity of microbes along a target
direction, extracting their positions and velocities from the agent dataframe adf
or from the grouped dataframe gdf
(grouped by :id
). Requires the existence of a column containing the velocity of microbes. By convention the drift velocity will be positive for motion along the target directoin.
Keywords
normalize = false
: whether drift velocities should be normalized by the instantaneous speed of the microbesvel_key::Symbol = :velocity
: name of the column containing microbe velocities
sourceMissing docstring. Missing docstring for msd
. Check Documenter's build log for details.
Missing docstring. Missing docstring for acf
. Check Documenter's build log for details.
Settings
This document was generated with Documenter.jl version 1.4.1 on Tuesday 21 May 2024. Using Julia version 1.10.3.
+unfold!(gdf, extent; key=:position)
Unfold the periodic trajectories contained in the agent dataframe adf
or in the grouped dataframe gdf
where each microbe trajectory was grouped by :id
. The second argument can be either the spatial extent of the model, or the model itself from which the extent is automatically extracted.
The keyword argument key=:position
determines what column of the dataframe has to be unfolded.
Data analysis
MicrobeAgents.Analysis.detect_turns!
— Functiondetect_turns!(adf; threshold_angle=0.0, kwargs...)
Detect reorientations in the microbe trajectories in adf
. Requires adf
to have a velocity column. In order to be detected, a reorientation must be larger than the threshold_angle
(in radians); the threshold defaults to 0.
A new column is added to the dataframe, with values true
when the microbe has turned with respect to the previous frame, or false
otherwise.
Keywords
vel_key::Symbol = :velocity
: name of the column containing microbe velocitiesnew_key::Symbol = :has_turned
: name of the new column storing turn statistics
MicrobeAgents.Analysis.run_durations
— Functionrun_durations(adf; turns_key=:has_turned)
Evaluate the duration (in frames) of all runs detected during a simulation. The dataframe should already contain a column of Bools with values true
for frames when a turn has occurred and false
otherwise (see detect_turns!
). The function returns a vector of run durations for each microbe.
turns_key
defines the name of the column where the turn statistics is stored (defaults to :has_turned
).
MicrobeAgents.Analysis.driftvelocity_point!
— Functiondriftvelocity_point!(adf, target; normalize=false, kwargs...)
+driftvelocity_point!(gdf, target; normalize=false, kwargs...)
Evaluate the drift velocity of microbes towards a target
point, extracting their positions and velocities from the agent dataframe adf
or from the grouped dataframe gdf
(grouped by :id
). Requires the existence of columns containing the position and velocity of microbes. By convention the drift velocity will be positive for motion towards the target point.
Keywords
normalize = false
: whether drift velocities should be normalized by the instantaneous speed of the microbespos_key::Symbol = :position
: name of the column containing microbe positionsvel_key::Symbol = :velocity
: name of the column containing microbe velocities
MicrobeAgents.Analysis.driftvelocity_direction!
— Functiondriftvelocity_direction!(adf, target; normalize=false, kwargs...)
+driftvelocity_direction!(gdf, target; normalize=false, kwargs...)
Evaluate the drift velocity of microbes along a target
direction, extracting their positions and velocities from the agent dataframe adf
or from the grouped dataframe gdf
(grouped by :id
). Requires the existence of a column containing the velocity of microbes. By convention the drift velocity will be positive for motion along the target directoin.
Keywords
normalize = false
: whether drift velocities should be normalized by the instantaneous speed of the microbesvel_key::Symbol = :velocity
: name of the column containing microbe velocities
Missing docstring for msd
. Check Documenter's build log for details.
Missing docstring for acf
. Check Documenter's build log for details.