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
- void applyTo(m) const
Perform
m.fire(edge)
.- Parameters
m (DGPetriNetMarking) – the marking to apply the action to.
- class mod.CausalityInputAction¶
- __init__()¶
- __init__(v)
- 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)
- 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
- __getitem__()¶
- Returns
the
i
th event in the trace.- Return type
- Raises
LogicError
ifi
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
time (float) – the time associated with the event.
action (CausalityEdgeAction or CausalityInputAction or CausalityOutputAction) – the action of the event.
- 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
- 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
- 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 toEventTrace(DGPetriNet(dg), f)
.net (DGPetriNet) – a Petri net where the underlying derivation graph matches the loaded event trace.
- Returns
the loaded event trace.
- Return type
- Raises
LogicError
ifdg
/net
isNone
.- Raises
InputError
on bad data or if the given derivation graph does not match the data.