Physiology
Physiology systems.
They cover delayed feedback, excitable tissue, the circulation, cell exchange, regulation, adaptivity, and tissues.
AdaptiveFlowNetworkSystem(side=6, *, alpha1=1.0, alpha2=1.0, gamma=2.0, inflow=None, seed=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A square grid of vessels whose conductances adapt.
It is fed at one corner and drained at every other node.
The pressures balance the flows at every node, h_i = sum_j C_ij (p_i - p_j), and every conductance grows with the
dissipated power and decays, dC_ij/dt = C_ij (alpha1 |p_i - p_j|^gamma - alpha2). Under a steady supply the
network settles where every surviving vessel carries the same pressure drop (alpha2 / alpha1)^(1 / gamma), so the
conductances grow with the flow each vessel must carry: the vessels near the source thicken into trunks and the
distal ones stay thin. The system has the conductances vessels.C on the edges of the grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
side
|
int
|
The number of nodes along each side of the grid. |
6
|
alpha1
|
float
|
The growth of the conductance with the pressure drop. |
1.0
|
alpha2
|
float
|
The decay rate of the conductance. |
1.0
|
gamma
|
float
|
The exponent of the pressure drop. |
2.0
|
inflow
|
float | None
|
The flow into the source at the first corner, which the other nodes drain equally, or |
None
|
seed
|
int | None
|
The seed of the initial conductances. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import AdaptiveFlowNetworkSystem
>>> AdaptiveFlowNetworkSystem(3).prepare().system_.elements[0].C.size
12
Source code in src/skcomplex/systems/biology/physiology/_transport.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
AdaptivePhaseCouplingInteraction(label, *, among, along=True, N=1.0, alpha=0.0, beta=0.0, epsilon=0.01)
Bases: Interaction
Phase coupling of the cells of a layer through adaptive links.
The links adapt to the phase differences they carry.
Along the link from cell j to cell i, dphi_i/dt += -(a_ij + kappa_ij) sin(phi_i - phi_j + alpha) / N and
dkappa_ij/dt = -epsilon (kappa_ij + sin(phi_i - phi_j - beta)). The phase lag alpha sets the preferred phase
difference of the coupling, and the age parameter beta the rule of the adaptation. The links are the element on
the edges the coupling runs along.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
among
|
Role
|
The path of the group of cells on the nodes. |
required |
along
|
bool | str
|
The edges of the layer, |
True
|
N
|
Annotated[float, open(0, oo)]
|
The number of cells of the layer, which normalizes the coupling. |
1.0
|
alpha
|
float
|
The phase lag of the coupling. |
0.0
|
beta
|
float
|
The age parameter of the adaptation. |
0.0
|
epsilon
|
Annotated[float, closed_open(0, oo)]
|
The adaptation rate. |
0.01
|
Examples:
>>> from skcomplex.systems.biology.physiology import AdaptivePhaseCouplingInteraction
>>> AdaptivePhaseCouplingInteraction('coupling', among='cells', along='immune', epsilon=0.3).epsilon
0.3
Source code in src/skcomplex/systems/biology/physiology/_disease.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
AdaptiveResponderElement(label, *, e=0.0, c=0.2, S=1.0, response_cost=0.0, restore_cost=0.0, repair_cost=0.0, prepare_cost=0.0, eta=0.5, anticipation=0.0, c0=0.2, tau=50.0, k0=0.1, kappa=0.2, price=1.0, theta=1.0, repair=5.0, upkeep=0.05, height=1.0, width=2.0, period=10.0, start=1.0)
Bases: Element
System that counters episodes of demand on a critical parameter.
It pays for its response in four costs.
The excursion of the critical parameter follows de/dt = (1 - a) s(t) - c e - k0 e, where the stimulus s is a
train of episodes of height height and width width every period from start, c e is the response of a
mechanism of capacity c, and a is the share of every episode that anticipation avoids. The capacity grows with
the demand and decays to its baseline, dc/dt = eta e^2 - (c - c0) / tau, and the response draws the reserves,
which are restored, dS/dt = -c e + kappa (1 - S). The four costs of Mobus accumulate as stocks: the response cost
is the response effort c e, the restore cost the work price kappa (1 - S) of refilling the reserves, the repair
cost repair (e - theta) while the excursion exceeds the damage threshold theta, and the preparedness cost the
upkeep upkeep (c - c0 + a) of the extra capacity and of the anticipation.
The element holds the states and parameters and has no laws of its own: the interactions of
AdaptiveResponseCostsSystem read its parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the system. |
required |
e
|
float
|
The initial excursion of the critical parameter. |
0.0
|
c
|
Annotated[float, closed_open(0, oo)]
|
The initial capacity of the response. |
0.2
|
S
|
float
|
The initial reserves, 1 when full. |
1.0
|
response_cost
|
Annotated[float, closed_open(0, oo)]
|
The initial response cost. |
0.0
|
restore_cost
|
Annotated[float, closed_open(0, oo)]
|
The initial restore cost. |
0.0
|
repair_cost
|
Annotated[float, closed_open(0, oo)]
|
The initial repair cost. |
0.0
|
prepare_cost
|
Annotated[float, closed_open(0, oo)]
|
The initial preparedness cost. |
0.0
|
eta
|
Annotated[float, closed_open(0, oo)]
|
The rate at which demand builds capacity, 0 for a fixed stimulus-response. |
0.5
|
anticipation
|
Annotated[float, closed_open(0, oo)]
|
The share |
0.0
|
c0
|
Annotated[float, closed_open(0, oo)]
|
The baseline capacity. |
0.2
|
tau
|
Annotated[float, open(0, oo)]
|
The time over which unused capacity decays. |
50.0
|
k0
|
Annotated[float, closed_open(0, oo)]
|
The homeostatic relaxation rate of the excursion. |
0.1
|
kappa
|
Annotated[float, closed_open(0, oo)]
|
The rate of restoring the reserves. |
0.2
|
price
|
Annotated[float, closed_open(0, oo)]
|
The cost of restoring a unit of reserves. |
1.0
|
theta
|
Annotated[float, closed_open(0, oo)]
|
The excursion above which damage accrues. |
1.0
|
repair
|
Annotated[float, closed_open(0, oo)]
|
The repair cost per unit of excursion above the threshold and per unit time. |
5.0
|
upkeep
|
Annotated[float, closed_open(0, oo)]
|
The cost per unit time of a unit of extra capacity or of anticipation. |
0.05
|
height
|
float
|
The height of the episodes. |
1.0
|
width
|
float
|
The duration of the episodes. |
2.0
|
period
|
float
|
The time between the starts of episodes. |
10.0
|
start
|
float
|
The start of the first episode. |
1.0
|
Examples:
>>> from skcomplex.systems.biology.physiology import AdaptiveResponderElement
>>> AdaptiveResponderElement('organism').period
10.0
Source code in src/skcomplex/systems/biology/physiology/_adaptivity.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
AdaptiveResponseCostsSystem(strategy='adaptive', *, height=1.0, width=2.0, period=10.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A system that meets recurring demands, by response or by anticipation.
It meets them by stimulus-response, adaptive response, or anticipation.
Episodes of demand push a critical parameter away from its norm, and the system counters them, after Mobus. A
stimulus-response keeps its baseline capacity, so large episodes overshoot the damage threshold and cost repairs. An
adaptive response builds capacity under repeated demand and loses it when demand stops, at the price of its upkeep.
An anticipatory response also predicts every episode and avoids half of it. Mobus's objective is the sum of the
response, restore, and repair costs over the episodes, with the preparedness cost amortized over them: adaptive
response lowers it below stimulus-response by avoiding repairs, and anticipation lowers it further by cutting the
response it needs. The system has the excursion organism.e, the capacity organism.c, the reserves organism.S,
and the costs organism.response_cost, organism.restore_cost, organism.repair_cost, and
organism.prepare_cost.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strategy
|
str
|
|
'adaptive'
|
height
|
float
|
The height of the episodes of demand. |
1.0
|
width
|
float
|
The duration of the episodes. |
2.0
|
period
|
float
|
The time between the starts of episodes. |
10.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The strategy is unknown. |
Examples:
>>> from skcomplex.systems.biology.physiology import AdaptiveResponseCostsSystem
>>> AdaptiveResponseCostsSystem('stimulus-response').prepare().system_.elements[0].eta
0.0
Source code in src/skcomplex/systems/biology/physiology/_adaptivity.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
AlievPanfilovElement(label, *, u=0.0, v=0.0, k=8.0, a=0.15, epsilon0=0.002, mu1=0.2, mu2=0.3, space=None)
Bases: Element
Cardiac tissue of Aliev and Panfilov, with its potential and recovery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the tissue. |
required |
u
|
float | Array
|
The initial potential. |
0.0
|
v
|
float | Array
|
The initial recovery. |
0.0
|
k
|
Annotated[float | Array, open(0, oo)]
|
The strength of the excitation. |
8.0
|
a
|
Annotated[float | Array, open(0, oo)]
|
The excitation threshold. |
0.15
|
epsilon0
|
Annotated[float | Array, open(0, oo)]
|
The recovery rate far from the excited state. |
0.002
|
mu1
|
Annotated[float | Array, closed_open(0, oo)]
|
The growth of the recovery rate with the recovery. |
0.2
|
mu2
|
Annotated[float | Array, open(0, oo)]
|
The offset of the recovery rate. |
0.3
|
space
|
BaseSpace | None
|
The space whose sites hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import AlievPanfilovElement
>>> AlievPanfilovElement('tissue').k
8.0
Source code in src/skcomplex/systems/biology/physiology/_cardiac.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
AlievPanfilovInteraction(label, *, target)
Bases: Interaction
Excitation and recovery of cardiac tissue of Aliev and Panfilov, an excitable medium.
The potential follows u' = -k u (u - a) (u - 1) - u v and the recovery v' = (epsilon0 + mu1 v / (u + mu2))
(-v - k u (u - a - 1)), and a diffusion of the potential couples the cells of the tissue. The recovery rate
depends on the state, so the action potential lasts longer than in the FitzHugh-Nagumo medium and its duration
adapts to the pacing rate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the tissue, whose values are |
required |
Examples:
>>> from skcomplex.systems.biology.physiology import AlievPanfilovInteraction
>>> AlievPanfilovInteraction('kinetics', target='tissue').target
'tissue'
Source code in src/skcomplex/systems/biology/physiology/_cardiac.py
111 112 113 | |
AlievPanfilovSystem(shape=(100, 100), *, D=1.0, k=8.0, a=0.15, epsilon0=0.002, mu1=0.2, mu2=0.3, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The Aliev-Panfilov system of cardiac tissue, started from a broken wave.
The broken wave curls into a spiral.
A spiral wave in heart muscle is a re-entrant arrhythmia, a tachycardia, and its breakup into many waves systems
fibrillation. The upper half of the tissue starts excited and its left half refractory, so the free end of the wave
rotates. The system has the potential tissue.u and the recovery tissue.v.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the lattice with zero-flux edges. |
(100, 100)
|
D
|
float
|
The diffusion of the potential. |
1.0
|
k
|
float
|
The strength of the excitation. |
8.0
|
a
|
float
|
The excitation threshold. |
0.15
|
epsilon0
|
float
|
The recovery rate far from the excited state. |
0.002
|
mu1
|
float
|
The growth of the recovery rate with the recovery. |
0.2
|
mu2
|
float
|
The offset of the recovery rate. |
0.3
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import AlievPanfilovSystem
>>> AlievPanfilovSystem((20, 20)).prepare().system_.elements[0].k
8.0
Source code in src/skcomplex/systems/biology/physiology/_cardiac.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
BarkleySystem(shape=(64, 64), *, spacing=3.0, d=1.0, a=0.6, b=0.05, epsilon=0.02, gamma=1.0, label='system', solver='auto', backend='auto')
Bases: ReactionDiffusionSystem
Barkley's excitable medium, started from orthogonal stripes.
The crossing of the stripes curls into a spiral wave.
The excitation u and the recovery w start as orthogonal stripes of zeros and ones, so the excited stripe runs
into recovering tissue on one side only and its free end rotates. With (a, b, d, epsilon) = (0.6, 0.05, 1, 0.02)
the spiral is stable for gamma = 1. With (0.7, 0.05, 1, 0.08) and gamma = 3 it breaks up into spatiotemporal
chaos. The source runs a domain of 300 by 300, and the default lattice covers 192 by 192 with a spacing of 3, wide
enough for the stable spiral. The system has the excitation medium.u and the recovery medium.w.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the lattice with zero-flux edges. |
(64, 64)
|
spacing
|
float
|
The distance between neighbouring sites. |
3.0
|
d
|
float
|
The diffusion of the excitation. |
1.0
|
a
|
float
|
The inverse slope of the threshold. |
0.6
|
b
|
float
|
The offset of the threshold. |
0.05
|
epsilon
|
float
|
The ratio of the time scales of the recovery and the excitation. |
0.02
|
gamma
|
float
|
The exponent of the excitation in the recovery. |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import BarkleySystem
>>> BarkleySystem((20, 20), gamma=3.0).prepare().system_.elements[0].values['gamma']
3.0
Source code in src/skcomplex/systems/biology/physiology/_cardiac.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
BranchingVesselElement(label, *, r=1.0, l=1.0, volume=1.0, terminal=0.0, level=1.0, depth=1.0, n=2.0, r_c=1.0, l_c=1.0, space=None, on=None)
Bases: Element
Vessels of a space-filling branching network, with their sizes and levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the vessel or of the group on the edges. |
required |
r
|
Annotated[float | Array, closed_open(0, oo)]
|
The radius. |
1.0
|
l
|
Annotated[float | Array, closed_open(0, oo)]
|
The length. |
1.0
|
volume
|
Annotated[float | Array, closed_open(0, oo)]
|
The volume. |
1.0
|
terminal
|
Annotated[float | Array, closed(0, 1)]
|
Whether the vessel is a capillary. |
0.0
|
level
|
Annotated[float | Array, closed_open(0, oo)]
|
The level of the vessel, 1 for the aorta's daughters and |
1.0
|
depth
|
Annotated[float | Array, closed_open(0, oo)]
|
The level of the capillaries. |
1.0
|
n
|
Annotated[float | Array, open(1, oo)]
|
The branching ratio. |
2.0
|
r_c
|
Annotated[float | Array, open(0, oo)]
|
The radius of a capillary. |
1.0
|
l_c
|
Annotated[float | Array, open(0, oo)]
|
The length of a capillary. |
1.0
|
space
|
BaseSpace | None
|
The space whose sites hold one member each, or |
None
|
on
|
str | None
|
|
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import BranchingVesselElement
>>> BranchingVesselElement('vessel', level=3.0).level
3.0
Source code in src/skcomplex/systems/biology/physiology/_distribution_networks.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
CardiovascularSystem(*, heart_rate=75.0, E_max=2.5, R_systemic=1.0, C_arterial=1.3, C_venous=50.0, volume=1500.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A closed lumped system of the systemic circulation.
A left ventricle of varying elastance drives it.
Blood leaves the ventricle through the aortic valve into the compliant arteries, flows through the systemic
resistance into the veins, and returns through the mitral valve. The ventricle stiffens in systole, so the system
beats, the valves open and close, and the total volume of blood stays constant. With the defaults the arterial
pressure swings between about 80 and 120 mmHg. The system has the volumes ventricle.V, arteries.V, and
veins.V.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
heart_rate
|
float
|
The number of beats per minute. |
75.0
|
E_max
|
float
|
The largest elastance of the ventricle in mmHg/ml. |
2.5
|
R_systemic
|
float
|
The systemic resistance in mmHg s/ml. |
1.0
|
C_arterial
|
float
|
The arterial compliance in ml/mmHg. |
1.3
|
C_venous
|
float
|
The venous compliance in ml/mmHg. |
50.0
|
volume
|
float
|
The total volume of blood in ml, split at the start among the ventricle, arteries, and veins. |
1500.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import CardiovascularSystem
>>> sum(chamber.V for chamber in CardiovascularSystem().prepare().system_.elements)
1500.0
Source code in src/skcomplex/systems/biology/physiology/_circulation.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
CellAdhesionInteraction(label, *, target, kinds, adhesion, temperature=1.0, area_strength=1.0, target_area=40.0, perimeter_strength=0.0, target_perimeter=0.0, state='cell', rule='metropolis', neighborhood=None, hits=1)
Bases: RegionSamplingInteraction
Cellular Potts sampling of a tissue, whose cells move their boundaries.
The cells move under adhesion and area constraints.
The energy of the Graner-Glazier model is sum_<i,j> w_ij J(t(s_i), t(s_j)) [s_i != s_j] + lambda sum_s (a_s -
A)^2 + mu sum_s (p_s - P)^2, where s_i is the cell of site i, t(s) the kind of cell s, J the adhesion
energy per unit contact between kinds, w_ij the weight of the contact of two sites, a_s the area of a cell, and
p_s its perimeter, the weighted number of its contacts with other cells. Every sweep proposes hits copies per
site of the cell of a random neighbour into a random site, accepted by the Metropolis rule at the temperature. A
heterotypic adhesion above the mean of the homotypic ones sorts the kinds, the differential adhesion of Steinberg.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
target
|
Role
|
The path of the group of sites. |
required |
kinds
|
Sequence[int]
|
The kind of every cell, by label. |
required |
adhesion
|
ArrayLike
|
The adhesion energy per unit contact between cells of every pair of kinds, a symmetric matrix. |
required |
temperature
|
Annotated[float, open(0, oo)]
|
The temperature of the copies, the amplitude of the fluctuations of the cell boundaries. |
1.0
|
area_strength
|
Annotated[float, closed_open(0, oo)]
|
The strength |
1.0
|
target_area
|
Annotated[float, closed_open(0, oo)]
|
The target area |
40.0
|
perimeter_strength
|
Annotated[float, closed_open(0, oo)]
|
The strength |
0.0
|
target_perimeter
|
Annotated[float, closed_open(0, oo)]
|
The target perimeter |
0.0
|
state
|
str
|
The name of the state that holds the cell of a site. |
'cell'
|
rule
|
str
|
The acceptance, |
'metropolis'
|
neighborhood
|
BaseNeighborhood | None
|
The neighbours of a site, or |
None
|
hits
|
int
|
The number of copies proposed per site and sweep. |
1
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The adhesion is not a symmetric square matrix, or a kind is not one of its rows. |
Examples:
>>> from skcomplex.systems.biology.physiology import CellAdhesionInteraction
>>> adhesion = CellAdhesionInteraction('adhesion', target='tissue', kinds=(0, 1), adhesion=((1, 2), (2, 1)))
>>> adhesion.objective.contact(np.array([0, 0]), np.array([0, 1])).tolist()
[1.0, 2.0]
Source code in src/skcomplex/systems/biology/physiology/_cellular_potts.py
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | |
CellOscillatorElement(label, *, phi=0.0, omega=0.0, space=None)
Bases: Element
Cell oscillators, functional units of a tissue layer reduced to a phase phi and a natural frequency omega.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cell or of the group of cells. |
required |
phi
|
Annotated[float | Array, Period(2 * pi)]
|
The initial phase. |
0.0
|
omega
|
float | Array
|
The natural frequency. |
0.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one cell each, or |
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import CellOscillatorElement
>>> CellOscillatorElement('cell', omega=0.2).omega
0.2
Source code in src/skcomplex/systems/biology/physiology/_disease.py
52 53 54 55 56 57 58 59 60 61 62 | |
CellRotationInteraction(label, *, target)
Bases: Interaction
Rotation of the phase of cell oscillators at their natural frequency, phi' = omega.
Healthy and pathological cells differ by their metabolism, which the natural frequency omega stands for.
Couplings to other cells add to the rate of the phase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the cells, whose values are |
required |
Examples:
>>> from skcomplex.systems.biology.physiology import CellRotationInteraction
>>> CellRotationInteraction('rotation', target='cells').target
'cells'
Source code in src/skcomplex/systems/biology/physiology/_disease.py
86 87 88 | |
CellularPottsSystem(shape=(40, 40), *, lattice='square', cell_shape=(5, 8), adhesion=DEFAULT_ADHESION, temperature=2.0, area_strength=1.0, perimeter_strength=0.0, target_perimeter=0.0, hits=1, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The cellular Potts model of a confluent tissue sorting by differential adhesion.
Its cells are of several kinds.
Every site of a periodic lattice belongs to one cell, and the cells start as rectangles of cell_shape sites, whose
area is the target area, with kinds in equal shares at random. Label copies sample the energy sum_<i,j> w_ij J(t_i,
t_j) [s_i != s_j] + lambda sum_s (a_s - A)^2 + mu sum_s (p_s - P)^2 of Nemati and de Graaf (2024), Eq. 3, extended
to the adhesion J between kinds of Graner and Glazier (1992). The square lattice reads the Moore neighbourhood and
the triangular lattice the six nearest neighbours, both with unit weights, and the disordered lattice is the
periodic Voronoi tessellation of one jittered point per unit area, whose sites have the area of their Voronoi cell
and touch along sides of weight w_ij, the length of the side over the mean length. A heterotypic adhesion above
the mean of the homotypic ones raises the share of contacts between cells of one kind. The system has the states
tissue.cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the lattice, or of points of the disordered lattice, multiples of the cell shape. |
(40, 40)
|
lattice
|
str
|
|
'square'
|
cell_shape
|
Sequence[int]
|
The rows and columns of the initial rectangle of every cell, whose area is the target area. |
(5, 8)
|
adhesion
|
ArrayLike
|
The adhesion energy per unit contact between kinds, a symmetric matrix with one row per kind. |
DEFAULT_ADHESION
|
temperature
|
float
|
The temperature of the label copies. |
2.0
|
area_strength
|
float
|
The strength |
1.0
|
perimeter_strength
|
float
|
The strength |
0.0
|
target_perimeter
|
float
|
The target perimeter |
0.0
|
hits
|
int
|
The number of copies proposed per site and sweep. |
1
|
random_state
|
int | Generator | None
|
The seed or generator of the kinds of the cells and of the disordered lattice. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The lattice is unknown, or the shape is not a multiple of the cell shape. |
Examples:
>>> from skcomplex.systems.biology.physiology import CellularPottsSystem
>>> system = CellularPottsSystem((10, 16)).prepare().system_
>>> system.interactions[0].kinds
(0, 0, 1, 1)
>>> system = CellularPottsSystem((10, 16), lattice='disordered').prepare().system_
>>> system.elements[0].space.graph.number_of_nodes()
160
Source code in src/skcomplex/systems/biology/physiology/_cellular_potts.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
ChamberElement(label, *, V=100.0, V0=0.0, E_min=1.0, E_max=1.0, period=0.8, systole=0.3)
Bases: Element
Elastic compartment of blood, a heart chamber or a vascular bed.
Its pressure is the elastance times the volume.
The pressure is E(t) (V - V0). The elastance of a heart chamber rises from E_min to E_max and back as a half
sine during the systole that starts every period, and the elastance of a vessel stays at E_min when E_max
equals it. Volumes are in ml, pressures in mmHg, and times in s.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the chamber. |
required |
V
|
Annotated[float, closed_open(0, oo)]
|
The initial volume. |
100.0
|
V0
|
Annotated[float, closed_open(0, oo)]
|
The unstressed volume. |
0.0
|
E_min
|
Annotated[float, open(0, oo)]
|
The elastance in diastole, the inverse of the compliance. |
1.0
|
E_max
|
Annotated[float, open(0, oo)]
|
The largest elastance in systole. |
1.0
|
period
|
Annotated[float, open(0, oo)]
|
The duration of a heartbeat. |
0.8
|
systole
|
Annotated[float, open(0, oo)]
|
The duration of the contraction. |
0.3
|
Examples:
>>> from skcomplex.systems.biology.physiology import ChamberElement
>>> ChamberElement('arteries', V=150.0, E_min=0.8, E_max=0.8).E_max
0.8
Source code in src/skcomplex/systems/biology/physiology/_circulation.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
ChemotacticTissueElement(label, *, n=0.0, qx=0.0, qy=0.0, c=0.0, jx=0.0, jy=0.0, s=100.0, mu1=5000.0, mu2=5000.0, sigma=5000000.0, tau=1.0, alpha=0.33, space=None)
Bases: Element
Sites of a tissue, with the densities and fluxes of cells and a chemical that move with finite speeds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the tissue. |
required |
n
|
float | Array
|
The initial cell density. |
0.0
|
qx
|
float | Array
|
The initial flux of cells along the first axis. |
0.0
|
qy
|
float | Array
|
The initial flux of cells along the second axis. |
0.0
|
c
|
float | Array
|
The initial chemical density. |
0.0
|
jx
|
float | Array
|
The initial flux of the chemical along the first axis. |
0.0
|
jy
|
float | Array
|
The initial flux of the chemical along the second axis. |
0.0
|
s
|
Annotated[float | Array, open(0, oo)]
|
The speed of the cells and of the chemical. |
100.0
|
mu1
|
Annotated[float | Array, closed_open(0, oo)]
|
The turning rate of the cells. |
5000.0
|
mu2
|
Annotated[float | Array, closed_open(0, oo)]
|
The rate of turning of the cells towards the chemical. |
5000.0
|
sigma
|
Annotated[float | Array, closed_open(0, oo)]
|
The turning rate of the chemical. |
5000000.0
|
tau
|
Annotated[float | Array, open(0, oo)]
|
The time scale of the chemical. |
1.0
|
alpha
|
float | Array
|
The chemotactic sensitivity of the cells. |
0.33
|
space
|
BaseSpace | None
|
The space whose sites hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import ChemotacticTissueElement
>>> ChemotacticTissueElement('tissue').alpha
0.33
Source code in src/skcomplex/systems/biology/physiology/_chemotaxis.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
ClosedContourCellExchangeSystem(n_cells=8, *, r=2.5, c=0.1, p=0.5, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The exchange of signalling molecules between logistic cells.
The cells are arranged in a closed contour.
Every cell runs the logistic map on its concentration and takes up a share c_i of its next state from the next
cell through the power map x_{i+1}^{p_i}, x_i <- (1 - c_i) r x_i (1 - x_i) + c_i x_{i+1}^{p_i}. Mihailović et
al. show that an equilibrium is asymptotically stable for every coupling when every x_i lies in ((r - 1) / 2r, (r
+ 1) / 2r) and above p_{i-1}^(1 / (1 - p_{i-1})). In this domain the cells synchronize to a common concentration,
and a chaotic environment, r near 4, desynchronizes them. The system has the concentrations cells.x, cell i +
1 next to cell i.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_cells
|
int
|
The number of cells of the contour. |
8
|
r
|
float
|
The logistic parameter of every cell. |
2.5
|
c
|
float | Sequence[float]
|
The coupling of every cell to the next, one value or one per cell. |
0.1
|
p
|
float | Sequence[float]
|
The affinity of every cell for the uptake, one value or one per cell. |
0.5
|
random_state
|
int | Generator | None
|
The seed or generator of the initial concentrations, uniform between 0.2 and 0.8. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import ClosedContourCellExchangeSystem
>>> ClosedContourCellExchangeSystem(5).prepare().system_.elements[0].size
5
Source code in src/skcomplex/systems/biology/physiology/_exchange.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
CoagulationElement(label, *, T=0.0, C=0.0, F=0.0, P=0.0, ka=3.0, k_half=1.0, d_t=1.0, k_c=1.0, s_c=0.1, d_c=0.05, s_f=1.0, k_p=1.0, s_p=0.02, d_p=0.1, injury=1.0, injury_time=1.0, duration=1.0)
Bases: Element
Coagulation cascade, thrombin amplified by positive feedback.
Protein C switches it off, and fibrinolysis clears the clot.
An injury of height injury from injury_time for duration activates thrombin, which activates more of itself
through the feedback of the cascade, dT/dt = j(t) + ka T^2 / (k_half^2 + T^2) - (d_t + k_c C) T. Thrombin
activates the inhibitor protein C, dC/dt = s_c T - d_c C, and converts fibrinogen to fibrin,
dF/dt = s_f T - k_p P F. Fibrin activates plasmin, dP/dt = s_p F - d_p P, which dissolves the fibrin.
The element holds the states and parameters and has no laws of its own: the interactions of
CoagulationPositiveFeedbackSystem read its parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the blood. |
required |
T
|
Annotated[float, closed_open(0, oo)]
|
The initial thrombin. |
0.0
|
C
|
Annotated[float, closed_open(0, oo)]
|
The initial activated protein C. |
0.0
|
F
|
Annotated[float, closed_open(0, oo)]
|
The initial fibrin. |
0.0
|
P
|
Annotated[float, closed_open(0, oo)]
|
The initial plasmin. |
0.0
|
ka
|
Annotated[float, closed_open(0, oo)]
|
The maximal rate of the positive feedback. |
3.0
|
k_half
|
Annotated[float, open(0, oo)]
|
The thrombin at which the feedback is half its maximum. |
1.0
|
d_t
|
Annotated[float, closed_open(0, oo)]
|
The inactivation rate of thrombin by antithrombin. |
1.0
|
k_c
|
Annotated[float, closed_open(0, oo)]
|
The inactivation of thrombin per unit of protein C. |
1.0
|
s_c
|
Annotated[float, closed_open(0, oo)]
|
The activation of protein C per unit of thrombin. |
0.1
|
d_c
|
Annotated[float, closed_open(0, oo)]
|
The inactivation rate of protein C. |
0.05
|
s_f
|
Annotated[float, closed_open(0, oo)]
|
The production of fibrin per unit of thrombin. |
1.0
|
k_p
|
Annotated[float, closed_open(0, oo)]
|
The lysis of fibrin per unit of plasmin. |
1.0
|
s_p
|
Annotated[float, closed_open(0, oo)]
|
The activation of plasmin per unit of fibrin. |
0.02
|
d_p
|
Annotated[float, closed_open(0, oo)]
|
The inactivation rate of plasmin. |
0.1
|
injury
|
Annotated[float, closed_open(0, oo)]
|
The rate of thrombin activation by the injury. |
1.0
|
injury_time
|
float
|
The start of the injury. |
1.0
|
duration
|
float
|
The duration of the injury. |
1.0
|
Examples:
>>> from skcomplex.systems.biology.physiology import CoagulationElement
>>> CoagulationElement('blood').injury_time
1.0
Source code in src/skcomplex/systems/biology/physiology/_regulation.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
CoagulationPositiveFeedbackSystem(*, injury=1.0, injury_time=1.0, duration=1.0, ka=3.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The coagulation cascade, an all-or-nothing burst of thrombin.
Protein C and fibrinolysis bound the burst.
Thrombin activates its own production through the factors of the cascade, a positive feedback that amplifies an
injury above a threshold into a burst of thrombin and a clot of fibrin, while a weaker injury fades. With the
default rates, the burst needs a thrombin of (ka - sqrt(ka^2 - 4)) / 2, the unstable state of the feedback.
Thrombin also activates protein C, which switches the burst off, and the fibrin activates plasmin, which dissolves
the clot, so the clot stays at the site and in time. The positive feedback, the off switch, and the fibrinolysis
follow Konieczny et al. The system has the thrombin blood.T, the protein C blood.C, the fibrin blood.F, and
the plasmin blood.P.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
injury
|
float
|
The rate of thrombin activation by the injury. |
1.0
|
injury_time
|
float
|
The start of the injury. |
1.0
|
duration
|
float
|
The duration of the injury. |
1.0
|
ka
|
float
|
The maximal rate of the positive feedback, which is bistable above 2. |
3.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import CoagulationPositiveFeedbackSystem
>>> CoagulationPositiveFeedbackSystem(injury=0.2).prepare().system_.elements[0].injury
0.2
Source code in src/skcomplex/systems/biology/physiology/_regulation.py
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
ContourCellElement(label, *, x=0.5, r=2.5, c=0.1, p=0.5, size=None)
Bases: Element
Logistic cell of a closed contour that takes up molecules of the next cell.
It takes up the signalling molecules of the next cell through a power map.
ContourUptakeInteraction iterates x_i <- (1 - c_i) r x_i (1 - x_i) + c_i x_{i+1}^{p_i}, where the logistic map
is the intracellular dynamics, c_i the share of the exchange with the environment between the cells, and p_i
the affinity of the cell for the uptake. The last cell of the contour takes up from the first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the group of cells. |
required |
x
|
Annotated[float | Array, closed_open(0, oo)]
|
The initial concentration of signalling molecules in the cell, between 0 and 1. |
0.5
|
r
|
Annotated[float | Array, closed_open(0, oo)]
|
The logistic parameter, the disposition of the environment to communication. |
2.5
|
c
|
Annotated[float | Array, closed_open(0, oo)]
|
The coupling of the cell to the next one. |
0.1
|
p
|
Annotated[float | Array, closed_open(0, oo)]
|
The affinity of the cell for the uptake of signalling molecules. |
0.5
|
size
|
int | None
|
The number of members, or |
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import ContourCellElement
>>> ContourCellElement('cells').r
2.5
Source code in src/skcomplex/systems/biology/physiology/_exchange.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
ContourUptakeInteraction(label, *, target)
Bases: Interaction
Uptake of every cell of a contour from the next cell.
It is x_i <- (1 - c_i) r x_i (1 - x_i) + c_i x_{i+1}^p_i.
It is the map form of coupling to the next member of the group, with the power x_{i+1}^{p_i} of the next cell
combined with the logistic map of the cell. The last cell of the contour takes up from the first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
target
|
Role
|
The path of the group of cells. |
required |
Examples:
>>> import numpy as np
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.physiology import ContourCellElement, ContourUptakeInteraction
>>> cells = ContourCellElement('cells', x=np.array([0.25, 1.0]), c=0.5, size=2)
>>> uptake = ContourUptakeInteraction('uptake', target='cells')
>>> system = System(elements=[cells], interactions=[uptake]).prepare()
>>> system.simulate(until=1).get_values('cells.x')[-1].round(4).tolist()
[0.7344, 0.25]
Source code in src/skcomplex/systems/biology/physiology/_exchange.py
198 199 200 | |
CytokineLinkElement(label, *, kappa=0.0, a=0.0, space=None, on=None)
Bases: Element
Link between two cells of a layer.
It has a fixed connectivity a and an adaptive cytokine coupling kappa.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the link or of the group on the edges. |
required |
kappa
|
Annotated[float | Array, closed(-1, 1)]
|
The initial adaptive coupling, between -1 and 1. |
0.0
|
a
|
Annotated[float | Array, closed(0, 1)]
|
The fixed connectivity, between 0 and 1. |
0.0
|
space
|
BaseSpace | None
|
The network whose edges hold one link each, or |
None
|
on
|
str | None
|
The edges of the network that hold the links, |
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import CytokineLinkElement
>>> CytokineLinkElement('link', a=1.0).a
1.0
Source code in src/skcomplex/systems/biology/physiology/_disease.py
129 130 131 132 133 134 135 136 137 138 139 140 | |
DrugToxicityElement(label, *, c=0.0, T=0.0, k=0.5, eta=0.05, dose=1.0, period=7.0, width=1.0, doses=6)
Bases: Element
Drug in the plasma, and the toxicity it accumulates.
The drug is given in a train of infusions and eliminated.
The plasma concentration follows dc/dt = u(t) - k c, where the infusion u is dose for width time units
every period, and the toxicity dT/dt = c - eta T, which the metabolism lowers at the rate eta.
The element holds the states and parameters and has no laws of its own: the interactions of DrugToxicitySystem
read its parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the patient. |
required |
c
|
Annotated[float, closed_open(0, oo)]
|
The initial plasma concentration. |
0.0
|
T
|
Annotated[float, closed_open(0, oo)]
|
The initial toxicity. |
0.0
|
k
|
Annotated[float, closed_open(0, oo)]
|
The elimination rate of the drug. |
0.5
|
eta
|
Annotated[float, closed_open(0, oo)]
|
The rate at which the metabolism lowers the toxicity, 0 for a cumulative toxicity. |
0.05
|
dose
|
Annotated[float, closed_open(0, oo)]
|
The infusion rate during a dose. |
1.0
|
period
|
float
|
The time between the starts of doses. |
7.0
|
width
|
float
|
The duration of a dose. |
1.0
|
doses
|
int
|
The number of doses. |
6
|
Examples:
>>> from skcomplex.systems.biology.physiology import DrugToxicityElement
>>> DrugToxicityElement('patient', doses=4).doses
4
Source code in src/skcomplex/systems/biology/physiology/_toxicity.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
DrugToxicitySystem(*, k=0.5, eta=0.05, dose=1.0, period=7.0, width=1.0, doses=6, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The toxicity a weekly drug accumulates in the body.
The metabolism clears it once the doses stop.
Every dose raises the plasma concentration, which the body eliminates within days, and the toxicity integrates the
concentration, dT/dt = c - eta T. With eta = 0 the toxicity is the cumulative exposure and never falls. The
system has the concentration patient.c and the toxicity patient.T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
float
|
The elimination rate of the drug, per day. |
0.5
|
eta
|
float
|
The rate at which the metabolism lowers the toxicity, per day. |
0.05
|
dose
|
float
|
The infusion rate during a dose. |
1.0
|
period
|
float
|
The time between the starts of doses, in days. |
7.0
|
width
|
float
|
The duration of a dose, in days. |
1.0
|
doses
|
int
|
The number of doses. |
6
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import DrugToxicitySystem
>>> DrugToxicitySystem(eta=0.0).prepare().system_.elements[0].eta
0.0
Source code in src/skcomplex/systems/biology/physiology/_toxicity.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
ExchangingCellElement(label, *, x=1.0, alpha=1.0, beta=10.0, g=0.1, xi=0.0, space=None)
Bases: Element
Cells that metabolize a substance and exchange it with their neighbours.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the field of cells. |
required |
x
|
float | Array
|
The initial concentration of the substance. |
1.0
|
alpha
|
Annotated[float | Array, closed_open(0, oo)]
|
The maximal rate of metabolism. |
1.0
|
beta
|
Annotated[float | Array, open(0, oo)]
|
The half-saturation concentration of metabolism. |
10.0
|
g
|
Annotated[float | Array, closed_open(0, oo)]
|
The exchange coefficient of the gap junctions. |
0.1
|
xi
|
Annotated[float | Array, closed_open(0, oo)]
|
The strength of the nanotubes. |
0.0
|
space
|
BaseSpace | None
|
The space whose sites hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import ExchangingCellElement
>>> ExchangingCellElement('cells').g
0.1
Source code in src/skcomplex/systems/biology/physiology/_exchange.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
FitzhughNagumoSystem(shape=(100, 100), *, D=1.0, a=0.7, b=0.8, epsilon=0.02, label='system', solver='auto', backend='auto')
Bases: ReactionDiffusionSystem
The FitzHugh-Nagumo excitable medium, started from a broken wave.
The broken wave curls into a spiral.
The upper half starts excited and the left half refractory, so the free end of the wave rotates. The system has the
potential medium.u and the recovery medium.v.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the lattice with zero-flux edges. |
(100, 100)
|
D
|
float
|
The diffusion of the potential |
1.0
|
a
|
float
|
The offset of the recovery. |
0.7
|
b
|
float
|
The damping of the recovery. |
0.8
|
epsilon
|
float
|
The time scale of the recovery. |
0.02
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import FitzhughNagumoSystem
>>> FitzhughNagumoSystem((20, 20)).prepare().system_.interactions[0].epsilon
0.02
Source code in src/skcomplex/systems/biology/physiology/_physiology.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
FlowAdaptationInteraction(label, *, vessels, edges=(), h=(), alpha1=1.0, alpha2=1.0, gamma=2.0)
Bases: Interaction
Adaptation of the conductances of a transport network to its pressure drops.
The pressure drops are those of its Kirchhoff flows.
The nodes accumulate no fluid, so the pressures p solve the mass balance h_i = sum_j C_ij (p_i - p_j) with
the external flows h, which sum to zero, at every instant. Every conductance follows dC_ij/dt = C_ij (alpha1
|p_i - p_j|^gamma - alpha2): it grows with the power dissipated along its edge and decays at a constant rate. The
balance is solved numerically with the pressure of the first node fixed at zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
vessels
|
Role
|
The path of the group of vessel segments on the edges. |
required |
edges
|
Sequence[tuple[int, int]]
|
The ends of every edge, in the order of the group. |
()
|
h
|
Sequence[float]
|
The external flow of every node, positive for sources and negative for sinks. |
()
|
alpha1
|
Annotated[float, closed_open(0, oo)]
|
The growth of the conductance with the pressure drop. |
1.0
|
alpha2
|
Annotated[float, closed_open(0, oo)]
|
The decay rate of the conductance. |
1.0
|
gamma
|
Annotated[float, open(0, oo)]
|
The exponent of the pressure drop. |
2.0
|
Examples:
>>> from skcomplex.systems.biology.physiology import FlowAdaptationInteraction
>>> FlowAdaptationInteraction('adaptation', vessels='vessels', edges=((0, 1),), h=(1.0, -1.0)).gamma
2.0
Source code in src/skcomplex/systems/biology/physiology/_transport.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
GlucoseControlElement(label, *, G=1.0, I=1.0, N=0.5, R=0.75, k0=0.5, k_i=0.5, k_n=1.0, s_i=2.0, s_n=1.0, d_i=1.0, d_n=1.0, K=1.0, n=4.0, meal=1.0, exercise=0.8, meal_time=2.0, exercise_time=12.0, duration=2.0)
Bases: Element
Blood glucose held near its norm by insulin and glucagon.
Insulin lowers it, and glucagon raises it.
The glucose follows dG/dt = R - (k0 + k_i I) G + k_n N + u(t), where u is a meal of height meal from
meal_time and an exercise of height -exercise from exercise_time, each lasting duration. High glucose
secretes insulin, dI/dt = s_i h(G) - d_i I, and low glucose secretes glucagon, dN/dt = s_n (1 - h(G)) - d_n N,
with the Hill switch h(G) = G^n / (G^n + K^n). The production R is set so that the norm G = K is a steady
state.
The element holds the states and parameters and has no laws of its own: the interactions of
GlucoseDualHormoneControlSystem read its parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the organism. |
required |
G
|
Annotated[float, closed_open(0, oo)]
|
The initial glucose, relative to the norm. |
1.0
|
I
|
Annotated[float, closed_open(0, oo)]
|
The initial insulin. |
1.0
|
N
|
Annotated[float, closed_open(0, oo)]
|
The initial glucagon. |
0.5
|
R
|
Annotated[float, closed_open(0, oo)]
|
The basal production of glucose. |
0.75
|
k0
|
Annotated[float, closed_open(0, oo)]
|
The uptake of glucose without insulin. |
0.5
|
k_i
|
Annotated[float, closed_open(0, oo)]
|
The uptake of glucose per unit of insulin. |
0.5
|
k_n
|
Annotated[float, closed_open(0, oo)]
|
The release of glucose per unit of glucagon, 0 without the glucagon loop. |
1.0
|
s_i
|
Annotated[float, closed_open(0, oo)]
|
The maximal secretion of insulin. |
2.0
|
s_n
|
Annotated[float, closed_open(0, oo)]
|
The maximal secretion of glucagon. |
1.0
|
d_i
|
Annotated[float, open(0, oo)]
|
The clearance rate of insulin. |
1.0
|
d_n
|
Annotated[float, open(0, oo)]
|
The clearance rate of glucagon. |
1.0
|
K
|
Annotated[float, open(0, oo)]
|
The norm of the glucose, where both hormones are half secreted. |
1.0
|
n
|
Annotated[float, open(0, oo)]
|
The steepness of the secretion switch. |
4.0
|
meal
|
Annotated[float, closed_open(0, oo)]
|
The rate of glucose intake during the meal. |
1.0
|
exercise
|
Annotated[float, closed_open(0, oo)]
|
The rate of extra glucose uptake during the exercise. |
0.8
|
meal_time
|
float
|
The start of the meal. |
2.0
|
exercise_time
|
float
|
The start of the exercise. |
12.0
|
duration
|
float
|
The duration of the meal and of the exercise. |
2.0
|
Examples:
>>> from skcomplex.systems.biology.physiology import GlucoseControlElement
>>> GlucoseControlElement('organism').meal_time
2.0
Source code in src/skcomplex/systems/biology/physiology/_regulation.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
GlucoseDualHormoneControlSystem(*, glucagon=True, meal=1.0, exercise=0.8, meal_time=2.0, exercise_time=12.0, duration=2.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Blood glucose stabilised by antagonistic hormone loops.
Insulin acts against highs and glucagon against lows.
A meal raises the glucose and secretes insulin, which raises the uptake of glucose, and an exercise lowers it and
secretes glucagon, which releases glucose from the liver. Each receptor acts in one direction only, so one loop
alone corrects excursions to one side of the norm. Two opposing loops on the same quantity attenuate the excursions
to both sides, after Konieczny et al. The time unit is about one hour, and the glucose is relative to its norm. The
system has the glucose organism.G, the insulin organism.I, and the glucagon organism.N.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
glucagon
|
bool
|
Whether the glucagon loop acts, |
True
|
meal
|
float
|
The rate of glucose intake during the meal. |
1.0
|
exercise
|
float
|
The rate of extra glucose uptake during the exercise. |
0.8
|
meal_time
|
float
|
The start of the meal. |
2.0
|
exercise_time
|
float
|
The start of the exercise. |
12.0
|
duration
|
float
|
The duration of the meal and of the exercise. |
2.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import GlucoseDualHormoneControlSystem
>>> GlucoseDualHormoneControlSystem(glucagon=False).prepare().system_.elements[0].k_n
0.0
Source code in src/skcomplex/systems/biology/physiology/_regulation.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
HyperbolicChemotaxisInteraction(label, *, target)
Bases: Interaction
Balance laws of cells and a chemical that move with finite speeds and turn.
They are the hyperbolic limit of velocity jumps.
The cell density n and its flux q, and the chemical density c and its flux j, follow Eq. (6.50) of Bellomo
et al. (2017) in two dimensions with the cells as the only source of the chemical, dn/dt = -div q, dq/dt = -(s^2
/ 2) grad n - mu1 q + mu2 alpha n grad c, tau dc/dt = -div j + n, and tau dj/dt = -(s^2 / 2) grad c - sigma
j. Cells and chemical move at the speed s and turn at the rates mu1 and sigma, and the cells turn towards
the gradient of the chemical with the sensitivity alpha. In the limit of fast turning it is the Keller-Segel model
with the diffusions s^2 / (2 mu1) and s^2 / (2 sigma).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the tissue, whose values are |
required |
Examples:
>>> from skcomplex.systems.biology.physiology import HyperbolicChemotaxisInteraction
>>> HyperbolicChemotaxisInteraction('balance', target='tissue').target
'tissue'
Source code in src/skcomplex/systems/biology/physiology/_chemotaxis.py
139 140 141 | |
HyperbolicChemotaxisSystem(sites=40, *, s=100.0, D_n=1.0, D_c=0.001, alpha=0.33, tau=1.0, n0=0.25, width=0.03, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Cells and a chemical moving with finite speed.
Two bumps of cells spread and attract each other.
The model is the hyperbolic limit of a kinetic model of cells and a chemical that change velocity at random, with
the speed s and turning rates set by the diffusions D_n = s^2 / (2 mu1) and D_c = s^2 / (2 sigma) of its
parabolic limit, Keller-Segel, and mu2 = mu1. Following the test of Bellomo et al. (2017, section 6.6.2), the
cells start as two Gaussian bumps of mass n0 and width width at (3 width, 3 width) and (-3 width, -3 width)
in the square [-0.4, 0.4]^2, here with periodic edges, the cells secrete the chemical, and all fluxes start at
rest. The fluxes relax fast, so the bumps spread out at a finite speed while the cell mass 2 n0 is conserved and
the chemical accumulates where the cells are. The system has the cell density tissue.n, the chemical tissue.c,
and their fluxes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sites
|
int
|
The number of sites along each side of the square. |
40
|
s
|
float
|
The speed of the cells and of the chemical. |
100.0
|
D_n
|
float
|
The diffusion of the cells in the parabolic limit. |
1.0
|
D_c
|
float
|
The diffusion of the chemical in the parabolic limit. |
0.001
|
alpha
|
float
|
The chemotactic sensitivity of the cells. |
0.33
|
tau
|
float
|
The time scale of the chemical. |
1.0
|
n0
|
float
|
The mass of each bump of cells. |
0.25
|
width
|
float
|
The width of each bump of cells. |
0.03
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import HyperbolicChemotaxisSystem
>>> round(HyperbolicChemotaxisSystem(20).prepare().system_.elements[0].mu1)
5000
Source code in src/skcomplex/systems/biology/physiology/_chemotaxis.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
LayerCouplingInteraction(label, *, among, along=True, sigma=1.0)
Bases: Interaction
Coupling of every cell to its partner in another layer.
It adds dphi_i/dt += -sigma sin(phi_i - phi_j).
It runs on the edges of the layer of the network that joins the partners, both ways.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
among
|
Role
|
The path of the group of cells on the nodes. |
required |
along
|
bool | str
|
The layer of the network whose edges join the partners. |
True
|
sigma
|
Annotated[float, closed_open(0, oo)]
|
The strength of the coupling between the layers. |
1.0
|
Examples:
>>> from skcomplex.systems.biology.physiology import LayerCouplingInteraction
>>> LayerCouplingInteraction('interlayer', among='cells', along='partners', sigma=0.5).along
'partners'
Source code in src/skcomplex/systems/biology/physiology/_disease.py
241 242 243 244 245 246 247 248 249 250 | |
MackeyGlassElement(label, *, x=0.5)
Bases: Element
Blood cells of Mackey and Glass, with the number x of cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
x
|
Annotated[float, closed_open(0, oo)]
|
The initial number of cells. |
0.5
|
Examples:
>>> from skcomplex.systems.biology.physiology import MackeyGlassElement
>>> MackeyGlassElement('cells').x
0.5
Source code in src/skcomplex/systems/biology/physiology/_physiology.py
44 45 46 | |
MackeyGlassInteraction(label, *, target, beta=0.2, gamma=0.1, n=10.0, tau=17.0)
Bases: Interaction
Delayed production and loss of blood cells, x' = beta x_tau / (1 + x_tau^n) - gamma x.
The production reads the number of cells x_tau a delay tau earlier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the cells. |
required |
beta
|
float
|
The rate of production. |
0.2
|
gamma
|
float
|
The rate of loss. |
0.1
|
n
|
float
|
The exponent of the feedback. |
10.0
|
tau
|
Annotated[float, open(0, oo)]
|
The delay of the production. |
17.0
|
Examples:
>>> from skcomplex.systems.biology.physiology import MackeyGlassInteraction
>>> MackeyGlassInteraction('production', target='cells').tau
17.0
Source code in src/skcomplex/systems/biology/physiology/_physiology.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
MackeyGlassSystem(x=0.5, *, beta=0.2, gamma=0.1, n=10.0, tau=17.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The Mackey-Glass equation of blood cell production.
It is x' = beta x(t - tau) / (1 + x(t - tau)^n) - gamma x.
It is periodic for tau = 6 and chaotic for tau = 17. The history before the start is the initial value. The
system has the concentration cells.x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The initial concentration, also its history. |
0.5
|
beta
|
float
|
The production rate. |
0.2
|
gamma
|
float
|
The decay rate. |
0.1
|
n
|
float
|
The steepness of the production feedback. |
10.0
|
tau
|
float
|
The delay of production. |
17.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import MackeyGlassSystem
>>> MackeyGlassSystem(tau=6.0).prepare().system_.interactions[0].tau
6.0
Source code in src/skcomplex/systems/biology/physiology/_physiology.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
MetabolismInteraction(label, *, target)
Bases: Interaction
Michaelis-Menten metabolism of a substance, dx/dt = -alpha x / (beta + x).
The concentration of a cell that exchanges the substance with its neighbours follows dx_i/dt = -alpha_i x_i /
(beta_i + x_i) + Σ_j [g (x_j - x_i) + xi A_ij x_j], where the first term is the metabolism, g the exchange
coefficient of the gap junctions, and xi the strength of the tunnelling nanotubes along the same links. The sum
over the neighbours is an interaction along the links of a network of cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the cells, whose values are |
required |
Examples:
>>> from skcomplex.systems.biology.physiology import MetabolismInteraction
>>> MetabolismInteraction('metabolism', target='cells').target
'cells'
Source code in src/skcomplex/systems/biology/physiology/_exchange.py
154 155 156 | |
NanotubeGapJunctionExchangeSystem(graph=None, *, alpha=1.0, beta=10.0, g=0.1, xi=0.0, x=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The intercellular exchange of a substance on a network.
It runs through gap junctions and tunnelling nanotubes.
Every cell metabolizes the substance at the Michaelis-Menten rate alpha x / (beta + x) and exchanges it with its
neighbours, by diffusion g (x_j - x_i) through gap junctions and by the transfer xi x_j through nanotubes. The
state without substance is stable while the largest eigenvalue of xi A - g L stays below alpha / beta, where A
is the adjacency and L the Laplacian of the network. Past the threshold xi_crit the nanotubes destabilize the
communication and the concentrations grow. On a regular graph of degree k, xi_crit = alpha / (beta k). The
system has the concentrations cells.x, one value per node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph | None
|
The NetworkX graph of the gap junctions, or |
None
|
alpha
|
float
|
The maximal rate of metabolism. |
1.0
|
beta
|
float
|
The half-saturation concentration of metabolism. |
10.0
|
g
|
float
|
The exchange coefficient of the gap junctions. |
0.1
|
xi
|
float
|
The strength of the nanotubes. |
0.0
|
x
|
float | Sequence[float] | None
|
The initial concentrations, one value or one per node in node order, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the default network and of the initial concentrations. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> import networkx as nx
>>> from skcomplex.systems.biology.physiology import NanotubeGapJunctionExchangeSystem
>>> NanotubeGapJunctionExchangeSystem(nx.cycle_graph(6), xi=0.01).prepare().system_.elements[0].x.size
6
Source code in src/skcomplex/systems/biology/physiology/_exchange.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
RegionSamplingInteraction(label, *, target, state, objective, move='copy', intensity=1.0, rule='metropolis', neighborhood=None, cooling=None)
Bases: Interaction
Monte Carlo sampling of regions of integer labels by copies of the labels of neighbours.
The objective is a RegionScoreSpec, and the state holds integer labels from 0 on the sites of a LatticeSpace or
the nodes of a NetworkSpace, whose sites of one label form a region. Every sweep proposes hits copies per site,
each at a random site, of the label of one of its neighbours drawn at random, and accepts it from the change of the
contact energy between regions and of the volume and surface constraints of the two regions it changes. The sampler
keeps the volume and the surface of every region and updates them on every accepted copy. The neighbourhood is that
of the copies and the contacts, by default the Moore neighbourhood of a square lattice, the six neighbours of a
triangular lattice, or the edges of a network, whose edge attribute 'weight' weighs the contact and node
attribute 'volume' the volume of a site. It samples the cells of a tissue, the grains of a foam, or the domains
of a polycrystal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
target
|
Role
|
The path of the group of sites. |
required |
state
|
str
|
The name of the state that holds the label of a site. |
required |
objective
|
RegionScoreSpec
|
The score of the regions. |
required |
move
|
str
|
|
'copy'
|
intensity
|
Annotated[float, POSITIVE_VALUES]
|
The factor of the change of the score in the acceptance |
1.0
|
rule
|
str
|
The acceptance, |
'metropolis'
|
neighborhood
|
BaseNeighborhood | None
|
The neighbours of a site, or |
None
|
cooling
|
Callable[[Expression | float], object] | None
|
The function of the time that multiplies one over the intensity, or |
None
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The move is not a copy, the rule is unknown, or the objective is not a region score, raised by |
Examples:
>>> import numpy as np
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.components.spaces import LatticeSpace
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.physiology import RegionSamplingInteraction, RegionScoreSpec
>>> contact = lambda first, second: np.ones(np.broadcast(first, second).shape)
>>> area = lambda labels: (1.0, 16.0)
>>> copies = RegionSamplingInteraction(
... 'copies', target='sites', state='region', objective=RegionScoreSpec(contact, area), move='copy'
... )
>>> regions = np.kron(np.arange(4).reshape(2, 2), np.ones((4, 4)))
>>> sites = Element('sites', values={'region': regions}, space=LatticeSpace((8, 8)))
>>> system = System(elements=[sites], interactions=[copies]).prepare()
>>> final = system.simulate(20, random_state=0).states[-1]
>>> sorted(np.unique(final).tolist())
[0.0, 1.0, 2.0, 3.0]
Source code in src/skcomplex/systems/biology/physiology/_cellular_potts.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
RegionScoreSpec(contact, volume=None, surface=None, hits=1)
dataclass
Bases: BaseSpec
Spec of an objective of a state of integer labels.
The sites of one label form a region. The objective is sum_<i,j> w_ij c(l_i, l_j) [l_i != l_j] + sum_l a_l (V_l -
A_l)^2 + b_l (S_l - B_l)^2, a cost of the boundaries between labelled regions and a quadratic penalty on the
volume and the surface of every region. The first sum runs over the pairs of neighbouring sites i and j with
the weight w_ij of their contact, l_i is the label of site i, V_l the volume of region l, the sum of the
volumes of its sites, and S_l its surface, the sum of the weights of the contacts of its sites with sites of other
labels. A label copy changes the volumes and the surfaces of only the two regions it moves a site between, so a
sampler keeps them as totals per label that every accepted move updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contact
|
Callable[..., object]
|
The function |
required |
volume
|
Callable[..., object] | None
|
The function |
None
|
surface
|
Callable[..., object] | None
|
The function |
None
|
hits
|
int
|
The number of copies proposed per site and sweep. |
1
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The contact or a given constraint is not callable, or the number of hits is not positive. |
Examples:
>>> import numpy as np
>>> from skcomplex.systems.biology.physiology import RegionScoreSpec
>>> contact = lambda first, second: np.ones(np.broadcast(first, second).shape)
>>> area = lambda labels: (np.ones(labels.shape), np.full(labels.shape, 16.0))
>>> RegionScoreSpec(contact, volume=area, hits=2).hits
2
ResistiveFlowInteraction(label, *, source, target, R=1.0, valve=False)
Bases: Interaction
Flow of blood from one chamber to another through a resistance.
The flow is Q = (P_source - P_target) / R.
A valve lets blood pass forward only, so the flow is zero when the target pressure is higher.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
source
|
Role
|
The path of the chamber the blood leaves. |
required |
target
|
Role
|
The path of the chamber the blood enters. |
required |
R
|
Annotated[float, open(0, oo)]
|
The resistance in mmHg s/ml. |
1.0
|
valve
|
bool
|
Whether a valve prevents backward flow. |
False
|
Examples:
>>> from skcomplex.systems.biology.physiology import ResistiveFlowInteraction
>>> ResistiveFlowInteraction('aortic_valve', source='ventricle', target='arteries', valve=True).valve
True
Source code in src/skcomplex/systems/biology/physiology/_circulation.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
SteerableFeedbackLoopSystem(*, v=2.0, d=1.0, K=1.0, n=4.0, T=1.0, tau=0.5, steering=0.5, start=20.0, duration=20.0, label='system', solver='auto', backend='auto')
Bases: DynamicalSystem
A receptor-effector loop that holds a product at its set point.
It holds it until a steering signal shifts it.
The loop of the negative feedback system of Konieczny et al. (2023) settles at the set point where synthesis v / (1
+ (x / K)^n) balances consumption d x. A steering signal, such as a bacterial toxin acting on the temperature
receptors in fever, raises the sensitivity of the receptor by the factor 1 + steering, so the loop climbs to a
higher set point while it acts and returns once it ends. A slow effector or a long transmission delay turns the
regulation into sustained oscillations around the set point. The system has the product loop.x and the effector
activity loop.e.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
float
|
The largest rate of synthesis. |
2.0
|
d
|
float
|
The consumption rate of the product. |
1.0
|
K
|
float
|
The sensitivity of the receptor. |
1.0
|
n
|
float
|
The steepness of the receptor. |
4.0
|
T
|
float
|
The response time of the effector. |
1.0
|
tau
|
float
|
The transmission delay between the receptor and the effector. |
0.5
|
steering
|
float
|
The relative shift of the sensitivity by the steering signal. |
0.5
|
start
|
float
|
The time the steering signal starts. |
20.0
|
duration
|
float
|
The duration of the steering signal. |
20.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import SteerableFeedbackLoopSystem
>>> SteerableFeedbackLoopSystem(tau=3.0).prepare().system_.elements[0].values['tau']
3.0
Source code in src/skcomplex/systems/biology/physiology/_regulation.py
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
TissueSiteElement(label, *, cell=0.0, space=None)
Bases: Element
Site of a lattice tissue, holding the label of the cell that covers it.
The sites of one label form a cell of the cellular Potts model, and CellAdhesionInteraction moves the boundaries
between cells by copying the label of a neighbouring site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the site or the lattice group. |
required |
cell
|
Annotated[float | Array, NN]
|
The initial label of the cell that covers the site, from 0. |
0.0
|
space
|
BaseSpace | None
|
The lattice or network whose sites hold one site each, or |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
default_visual_ |
How the site is drawn by default, the |
Examples:
>>> from skcomplex.systems.biology.physiology import TissueSiteElement
>>> TissueSiteElement('site', cell=3).cell
3
Source code in src/skcomplex/systems/biology/physiology/_cellular_potts.py
226 227 228 229 230 231 232 233 234 | |
TwoCompartmentElement(label, *, Uc=1.0, Up=0.0)
Bases: Element
Drug concentrations of a patient in two compartments.
They are the central compartment Uc and the peripheral compartment Up.
The compartments have no laws of their own. Reactions exchange the drug between them and eliminate it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the patient. |
required |
Uc
|
Annotated[float, closed_open(0, oo)]
|
The initial central concentration. |
1.0
|
Up
|
Annotated[float, closed_open(0, oo)]
|
The initial peripheral concentration. |
0.0
|
Examples:
>>> from skcomplex.systems.biology.physiology import TwoCompartmentElement
>>> TwoCompartmentElement('patient').Up
0.0
Source code in src/skcomplex/systems/biology/physiology/_pharmacokinetics.py
43 44 45 46 47 48 49 50 51 52 | |
TwoCompartmentPharmacokineticsSystem(c0=1.0, *, k10=0.082, k12=0.0475, k21=0.00125, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The two-compartment pharmacokinetics of a bolus dose.
The dose is given into the central compartment.
The central concentration follows dUc/dt = k21 Up - (k10 + k12) Uc and the peripheral one dUp/dt = k12 Uc - k21
Up, from Uc = c0 and Up = 0. The central concentration is the bi-exponential c0 ((alpha - k21) e^(-alpha t) +
(k21 - beta) e^(-beta t)) / (alpha - beta), where alpha and beta are the roots of x^2 - (k10 + k12 + k21) x +
k10 k21: a fast distribution phase is followed by a slow elimination phase. The total drug Uc + Up falls only by
the elimination k10 Uc. The rates are those of doxorubicin, per minute. The system has the central concentration
patient.Uc and the peripheral one patient.Up.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c0
|
float
|
The bolus, the initial central concentration. |
1.0
|
k10
|
float
|
The elimination rate from the central compartment, per minute. |
0.082
|
k12
|
float
|
The transfer rate from the central to the peripheral compartment, per minute. |
0.0475
|
k21
|
float
|
The transfer rate from the peripheral to the central compartment, per minute. |
0.00125
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import TwoCompartmentPharmacokineticsSystem
>>> TwoCompartmentPharmacokineticsSystem(c0=5.0).prepare().system_.elements[0].Uc
5.0
Source code in src/skcomplex/systems/biology/physiology/_pharmacokinetics.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
TwoLayerSepsisSystem(n_cells=20, *, beta=0.5 * math.pi, sigma=1.0, pathological=0.0, omega_healthy=0.0, omega_pathological=1.0, omega_immune=0.0, alpha_p=0.3 * math.pi, alpha_s=0.35 * math.pi, epsilon_p=0.03, epsilon_s=0.3, connectivity=0.5, seed=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The two-layer model of tumour disease and sepsis.
Its parenchymal and immune cells are adaptive oscillators.
The parenchymal layer of n_cells phase oscillators couples through fixed links a_ij, drawn as 1 with the
probability connectivity, and adaptive cytokine links kappa_ij. The immune layer couples through adaptive links
alone, which adapt ten times faster, and every cell couples to its partner in the other layer with strength sigma.
Following Eqs. (40) and (41) of Berner et al. (2023), dphi_i/dt = omega_i - sum_j (a_ij + kappa_ij) sin(phi_i -
phi_j + alpha) / N - sigma sin(phi_i - phi_i') and dkappa_ij/dt = -epsilon (kappa_ij + sin(phi_i - phi_j -
beta)). The healthy state is the frequency-synchronized one, and the age parameter beta and a fraction
pathological of cells with another natural frequency push the layers into desynchronized, pathological states. The
system has the phases cells.phi, the parenchymal cells first and the immune cells after, and the couplings
parenchymal_links.kappa and immune_links.kappa.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_cells
|
int
|
The number of cells of each layer. |
20
|
beta
|
float
|
The age parameter of the adaptation. |
0.5 * pi
|
sigma
|
float
|
The coupling between the layers. |
1.0
|
pathological
|
float
|
The fraction of pathological parenchymal cells. |
0.0
|
omega_healthy
|
float
|
The natural frequency of healthy parenchymal cells. |
0.0
|
omega_pathological
|
float
|
The natural frequency of pathological parenchymal cells. |
1.0
|
omega_immune
|
float
|
The natural frequency of the immune cells. |
0.0
|
alpha_p
|
float
|
The phase lag of the parenchymal layer. |
0.3 * pi
|
alpha_s
|
float
|
The phase lag of the immune layer. |
0.35 * pi
|
epsilon_p
|
float
|
The adaptation rate of the parenchymal links. |
0.03
|
epsilon_s
|
float
|
The adaptation rate of the immune links. |
0.3
|
connectivity
|
float
|
The probability of a fixed parenchymal link. |
0.5
|
seed
|
int | None
|
The seed of the fixed links, the pathological cells, and the initial phases and couplings. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import TwoLayerSepsisSystem
>>> TwoLayerSepsisSystem(5).prepare().system_.elements[0].phi.size
10
Source code in src/skcomplex/systems/biology/physiology/_disease.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
VesselSegmentElement(label, *, C=1.0, space=None, on=None)
Bases: Element
Vessel segment on an edge of a transport network.
Its conductance adapts to the flow it carries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the segment or of the group on the edges. |
required |
C
|
Annotated[float | Array, closed_open(0, oo)]
|
The initial conductance. |
1.0
|
space
|
BaseSpace | None
|
The space whose sites hold one member each, or |
None
|
on
|
str | None
|
|
None
|
Examples:
>>> from skcomplex.systems.biology.physiology import VesselSegmentElement
>>> VesselSegmentElement('vessel', C=2.0).C
2.0
Source code in src/skcomplex/systems/biology/physiology/_transport.py
51 52 53 54 55 56 57 58 59 60 | |
VesselSizingInteraction(label, *, target)
Bases: Interaction
Sizes of the vessels of a space-filling branching network, set by their levels.
The sizes make the network minimize transport energy.
Every vessel branches into n daughters. Area-preserving branching gives the radii the ratio n^(-1/2) between
levels and space filling the lengths the ratio n^(-1/3), and the capillaries at the last level depth have the
same radius r_c and length l_c in every organism, so r = r_c n^((depth - level) / 2), l = l_c n^((depth -
level) / 3), and the volume of the vessel is pi r^2 l.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the vessels, whose values are |
required |
Examples:
>>> from skcomplex.systems.biology.physiology import VesselSizingInteraction
>>> VesselSizingInteraction('sizing', target='vessels').target
'vessels'
Source code in src/skcomplex/systems/biology/physiology/_distribution_networks.py
127 128 129 | |
WestBrownEnquistSystem(depth=6, *, n=2, r_c=1.0, l_c=1.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The distribution network of West, Brown, and Enquist.
It is a space-filling tree of invariant capillaries.
The tree branches n ways at every level down to the capillaries at level depth. The metabolic rate is
proportional to the number of capillaries, n^depth, and the body mass to the blood volume, which the
area-preserving and space-filling vessels make V = pi r_c^2 l_c n^depth (n^(depth / 3) - 1) / (n^(1 / 3) - 1),
which grows as n^(4 depth / 3) for deep trees. So the metabolic rate scales as the mass to the power 3/4,
Kleiber's law, which the exponent between consecutive depths approaches from below. A sweep over depth
fits it. The system has the radii vessels.r, lengths vessels.l, and volumes vessels.volume on the edges of the
tree and the observables blood_volume and capillaries of the catalog, which a run passes in observables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
depth
|
int
|
The level of the capillaries, the number of branchings. |
6
|
n
|
int
|
The branching ratio. |
2
|
r_c
|
float
|
The radius of a capillary. |
1.0
|
l_c
|
float
|
The length of a capillary. |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.biology.physiology import WestBrownEnquistSystem
>>> WestBrownEnquistSystem(3).prepare().system_.elements[0].level.size
14
Source code in src/skcomplex/systems/biology/physiology/_distribution_networks.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |