{"action":"closed","issue":{"url":"https://api.github.com/repos/mperrin/poppy/issues/104","labels_url":"https://api.github.com/repos/mperrin/poppy/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/mperrin/poppy/issues/104/comments","events_url":"https://api.github.com/repos/mperrin/poppy/issues/104/events","html_url":"https://github.com/mperrin/poppy/issues/104","id":100891870,"number":104,"title":"Fresnel - possible off-by-one bug in fft_coords()?","user":{"login":"mperrin","id":1151745,"avatar_url":"https://avatars.githubusercontent.com/u/1151745?v=3","gravatar_id":"","url":"https://api.github.com/users/mperrin","html_url":"https://github.com/mperrin","followers_url":"https://api.github.com/users/mperrin/followers","following_url":"https://api.github.com/users/mperrin/following{/other_user}","gists_url":"https://api.github.com/users/mperrin/gists{/gist_id}","starred_url":"https://api.github.com/users/mperrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mperrin/subscriptions","organizations_url":"https://api.github.com/users/mperrin/orgs","repos_url":"https://api.github.com/users/mperrin/repos","events_url":"https://api.github.com/users/mperrin/events{/privacy}","received_events_url":"https://api.github.com/users/mperrin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-13T23:30:52Z","updated_at":"2015-08-21T16:20:30Z","closed_at":"2015-08-21T16:20:30Z","body":"I am not totally sure about this one... Here is a slight difference in behavior between the `Wavefront.coordinates` function and `fresnel.Wavefront.fft_coords`. I am not sure if this is intentional or accidental? \r\n\r\nCompare:\r\n```\r\nIn [9]: wf = fresnel.Wavefront(2.4*u.m, wavelength=675e-9, npix=512, oversample=2)\r\nIn [10]: wf.fft_coords()[1][0]\r\nOut[10]: array([-4.8     , -4.790625, -4.78125 , ...,  4.771875,  4.78125 , 4.790625])\r\n```\r\nversus: \r\n```\r\nIn [11]: wf.coordinates()[1][0]\r\nOut[11]: array([-4.7953125, -4.7859375, -4.7765625, ...,  4.7765625,  4.7859375, 4.7953125])\r\n```\r\n\r\nIn the latter case, I took care to make sure that the output coordinates are centered on the optical axis; i.e. the positive and negative values are symmetric. This is not the case for what fft_coords returns. \r\nThe difference in code is just 1:\r\n```\r\n        x -= (shape[1] - 1) / 2.0   # in Wavefront.coordinates\r\n        x-= (self.shape[1])/2.      # in fresnel.Wavefront.fft_coords\r\n```\r\n\r\nI tried changing `fft_coords` to match the behavior of `coordinates`. After doing do, the propagation still seems to work. However the `test_CircularAperturePropagation()` then fails, because the peak value is not as expected. Where did the expected value \"3.3633280006866424\" come from?  \r\n\r\nI am worried that it is inconsistent as currently coded, that as a result the center (x,y)=(0,0) for e.g. a CircularAperture is not the same as the center used in calculating the radial phase term in a plane-to-plane propagation. "}}