Comments (2)
Hi @LeoKonzett , thanks for this great question.
- The
np.bitwise_and()
performs the action ofnp.mod()
in the case whenself.phase_scaling == 1
(consider the case of a 10- or 7- bit SLM). This is super fast compared withnp.mod()
. However, you're completely right that this call is unnecessary in the case where you have an 8-bit or 16-bit SLM, as the type casting already performs theand
. I have added a check to not do this in those cases (6ece4bb). - The intent was to avoid
np.around()
overhead. We could accomplish the same thing by adding .5 before type-casting, but I'm uncertain whether it's worth the overhead for this fractional change. I have added documentation (6ece4bb) specifying thefloor()
ed behavior. - In testing, I wasn't able to find a case where unsafe casting didn't behave like
floor()
, but if you can find one then I agree that a better solution is needed. I agree that the ironic"unsafe"
flag correctly implies lack of safety, but I think it's deterministic in our case. Note that this line makes sure that all numbers are negative. The example that you gave is desired behavior, because this is the effect ofmod
by 256.
To answer your last question, yes the reasoning is speed. While something similar to this could be faster (like the ultimate solution for speed: going full-C and writing directly to some integer buffer and never touching floats), this solution was able to maintain both the 60 Hz operation in testing and the user-friendly 2pi float submission that we wanted to have. np.mod()
was a main limitation for other implementations. Of course, we welcome any contributions to make the package better. If you have any ideas for how to improve this while still maintaining speed, feel free to discuss or add something! Let me know if you have any comments on the mentioned changes (6ece4bb), we'll probably pull request this within a week.
from slmsuite.
I'm closing this issue as these changes were pulled under request #24.
Please feel free, @LeoKonzett, to reopen it or to contact us about anything else! Looking forward to see what you do with the package.
from slmsuite.
Related Issues (20)
- Unify Erroring
- wavefront_calibrate() HOT 1
- 3D Spots
- Wavefront calibration fit & correct the center of the spots array HOT 4
- Stored SLM `phase` includes `phase_correction`
- Wavefront calibration link HOT 1
- slmsuite.holography.toolbox.smallest_distance unexpected behavior HOT 1
- Clean up true 2D support for cameras/SLMs with non-square pixels. HOT 1
- DataRay Camera support HOT 1
- `take` does not work properly for stacks of images. HOT 1
- `averaging` flag for cameras HOT 1
- `Filesystem` camera
- Cameras update
- AL Loop for Weights HOT 1
- Wavefront calibration over a field of view HOT 3
- gradient-based optimization for phase and amplitude objectives
- Unusual behavior with `take` using even pixel number.
- Some AlliedVision cameras don't have binning attributes.
- Some corrections for MRAF in the package
- Allied Vision Vimba-X Support HOT 2
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 slmsuite.