7.6.2. pyafv.calibrate.DeformablePolygonSimulator

class DeformablePolygonSimulator(phys, num_vertices=100)[source]

Simulator for the deformable polygon (DP) model of cell doublets.

Parameters:
  • phys (PhysicalParams) – An instance of PhysicalParams containing the physical parameters, while phys.r and phys.delta are ignored.

  • num_vertices (int) – Number of vertices \(M\) to use for each cell.

Raises:

TypeError – If phys is not an instance of PhysicalParams.

Warning

If the target shape index (based on phys.P0 and phys.A0) indicates a non-circular shape, a UserWarning is raised since the DP model is not valid in that regime.

Attributes

pts1: ndarray

(N,2) array of vertices in cell 1.

pts2: ndarray

(N,2) array of vertices in cell 2.

contact_length: float

Current contact length.

detach_criterion: float

Contact length at which detachment occurs; defaults to \(2\pi \ell_0/M\).

detached: bool

Indicates whether the doublet has detached.

Methods

simulate(ext_force, dt, nsteps, resample_every=1000)[source]

Simulate the DP model for a number of time steps under an external force.

This is basically a wrapper around _step_update() and resample_polyline() with some bookkeeping.

Parameters:
  • ext_force (float) – The external force applied to the cell doublet.

  • dt (float) – Time step size.

  • nsteps (int) – Number of time steps to simulate.

  • resample_every (int) – How often (in steps) to resample the polygon vertices for uniform spacing.

Return type:

None

plot_2d(ax=None, show=False, **kw)[source]

Render a 2D snapshot of the cell doublet in DP model.

Parameters:
  • ax (Axes | None) – If provided, draw into the axes; otherwise get the current axes.

  • show (bool) – Whether to call plt.show() at the end.

  • line_color_in (str, optional) – Specifies the color for the contact edge.

  • line_color_out (str, optional) – Specifies the color for the vertices and non-contact edges.

  • line_width_in (float, optional) – Specifies the line width for the contact edge.

  • line_width_out (float, optional) – Specifies the line width for the non-contact edges.

  • point_size (float, optional) – Specifies the marker size for the vertices.

Returns:

The matplotlib axes containing the plot.

Return type:

Axes

_step_update(ext_force, dt)[source]

Single simulation step under external force.

Parameters:
  • ext_force (float) – The external force applied to the cell doublet.

  • dt (float) – Time step size.

Return type:

None

Warning

This is an internal method. Use with caution. We have implicitly assumed that the vertex mobility is \(\mu=1\) so that \(\Delta x= F \Delta t\).