{"id":321,"date":"2021-02-12T07:59:47","date_gmt":"2021-02-12T06:59:47","guid":{"rendered":"https:\/\/logbooks.ifosim.org\/pykat\/?p=321"},"modified":"2021-02-12T07:59:47","modified_gmt":"2021-02-12T06:59:47","slug":"computing-modal-scattering-coefficients","status":"publish","type":"post","link":"https:\/\/logbooks.ifosim.org\/pykat\/blog\/computing-modal-scattering-coefficients\/","title":{"rendered":"Computing modal scattering coefficients"},"content":{"rendered":"\n<p>When doing optical modal modelling you will at some point have to consider how some incident mode gets scattered by some deformation or effect into another mode. There is a lot of math to take in before you start calculating stuff but there is a good review of it all here:<\/p>\n\n\n\n<p><a href=\"https:\/\/link.springer.com\/article\/10.1007\/s41114-016-0002-8#Sec118\">https:\/\/link.springer.com\/article\/10.1007\/s41114-016-0002-8#Sec118<\/a><\/p>\n\n\n\n<p>The computational problem is then computing a 2D overlap integral between your field and some output mode of some new basis. Some of the simple ones are doable by hand but often it&#8217;s easier to do it via numerical integration. Here is a quick code snippet for Newton-Cotes integrating using Pykat:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pykat\nfrom pykat.optics.gaussian_beams import HG_mode\nfrom pykat.math import newton_weights\n\nq = pykat.BeamParam(w0=0.5, z=0)\nx = np.linspace(-4, 4, 2000)\ny = np.linspace(-4, 4, 2000)\ndx = x&#091;1] - x&#091;0]\ndy = y&#091;1] - y&#091;0]\nhg00 = HG_mode(q, n=0, m=0)\nhg10 = HG_mode(q, n=1, m=0)\nY, X = np.meshgrid(x,y)\n\nW_nc = np.outer(newton_weights(x, 5), \n                newton_weights(y, 5))\n                    \ndx*dy*np.sum(W_nc * hg00.Unm(x,y).conj() * X * hg10.Unm(x,y))<\/code><\/pre>\n\n\n\n<p>This is solving the overlap integral between two modes with some additional effect, X. The integrand is weighted by the Newton-Cotes weights. You can easily add in whatever distortion you need here. Currently this code is computing the overlap with some linear X term, which is required for computing how yaw rotations affect a beam.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When doing optical modal modelling you will at some point have to consider how some incident mode gets scattered by some deformation or effect into another mode. There is a lot of math to take in before you start calculating stuff but there is a good review of it all here: https:\/\/link.springer.com\/article\/10.1007\/s41114-016-0002-8#Sec118 The computational problem [&hellip;]<\/p>\n","protected":false},"author":5,"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":[18],"class_list":["post-321","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/posts\/321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/comments?post=321"}],"version-history":[{"count":1,"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":322,"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/posts\/321\/revisions\/322"}],"wp:attachment":[{"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/media?parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/categories?post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/tags?post=321"},{"taxonomy":"ssl-alp-coauthor","embeddable":true,"href":"https:\/\/logbooks.ifosim.org\/pykat\/wp-json\/wp\/v2\/ssl-alp-coauthor?post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}