Comments (4)
Hmm. I think this is actually intended behavior. Looks like integer rounding to me, where the upper spots happened to be rounded up one in the (integer) computational k-space knm
.
Internally, a grid is created in .make_rectangular_array()
from x and y lists on each edge:
x_edge = (np.arange(array_shape[0]) - (array_shape[0] - 1) / 2)
x_edge = x_edge * array_pitch[0] + array_center[0]
y_edge = (np.arange(array_shape[1]) - (array_shape[1] - 1) / 2)
y_edge = y_edge * array_pitch[1] + array_center[1]
But then, the points generated from these edges are ceil
ed up.
self.spot_knm_rounded = np.ceil(shape / 2 + self.spot_knm.astype(np.float))
self.spot_knm_rounded = self.spot_knm_rounded.astype(np.int)
The fix is either to increase the resolution of k-space to be finer (and the off-by-one less noticeable), or choose array_shape
and array_center
more carefully to avoid undesirable rounding.
Rounding is going to happen no matter what, which is why this is intended behavior. I added a user info note in 7a84c9c.
from slmsuite.
I realized this would affect results of fourier calibration so I spent some more time thinking about it. I am proposing that we adopt the convention I declared here:
The x_edge and y_edge computation is fine because the results are floats with uniform pitch. I think spot_knm_rounded
is funky due to the ceil
. For example, say shape / 2 + self.spot_knm.astype(np.float))
has x coords 58.6, 64, 69.4: 58.6 is rounded up to 57, 64 stays, 69.4 is rounded up to 70, so the array isn't uniform anymore. You can prove by considering a few simple cases that, under the convention I proposed, two points equally spaced about zero (58.6 ~ -5.4) and (69.4 ~ 5.4) always end up an equal number of indices away from zero.
from slmsuite.
The ceil
was intended to make the rounding explicit. The rounding has to occur no matter what, to generate a target image in computational k-space. I'm not sure if the proposed convention resolves the problem, as you're back to non-uniform pitch once you do more than three points in the example (e.g. five points). The heart of the issue was passing a non-integer knm
pitch in the first place, I would argue, which is a user issue that we can (at best) warn about.
from slmsuite.
But after some discussion, around
probably produces better results than ceil
in the case of spot_knm_rounded
, as this more accurately targets the positions of desired spots. See 2a958cc.
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.