{"id":79,"date":"2020-06-03T20:32:47","date_gmt":"2020-06-03T18:32:47","guid":{"rendered":"https:\/\/logbooks.ifosim.org\/finesse\/?p=79"},"modified":"2020-06-08T17:27:46","modified_gmt":"2020-06-08T15:27:46","slug":"selecting-higher-order-mode-indices-to-model","status":"publish","type":"post","link":"https:\/\/logbooks.ifosim.org\/finesse\/2020\/06\/03\/selecting-higher-order-mode-indices-to-model\/","title":{"rendered":"Selecting Higher-Order Mode indices to model"},"content":{"rendered":"\n<p><em>Note: This post is based on the relevant Finesse 3 documentation page<\/em>:   <a href=\"https:\/\/finesse.docs.ligo.org\/finesse3\/usage\/homs\/selecting_modes.html\">https:\/\/finesse.docs.ligo.org\/finesse3\/usage\/homs\/selecting_modes.html<\/a><\/p>\n\n\n\n<p>Models in Finesse are, by default, created as plane-wave representations of the underlying configuration. This can be switched to a modal basis by specifying the mode indices that should be modelled by the system. There are a few key ways in which this can be done, as outlined in the sections below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Maximum TEM order<\/h2>\n\n\n\n<p>The maximum TEM order (termed <em>maxtem<\/em> for short) is something that will be familiar for users of previous Finesse versions. By setting a value for maxtem, all mode indices up to and including this order will be included in the model. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import finesse\n\nmodel = finesse.Model()\n# set maximum mode order (n+m) to 3\nmodel.select_modes(maxtem=3)\n\nprint(model.homs)<\/code><\/pre>\n\n\n\n<p>will produce the output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;&#091;0 0]\n &#091;0 1]\n &#091;0 2]\n &#091;0 3]\n &#091;1 0]\n &#091;1 1]\n &#091;1 2]\n &#091;2 0]\n &#091;2 1]\n &#091;3 0]]<\/code><\/pre>\n\n\n\n<p>This can also be achieved via the finesse file syntax with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>modes maxtem=3<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Selection method<\/h2>\n\n\n\n<p>One of the main new features of modelling HOMs in&nbsp;Finesse&nbsp;3 is the ability to select the modes you want to model rather than including all modes up to a specific order with&nbsp;maxtem. This can be achieved via varied arguments to the&nbsp;<a href=\"https:\/\/finesse.docs.ligo.org\/finesse3\/api\/model\/generated\/finesse.model.Model.select_modes.html#finesse.model.Model.select_modes\"><code>Model.select_modes()<\/code><\/a>&nbsp;method. Below are a few examples, with both the Python API and parsed syntax representations given.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Even modes up to order 4<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>model.select_modes(\"even\", 4)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>modes even maxtem=4<\/code><\/pre>\n\n\n\n<p>Modes in the model:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;&#091;0 0]\n &#091;0 2]\n &#091;0 4]\n &#091;2 0]\n &#091;2 2]\n &#091;4 0]]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Odd modes up to order 3<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>model.select_modes(\"odd\", 3)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>modes odd maxtem=3<\/code><\/pre>\n\n\n\n<p>Modes in the model:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;&#091;0 0]\n &#091;0 1]\n &#091;0 3]\n &#091;1 0]\n &#091;1 1]\n &#091;3 0]]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Tangential modes up to order 5<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>model.select_modes(\"x\", 5)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>modes x maxtem=5<\/code><\/pre>\n\n\n\n<p>Modes in the model:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;&#091;0 0]\n &#091;1 0]\n &#091;2 0]\n &#091;3 0]\n &#091;4 0]\n &#091;5 0]]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Sagittal modes up to order 4<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>model.select_modes(\"y\", 4)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>modes y maxtem=4<\/code><\/pre>\n\n\n\n<p>Modes in the model:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;&#091;0 0]\n &#091;0 1]\n &#091;0 2]\n &#091;0 3]\n &#091;0 4]]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Mode selection in practice<\/h2>\n\n\n\n<p>The example below shows a file with the input laser L0 mismatched to the the cavity eigenmode. As there are no misalignments in this system, we can ignore any odd modes and just model even modes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import finesse\nfinesse.init_plotting()\n\nmodel = finesse.Model()\nmodel.parse(\"\"\"\nl L0 P=1\ns s0 L0.p1 ITM.p1\n\nm ITM R=0.99 T=0.01 Rc=-2.5\ns sCAV ITM.p2 ETM.p1 L=1\nm ETM R=0.99 T=0.01 Rc=2.5\n\n# create the cavity object\ncav FP ITM.p2.o\n# make a mismatch by setting a different propagated q at laser\ngauss gL0 L0.p1.o q=-0.7+0.9j\n\n# only care about even modes as we're just looking\n# at mismatches, so select even modes up to order 4\nmodes even 4\n\npd transmitted_power ETM.p2.o\n\nxaxis ETM.phi lin -180 180 500\n\"\"\")\n\nout = model.run()\nout.plot(logy=True)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"617\" src=\"https:\/\/logbooks.ifosim.org\/finesse\/wp-content\/uploads\/sites\/5\/2020\/06\/cavscan-1024x617.png\" alt=\"\" class=\"wp-image-81\" srcset=\"https:\/\/logbooks.ifosim.org\/finesse\/wp-content\/uploads\/sites\/5\/2020\/06\/cavscan-1024x617.png 1024w, https:\/\/logbooks.ifosim.org\/finesse\/wp-content\/uploads\/sites\/5\/2020\/06\/cavscan-300x181.png 300w, https:\/\/logbooks.ifosim.org\/finesse\/wp-content\/uploads\/sites\/5\/2020\/06\/cavscan-768x463.png 768w, https:\/\/logbooks.ifosim.org\/finesse\/wp-content\/uploads\/sites\/5\/2020\/06\/cavscan-1536x926.png 1536w, https:\/\/logbooks.ifosim.org\/finesse\/wp-content\/uploads\/sites\/5\/2020\/06\/cavscan.png 1727w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From this plot you can see that we get the scattering into 02 and 04 modes as expected from introducing a mode-mismatch.<\/p>\n\n\n\n<p>Note that for this small example, the speed-up from only modelling even modes is not particularly noticeable for users. However, even for small configurations such as this simple cavity model the performance improvement when selecting the &#8220;right&#8221; modes will be significant when going to higher maxtem values and when scanning over a degree of freedom which results in different scattering matrices at each data point. A future logbook post or documentation page will quantify the amount of performance improvements achieved from this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: This post is based on the relevant Finesse 3 documentation page: https:\/\/finesse.docs.ligo.org\/finesse3\/usage\/homs\/selecting_modes.html Models in Finesse are, by default, created as plane-wave representations of the underlying configuration. This can be switched to a modal basis by specifying the mode indices that should be modelled by the system. There are a few key ways in which [&hellip;]<\/p>\n","protected":false},"author":50,"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":[14],"tags":[22,24,23],"ssl-alp-coauthor":[19],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-finesse3","tag-homs","tag-mismatches","tag-modes"],"_links":{"self":[{"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":3,"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/posts\/79\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/tags?post=79"},{"taxonomy":"ssl-alp-coauthor","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/finesse\/wp-json\/wp\/v2\/ssl-alp-coauthor?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}