emulsim.trackers module
Provides classes that track the state of the simulation.
Stores the state as a function of time during the simulation. |
|
Reads trajectories of states written with |
|
Stores information about droplets in a simulation. |
|
Wrapper to use py-pde trackers on fields. |
- class DropletElementTracker(element_name: str, interrupts: InterruptsBase | int | float | str | Sequence[float] | ndarray[Any, dtype[number]] = 1, *, store_emulsions: bool | str = True, store_droplet_tracks: bool | str = True, keep_vanished: bool = False)[source]
Bases:
TrackerBaseStores information about droplets in a simulation.
- emulsions
An object describing the emulsion at the determined intervals
- Type:
EmulsionTimeCourse
- droplet_tracks
An object describing the time course of individual droplets.
- Type:
DropletTrackList
The two attributes emulsions and droplet_tracks contain equivalent information, but their structure is different and either one might thus be used to analyze the simulation.
- Parameters:
element_name (str) – The name of the element containing the droplets
interrupts – {ARG_TRACKER_INTERRUPTS}
store_emulsions (bool or str) – Determines whether to store data on emulsions in an instance of
EmulsionTimeCourse. No data is stored when this is False. Otherwise, the data is available in theemulsionsattributed of the tracker instance. The data is additionally written to a file when a path is supplied as a string.store_droplet_tracks (bool or str) – Determines whether to store data on droplets in an instance of
DropletTrackList. No data is stored when this is False. Otherwise, the data is available in thedroplet_tracksattributed of the tracker instance. The data is additionally written to a file when a path is supplied as a string.keep_vanished (bool) – Flag determining whether vanished droplets (with zero radius) are still stored. The default is to filter these droplets. Enable this flag if droplets disappearing and re-appearing should be combined in a single track.
- finalize(info: dict[str, Any] | None = None) None[source]
Finalize the tracker, supplying additional information.
- Parameters:
info (dict) – Extra information from the simulation
- class FieldTracker(element_name: str, tracker: TrackerBase)[source]
Bases:
TrackerBaseWrapper to use py-pde trackers on fields.
This acts as a wrapper around any of the trackers from
pde.trackers, e.g., tracker = FieldTracker(‘background’, PlotTracker()).- Parameters:
element_name (str) – The name of the element of the field
tracker (TrackerBase) – The tracker that will receive the field
- finalize(info: dict[str, Any] | None = None) None[source]
Finalize the tracker, supplying additional information.
- Parameters:
info (dict) – Extra information from the simulation
- class Trajectory(storage: StorageGroup, loc: None | str | Sequence[Location] = 'trajectory')[source]
Bases:
TrajectoryReads trajectories of states written with
TrajectoryTrackerThe class permits direct access to indivdual states using the square bracket notation. It is also possible to directly iterate over all states.
- Parameters:
- class TrajectoryTracker(storage: None | str | Path | StorageGroup | StorageBase, interrupts: InterruptsBase | int | float | str | Sequence[float] | ndarray[Any, dtype[number]] = 1, *, mode: str | AccessMode | None = None, info: dict[str, Any] | None = None)[source]
Bases:
TrackerBaseStores the state as a function of time during the simulation.
Stored data can be read using
Trajectory.- Parameters:
storage (MutableMapping or string) – Store or path to directory in file system
interrupts – {ARG_TRACKER_INTERRUPTS}
mode (str or
AccessMode) – The file mode with which the storage is accessed. Determines allowed operations. The meaning of the special (default) value None depends on whether the file given by store already exists. If yes, a RuntimeError is raised, otherwise the choice corresponds to mode=”full” and thus creates a new trajectory. If the file exists, use mode=”truncate” to overwrite file or mode=”append” to insert new data into the file.info (dict) – Additional information that are written to the trajectory storage. To document simulation parameters, simulation.info can be used here.
- finalize(info: dict[str, Any] | None = None) None[source]
Finalize the tracker, supplying additional information.
- Parameters:
info (dict) – Extra information from the simulation