Module for the Follow-the-Leader model

Module for the Follow-the-Leader model

cromosim.ftl.plot_people(L, X, t, data, tgrid, periodicity=True, V_leader=None, speed_fct=None, savefig=False, filename='fig.png', ifig=100, spheresize=300)[source]

To plot people and their individual paths

Parameters
L: float

width of the domain

X: numpy array

positions of the individuals

data: numpy array

coordinates of indviduals at each time

tgrid: numpy array

temporal discretization

periodicity: boolean

if true the domain is periodic

V_leader: function

leader velocity as a function of the time

speed_fct: function

speed as a function of the distance

savefig: boolean

writes the figure as a png file if true

filename: string

png filename used to write the figure

ifig: int

figure number

spheresize: int

size of the spheres used to represent the individuals

cromosim.ftl.update_positions_ftl_order_1(L, X, t, dt, Phi, periodicity=True, V_leader=None)[source]

To update the positions according to the follow the leader model (order 1)

Parameters
L: float

width of the domain

X: numpy array

coordinates of the individuals

t: float

time

dt: float

time step

Phi: function

speed as a function of the distance

periodicity: boolean

if true the domain is periodic

V_leader: function

leader velocity as a function of the time

Returns
Xnew: numpy array

new coordinates of the individuals

V: numpy array

new velocities of the individuals

cromosim.ftl.update_positions_ftl_order_2(L, X, U, t, dt, tau, Phi, periodicity=True, V_leader=None)[source]

To update the positions according to the follow the leader model (order 2)

Parameters
L: float

width of the domain

X: numpy array

coordinates of the individuals

U: numpy array

velocities of the individuals

t: float

time

dt: float

time step

tau: float

the actual velocity of an individual relaxes toward the velocity that is associated to the current distance from the person in front of them with a characteristic time tau

Phi: function

speed as a function of the distance

periodicity: boolean

if true the domain is periodic

V_leader: function

leader velocity as a function of the time

Returns
Xnew: numpy array

new coordinates of the individuals

Unew: numpy array

new velocities of the individuals