{"id":166,"date":"2019-12-19T06:34:11","date_gmt":"2019-12-19T06:34:11","guid":{"rendered":"https:\/\/logbooks.ifosim.org\/iucaa2019\/?p=166"},"modified":"2019-12-19T06:34:11","modified_gmt":"2019-12-19T06:34:11","slug":"generating-node-graphs-from-finesse-scripts","status":"publish","type":"post","link":"https:\/\/logbooks.ifosim.org\/iucaa2019\/2019\/12\/19\/generating-node-graphs-from-finesse-scripts\/","title":{"rendered":"Generating node graphs from Finesse scripts"},"content":{"rendered":"\n<p>There is a somewhat &#8220;hidden&#8221; feature in Pykat which is capable of showing you an <strong>approximate<\/strong> visualisation of your model. It may not be available on all systems, e.g. Windows.<\/p>\n\n\n\n<p>This feature is available in two ways:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Via notebook<\/h2>\n\n\n\n<p>In a Jupyter notebook, you can view your interferometer using the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from pykat.tools.plotting.graph import NodeGraph\nnodegraph = NodeGraph(kat)\nnodegraph.view_pdf()<\/code><\/pre>\n\n\n\n<p>In the example above, the <code>kat<\/code> object is your Pykat model. If you have called it something else, e.g. <code>kat2<\/code>, you should of course update this variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Via command line interface<\/h2>\n\n\n\n<p>You may not know this, but by installing Pykat you have also installed a command line interface. Within a Conda terminal\/prompt, you can type <code>pykat<\/code> then enter, and you will be presented with a help screen for the command line interface. Normally you run a Finesse model this way using <code>pykat FILE.kat<\/code> where <code>FILE.kat<\/code> is your input file. Note that this interface does <strong>not<\/strong> support Python-based scripts, such as those that you write in your Jupyter notebooks. One option is <code>--display-graph<\/code>, which runs the model contained in the specified <code>FILE.kat<\/code> parameter and displays the graph in your PDF viewer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Output<\/h2>\n\n\n\n<p>The output looks something like this (it will open a PDF on your computer):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"782\" height=\"868\" src=\"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-content\/uploads\/sites\/3\/2019\/12\/Screenshot_20191219_120048.png\" alt=\"\" class=\"wp-image-167\" srcset=\"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-content\/uploads\/sites\/3\/2019\/12\/Screenshot_20191219_120048.png 782w, https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-content\/uploads\/sites\/3\/2019\/12\/Screenshot_20191219_120048-270x300.png 270w, https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-content\/uploads\/sites\/3\/2019\/12\/Screenshot_20191219_120048-768x852.png 768w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><figcaption>The output from the node graph tool for a complicated Virgo model.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>There is a somewhat &#8220;hidden&#8221; feature in Pykat which is capable of showing you an approximate visualisation of your model. It may not be available on all systems, e.g. Windows. This feature is available in two ways: Via notebook In a Jupyter notebook, you can view your interferometer using the following code: In the example [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ssl_alp_hide_revisions":false,"footnotes":"","ssl_alp_hide_crossreferences_to":false},"categories":[1],"tags":[],"ssl-alp-coauthor":[2],"class_list":["post-166","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/posts\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":1,"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/posts\/166\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/media?parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/categories?post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/tags?post=166"},{"taxonomy":"ssl-alp-coauthor","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/iucaa2019\/wp-json\/wp\/v2\/ssl-alp-coauthor?post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}