VMO_Score.petri_net¶
Module implementing the methods for the construction of a petri net from a segmentation analysis.
Classes
PetriNet([s, pnml]) |
Class that represents a Petri Net |
Exceptions
ExpressionError(arg) |
Class representing an error raised during the conversion to Expressions. |
-
exception
VMO_Score.petri_net.ExpressionError(arg)[source]¶ Class representing an error raised during the conversion to Expressions.
-
arg¶ str – String representing the information of the error.
-
-
class
VMO_Score.petri_net.PetriNet(s=None, pnml=None)[source]¶ Class that represents a Petri Net
-
data¶ Dictionary representing the regions belonging to each place.
Returns: Dictionary where keys are petri net places and values are their segmentation regions Return type: dict
-
final_place¶ Returns the final place of the Petri Net.
Returns: id of the final place Return type: str
-
from_pnml(filepath)[source]¶ Load a Petri Net from a PNML file
Parameters: filepath (str) – Path of the PNML file
-
from_segmentation(segmentation)[source]¶ Build a Petri Net representing the segmentation of an audio file.
Parameters: segmentation (Segmentation) – Segmentation
-
initial_place¶ Returns the initial place of the Petri Net
Returns: id of the initial place Return type: str
-
output_png(filename)[source]¶ Save the Petri Net as a PNG file
Parameters: filename (str) – String representing the path of the output file
-
print_transitions()[source]¶ Print the information of the transitions of a Petri Net
Print the name, the minimum and maximum duration and the current time of all transitions of a Petri Net
-
to_json(filename)[source]¶ Save the Petri Net to a json file readily by i-score
Parameters: filename (str) – String representing the output file
-
to_pnml(filename)[source]¶ Save the Petri Net as a PNML file
Parameters: filename (str) – String representing the path of the output file
-
update_from_config(filename)[source]¶ Update a Petri Net with a configuration file
Read a configuration file and update the transition parameters with the values specifies on it.
Parameters: filename (str) – String representing the path of the configuration file
-
update_transition(t_name, new_min, new_max, new_guard)[source]¶ Update a timed transition of a Petri Net
Update a timed transition with new minimum and maximum durations and a guard.
Parameters: - t_name (str) – Name of the transition to be changed
- new_min (float) – Minimum duration of the transition
- new_max (float) – Maximum duration of the transition
- new_guard (Expression) – Condition of the transition
-