Comments (1)
Thanks, this is an interesting observation, I gave it a try and found the following:
The code evidently distinguishes between 0 and -0, resulting in a different complex phase angle.
Even though the code is Cpp based, you can recreate the same behaviour with numpy:
import numpy as np
a = np.zeros((5,),dtype=complex)
a *= np.exp(1j*np.pi/2*np.array([0,1,2,3,4])) #pi/2 * N = phase angle rotation in 90° steps
phi = np.angle(a)
print(f'a = {a}') #f-strings work in python >= 3.6, else use '{}'.format(a)
print(f'phi = {phi}')
#output:
# a = [ 0.+0.j 0.+0.j -0.+0.j 0.-0.j 0.+0.j]
# phi = [ 0. 0. 3.14159265 -0. 0. ]
As you can see, the resulting a
"rotates" from (0+j0) via (-0+j0), (0-j0) back to (0,0) just as it would for (1+j0), (0+j1), (-1+j0), (0-j1), (1+j0) with magnitude 1 instead of 0.
Indeed for some operations like 1/np.inf
and 1/-np.inf
it may be important to keep the sign, but of course here it is a side-effect.
Nevertheless, the code works fine, since at 0 intensity the phase is meaningless (and in this case just jumps between 0, -0 and 2pi, which are really the same). I checked and the intensity will definitely be 0.0 after RectAperture(), no matter the order of functions.
In fact, also in your hologram examples in the other issue posted, a lot of data points will have seemingly random phases, but at sufficiently low intensity this is meaningless and for plotting often phase-blanking is convenient (i.e. setting phase=0 or NaN when Intensity<threshold).
from lightpipes.
Related Issues (20)
- Propagation of Gaussian Beam through free space and through lens HOT 8
- Inconsistent definitions of waist w and xshift HOT 2
- Support for astigmatic beams HOT 2
- The grid_dimension and grid_size properties should be documented
- Unexpected intensity distribution for Fresnel propagation HOT 5
- Cannot install LightPipes on Windows 7 - please help HOT 2
- Finite difference documentation typo? HOT 1
- installation problems
- Add Interpol option in Fresnel and Forvard HOT 1
- Warning when paraxiality is violated HOT 2
- Shift with direct integration Forward
- Diffraction From Thin Wire HOT 4
- Step by Step Propagation With a Short Focal Length Lens HOT 3
- LightPipes on an iPad
- LPtest() fails on some systems while installation is correct HOT 1
- Intensity plot gets cut up when attempting to propagate finite airy beam HOT 9
- Cite lightpipes in a paper HOT 2
- lens Following Field Produced by Forward Function
- Airy Beam HOT 6
- LG doughnut mode HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightpipes.