Commit 21c62239 authored by VIGNET Pierre's avatar VIGNET Pierre

Fix Model informations (locations were not detected)

parent 0ac0fe65
......@@ -46,7 +46,7 @@
</child>
<child>
<widget class="GtkButton" id="statbutton">
<property name="label" translatable="yes">Statistics</property>
<property name="label" translatable="yes">Model informations</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......
......@@ -752,7 +752,11 @@ class STATWindow(BAGWindow):
"""
# info label
info = self.wtree.get_widget("label_nbsol")
info.set_text("Model statistics")
info.set_text(
"Model Informations\n"
"(Please note that some elements may have more than one locations; "
"take a look at /tmp/logs/cadbiom*)"
)
self.frame_sol = self.wtree.get_widget("frame_sol")
# button frame
......
......@@ -140,6 +140,9 @@ class StaticAnalyzer(object):
"""
Compute various informations on the model (assume PID encoding)
.. warning:: Start nodes (__start__0) are counted here in 'other'
locations.
:param arg1: Opened file (optional).
:type arg1: <open file>
:return: Informations (status of nodes and their cellular locations).
......@@ -160,12 +163,21 @@ class StaticAnalyzer(object):
# Iterate on model nodes
for node_name, node in self.model.node_dict.iteritems():
loc_found = False
for location in locations:
if location in node_name:
if loc_found:
LOGGER.warning(
"get_statistics::Multiple locations: {}, {}".format(
node_name, location))
location_dict[location] += 1
else:
location_dict['other'] += 1
loc_found = True
# Warning: this line also counts "virtual" "start nodes"
# like __start__0
if not loc_found:
location_dict['other'] += 1
# Check node status
nb_outgoing_trans = len(node.outgoing_trans)
......@@ -186,9 +198,9 @@ class StaticAnalyzer(object):
"Nb places": len(self.model.node_dict),
"Nb transitions": len(self.model.transition_list),
"Nb inputs": input_cpt,
"Nb frontier (incoming transitions)": front_cpt,
"Nb terminal (outgoing transitions)": final_cpt,
"Nb isolated (frontier places in conditions)": isolated_cpt,
"Nb frontier (no incoming transitions)": front_cpt,
"Nb terminal (no outgoing transitions)": final_cpt,
"Nb isolated (frontier places in conditions/not used)":isolated_cpt,
})
# Forge data locations
for k, v in location_dict.iteritems():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment