-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocenter very inconsistent #45
Comments
Hey Olivier, That looks very strange. Would you be willing to send the diffraction intensity and mask data you used in the plots above? You can do so here: [email protected] |
diffraction.zip \Olivier |
That's a dramatic statement. A method (without free parameters!) getting very close is not a failure, in the same way that a 98% grade on a test isn't a failure. Is it perfect? Manifestly not. You can read this blog post to get some explanation about how it works. In short: any asymmetry in the diffraction patterns that are NOT diffraction signals will skew the results. For example, for the detectors I have used in the past, various subpixel arrays had different response functions that made parts of the diffraction patterns brighter or dimmer. We have successfully used I will look at the data you provided and see if there is another problem going on. |
I have found the problem: this line The diffraction pattern is pre-processed to remove possible asymmetries in the background intensity. Removing this line gives the following results for your data: I will make this pre-processing step optional, but I will not remove it to preserve backwards-compatibility. |
A new version of scikit-ued (2.1.16) was just released. With it, you can disable background normalization like so: import matplotlib.pyplot as plt
from skimage.io import imread
from skued import autocenter
im = imread("0958_original.png", as_gray=True)
mask = imread("0958_mask.png", as_gray=True).astype(bool)
r, c = autocenter(im=im, mask=mask, normalize_bg=False)
fig, ax1 = plt.subplots(1, 1)
ax1.imshow(im * mask.astype(float))
ax1.scatter(c, r, color="r")
ax1.axhline(y=r, linestyle="dashed", linewidth=1, color="w")
ax1.axvline(x=c, linestyle="dashed", linewidth=1, color="w")
plt.show() which gives the results you see in my previous comment. Feel free to re-open this issue if things aren't working. |
Hi Laurent, That was a quick fix! thanks! Thanks for the answer and the optional argument you implemented. |
It was my pleasure to help. Do not hesitate to report other issues you encounter as you use this software |
:D I encounter the sentence that was stuck to my mind (https://laurentrdc.xyz/posts/autocenter.html): but the apologies can stay as all the rest says otherwise. Here is the docstring "determines the correction to the approximate center found by calculating" .) Thanks again. |
That is a fair point, and clearly it is not pixel perfect. I have updated my blog. |
Version / Platform Info
Expected Behavior
autocenter() would find the center of the DP without hesitation
Actual Behavior
autocenter() fails to find the center of poly crystalline DP. tried with several DP of different quality, seems very random and unfortunately not reliable.
Explain what actually happens when the code is run.
Minimal Example of Issue
Create a mask using the shape of the beam stopper
run the autocenter()
center clearly not at the center
"Mask*DP" shows the masked DP that I expect to be processed via the autocenter()
The text was updated successfully, but these errors were encountered: