4.1.8.3. causality/EventTrace

class mod.CausalityEdgeAction
__init__()
__init__(e)
edge

(Read-only) the hyperedge for the action. May not be null.

Type

DGHyperEdge

void applyTo(m) const

Perform m.fire(edge).

Parameters

m (DGPetriNetMarking) – the marking to apply the action to.

class mod.CausalityInputAction
__init__()
__init__(v)
vertex

(Read-only) the vertex being injected. May not be null.

Type

DGVertex

void applyTo(m) const

Perform m.add(vertex, 1).

Parameters

m (DGPetriNetMarking) – the marking to apply the action to.

class mod.CausalityOutputAction
__init__()
__init__(v)
vertex

(Read-only) the vertex being extracted. May not be null.

Type

DGVertex

void applyTo(m) const

Perform m.remove(vertex, 1).

Parameters

m (DGPetriNetMarking) – the marking to apply the action to.

class mod.EventTrace

A representation of a trace of events starting from an initial marking. An event is either a reaction/hyperedge being performed or a transfer of tokens out or in to the system.

__init__(initialState)

Construct an empty event trace with an initial state. A copy of the given marking is being stored.

Parameters

initialState (DGPetriNetMarking) – the marking to used as the initial state.

initialState

(Read-only) Read a copy of the initial state for this event trace.

Type

DGPetriNetMarking

__len__()
Returns

the number of events in the trace.

Return type

int

time

(Read-only) the time of the latest added event, or 0 if len(self) == 0.

Type

float

__getitem__()
Returns

the ith event in the trace.

Return type

Event

Raises

LogicError if i is out of bounds.

__str__()
__eq__()

Calls syncSize() on the internal initial state and the underlying net.

add(time, action)

Append an event to the trace.

Parameters
Raises

LogicError if the time is less than the current time of the trace.

Raises

LogicError if the action has null descriptors.

Raises

LogicError if the descriptors in the action does not belong to the underlying derivation graph.

print(maxPointsPerMolecule=500)

Create a plot of the counts throughout the event trace at each time point.

Parameters

maxPointsPerMolecule (int) – how many points are rendered for each molecule in the plot.

Returns

the filename for the PDF that will be compiled by the post processor.

Return type

str

dump()
dump(filename)

Dump the initial marking and list of events to a file. This file can be loaded in again.

Parameters

filename (str) –

the name of the file to save the dump to. If non is given an auto-generated name in the out/ folder is used. If an empty string is given, it is treated as if non is given.

Note

The filename is being used literally, i.e., it is not being prefixed according to the current script location as input filenames are.

Returns

the filename with the dumped model.

Return type

str

static load(dg, f)
static load(net, f)

Load an event trace dump.

Parameters
  • dg (DG) – a matching derivation graph for the loaded event trace. A DGPetriNet is being constructed based on this DG, i.e., it is equivalent to EventTrace(DGPetriNet(dg), f).

  • net (DGPetriNet) – a Petri net where the underlying derivation graph matches the loaded event trace.

  • f (str or CWDPath) – an event trace dump file to load.

Returns

the loaded event trace.

Return type

EventTrace

Raises

LogicError if dg/net is None.

Raises

InputError on bad data or if the given derivation graph does not match the data.

class EventTrace.Event

A representation of an event in an event trace.

time

(Read-only) the associated time for the event.

Type

float

action

(Read-only) the action of the event.

Type

CausalityEdgeAction or CausalityInputAction or CausalityOutputAction