python: render the M&P hierarchy in SVG
* python/spot/__init__.py (show_mp_hierarchy, mp_hierarchy_svg): New functions. * tests/python/formulas.ipynb: Illustrate show_mp_hierarchy. * python/ajax/spotcgi.in: Use mp_hierarchy_svg. * python/ajax/css/trans.css: Adjust for possible overflows. * NEWS: Mention this new feature.
This commit is contained in:
parent
0e2ab5de53
commit
ff4c4a7231
5 changed files with 156 additions and 18 deletions
|
|
@ -15,7 +15,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.3+"
|
||||
"version": "3.5.3rc1"
|
||||
},
|
||||
"name": ""
|
||||
},
|
||||
|
|
@ -617,6 +617,79 @@
|
|||
],
|
||||
"prompt_number": 17
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Any formula can also be classified in the temporal hierarchy of Manna & Pnueli"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"g.show_mp_hierarchy()"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"metadata": {},
|
||||
"output_type": "pyout",
|
||||
"prompt_number": 22,
|
||||
"svg": [
|
||||
"<svg height=\"210\" version=\"1.1\" width=\"220\" xmlns=\"http://www.w3.org/2000/svg\">\n",
|
||||
"<polygon fill=\"cyan\" opacity=\".2\" points=\"20,0 200,120 200,210 20,210\"/>\n",
|
||||
"<polygon fill=\"cyan\" opacity=\".2\" points=\"20,120 155,210 20,210\"/>\n",
|
||||
"<polygon fill=\"magenta\" opacity=\".15\" points=\"200,0 20,120 20,210 200,210\"/>\n",
|
||||
"<polygon fill=\"magenta\" opacity=\".15\" points=\"200,120 65,210 200,210\"/>\n",
|
||||
"<g transform=\"translate(40,80)\">\n",
|
||||
" <line stroke=\"red\" stroke-width=\"5\" x1=\"-10\" x2=\"10\" y1=\"-10\" y2=\"10\"/>\n",
|
||||
" <line stroke=\"red\" stroke-width=\"5\" x1=\"-10\" x2=\"10\" y1=\"10\" y2=\"-10\"/>\n",
|
||||
" </g>\n",
|
||||
"<g font-size=\"14\" text-anchor=\"middle\">\n",
|
||||
"<text x=\"110\" y=\"20\">Reactivity</text>\n",
|
||||
"<text x=\"60\" y=\"65\">Recurrence</text>\n",
|
||||
"<text x=\"160\" y=\"65\">Persistence</text>\n",
|
||||
"<text x=\"110\" y=\"125\">Obligation</text>\n",
|
||||
"<text x=\"60\" y=\"185\">Safety</text>\n",
|
||||
"<text x=\"160\" y=\"185\">Guarantee</text>\n",
|
||||
"</g>\n",
|
||||
"<g font-size=\"14\">\n",
|
||||
"<text fill=\"gray\" text-anchor=\"begin\" transform=\"rotate(-90,18,210)\" x=\"18\" y=\"210\">Monitor</text>\n",
|
||||
"<text fill=\"gray\" text-anchor=\"end\" transform=\"rotate(-90,18,0)\" x=\"18\" y=\"0\">Deterministic B\u00fcchi</text>\n",
|
||||
"<text fill=\"gray\" text-anchor=\"begin\" transform=\"rotate(-90,214,210)\" x=\"214\" y=\"210\">Terminal B\u00fcchi</text>\n",
|
||||
"<text fill=\"gray\" text-anchor=\"end\" transform=\"rotate(-90,214,0)\" x=\"214\" y=\"0\">Weak B\u00fcchi</text>\n",
|
||||
"</g>\n",
|
||||
"</svg>"
|
||||
],
|
||||
"text": [
|
||||
"<IPython.core.display.SVG object>"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 22
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"spot.mp_class(g, 'v')"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"metadata": {},
|
||||
"output_type": "pyout",
|
||||
"prompt_number": 24,
|
||||
"text": [
|
||||
"'recurrence'"
|
||||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 24
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
|
|
@ -728,4 +801,4 @@
|
|||
"metadata": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue