The ProgramAnaiysis Module creates a SVG diagram with links to demonstrate a function. The left hand side has boxes that represent the input and have links to the input in text form. The central box represents the action or function being done and has a link to the code of the function. The right most boxes represent the output and has a link to the text version of the output. The output can have a transformation function for viewing
from pyMez.Code.DataHandlers.Translations import S2PV1_to_XmlDataTable
from pyMez.Code.Analysis.ProgramAnalysis import *
# to display this diagram it is good to have a html form first
new_svg=create_svg_black_box_diagram(inputs={"s2p":S2PV1(os.path.join(TESTS_DIRECTORY,"thru.s2p"))},
outputs=["S2P_as_xml"],function=S2PV1_to_XmlDataTable,
output_transformation_function=lambda x: x.to_HTML(os.path.join(TESTS_DIRECTORY,
'../XSL/S2P_DB_STYLE.xsl')),
output_mime_type="text/html",box_text_ratio=15)
new_html=HTMLBase()
new_html.add_head()
new_html.add_body()
new_html.append_to_body({"tag":"br"})
new_html.append_to_body(new_svg)
new_html.append_to_head({"tag":"style","text":"rect:hover {stroke-width:8;stroke:blue;}"})
# from IPython.display import SVG,HTML
# HTML(str(new_html))
# this shows the html file in your browser
new_html.show()
# this works for any function
black_box=create_svg_black_box_diagram(inputs={"list_of_strings":["This is one string","This is number two"]},
function=string_list_collapse,outputs=["Collapsed String"])
new_html.append_to_body(black_box)
new_html.show()