Avalanches
Avalanches shared by the physics packages.
They are the toppling that relaxes the sites of a sandpile.
TopplingInteraction(label, *, target, state='x', threshold=1.0, share=0.0, mode='redistribute', drive=None, neighborhood=None)
Bases: Interaction
Cascade of the members whose state reaches a threshold.
These members relax and pass shares to their neighbours. At every step the drive changes the state, and then every
member whose state reaches threshold relaxes, all at once, until no member does. In the mode 'redistribute' a
relaxing member loses threshold and each of its neighbours gains share. In the mode 'reset' a relaxing member
falls to 0 and each of its neighbours gains share times the state it relaxed from. In the mode 'random' a
relaxing member loses threshold in parcels of share, and every parcel goes to one of its neighbours drawn at
random. Neighbours outside a fixed boundary take no share, so it leaves the system, and the mode 'random' treats
every lattice as bounded. Every cascade is recorded as an event with its size, the number of relaxations, its
duration, and its area.
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 on the nodes or sites. |
required |
state
|
str
|
The name of the state of the members. |
'x'
|
threshold
|
float
|
The value of the state at which a member relaxes, fixed during a run. |
1.0
|
share
|
float
|
What a neighbour of a relaxing member gains, an amount, a fraction of the state in the mode |
0.0
|
mode
|
str
|
|
'redistribute'
|
drive
|
Callable[..., Array] | None
|
A function |
None
|
neighborhood
|
BaseNeighborhood | None
|
The neighbourhood of the member itself first and its neighbours, or |
None
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The mode is unknown, the drive is not callable, the neighbourhood leaves out the member itself, or the
mode |
Examples:
>>> from skcomplex.systems.physics.common.avalanches import TopplingInteraction
>>> cascade = TopplingInteraction('cascade', target='sites', state='height', threshold=4, share=1)
>>> cascade.mode
'redistribute'
Source code in src/skcomplex/systems/physics/common/avalanches/_toppling.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |