{"action":"opened","issue":{"url":"https://api.github.com/repos/ovidiopr/scattnlay/issues/6","repository_url":"https://api.github.com/repos/ovidiopr/scattnlay","labels_url":"https://api.github.com/repos/ovidiopr/scattnlay/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/ovidiopr/scattnlay/issues/6/comments","events_url":"https://api.github.com/repos/ovidiopr/scattnlay/issues/6/events","html_url":"https://github.com/ovidiopr/scattnlay/issues/6","id":160430813,"number":6,"title":"Please help with usage of fieldnlay","user":{"login":"paulmueller","id":2853022,"avatar_url":"https://avatars.githubusercontent.com/u/2853022?v=3","gravatar_id":"","url":"https://api.github.com/users/paulmueller","html_url":"https://github.com/paulmueller","followers_url":"https://api.github.com/users/paulmueller/followers","following_url":"https://api.github.com/users/paulmueller/following{/other_user}","gists_url":"https://api.github.com/users/paulmueller/gists{/gist_id}","starred_url":"https://api.github.com/users/paulmueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulmueller/subscriptions","organizations_url":"https://api.github.com/users/paulmueller/orgs","repos_url":"https://api.github.com/users/paulmueller/repos","events_url":"https://api.github.com/users/paulmueller/events{/privacy}","received_events_url":"https://api.github.com/users/paulmueller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-15T14:06:05Z","updated_at":"2016-06-15T14:06:05Z","closed_at":null,"body":"I am having difficulties reproducing the phase retardation computed for a simple sphere. I would like to obtain the field behind a dielectric sphere with a radius of 5 wavelengths at a distance of 6 wavelengths from the center of the sphere.\r\n\r\nUsing the examples directory, I came up with an example script. Could you please help me to find out what is wrong with it? The retrieved phase retardation is too low (-0.28 to -0.21 rad) when compared to other methods like GMM-FIELD (0 to 0.64 rad).\r\n\r\n```python\r\nimport numpy as np\r\nimport scattnlay\r\nimport matplotlib.pylab as plt\r\n\r\nn1 = 1.01 #weak dielectric object\r\nnm = 1.0 #vacuum\r\nradius = 5.0 #radius of the sphere in wavelengths?\r\nextent = 20 #extent of the simulation size in wavelengths?\r\ndistance = 6.0 #distance where we want to have the measured field behind the sphere in wavelengths measured from the center of the sphere?\r\nresolution = 10.0 #pixels per wavelength in the output image\r\n\r\n# There is only one sphere, no layers\r\nx = np.ones((1, 1), dtype = np.float64)\r\nx[0, 0] = radius\r\n\r\n# Set the refractive index of the sphere, normalized to that of the medium\r\nm = np.ones((1, 1), dtype = np.complex128)\r\nm[0, 0] = n1/nm\r\n\r\nnptsx = extent*resolution\r\nnptsy = extent*resolution\r\n\r\nscanx = np.linspace(-extent/2, extent/2, nptsx, endpoint=True)\r\nscany = np.linspace(-extent/2, extent/2, nptsy, endpoint=True)\r\n\r\ncoordX, coordY = np.meshgrid(scanx, scany)\r\ncoordX.resize(nptsx*nptsy)\r\ncoordY.resize(nptsx*nptsy)\r\ncoordZ = np.ones(nptsx*nptsy, dtype=np.float64)*distance\r\n\r\ncoord = np.vstack((coordX, coordY, coordZ)).transpose()\r\n\r\nterms, E, H = scattnlay.fieldnlay(x, m, coord)\r\n\r\n# take the x-component of the electric field\r\nEx = E[:,:,0].reshape(nptsx, nptsy)\r\n\r\n# plot the phase of the x-component of the electric field\r\nax = plt.subplot(111)\r\nmapper = plt.imshow(np.angle(Ex))\r\nplt.colorbar(mapper, ax=ax, label=\"phase [rad]\")\r\nplt.title(\"scattering by a dielectric sphere\")\r\nplt.show()\r\n# Output image attached\r\n```\r\n![scattnfield_sphere](https://cloud.githubusercontent.com/assets/2853022/16082475/c949df90-3311-11e6-9d4a-ebe4db0d12ed.png)\r\n\r\nThere seems to be a negative offset in the image. Maybe I need to perform some kind of background correction?\r\n\r\nThere is also a little confusion on my side about the variable `x`. In one example (https://github.com/ovidiopr/scattnlay/blob/master/examples/field-SiAgSi.py#L72-74), it us multiplied by a factor of 2PI. In another example (https://github.com/ovidiopr/scattnlay/blob/master/examples/field-silica.py#L43) it is not. \r\n\r\nThanks for your help,\r\nPaul\r\n"}}
{"actor":{"display_login":"paulmueller"}}