seto77 / ReciPro

The software ReciPro makes various crystallographic calculations, visualizes a crystal structure, simulates a diffraction pattern and high-resolution TEM image, indexes diffraction spots, plots stereographic projection, and so on.
https://seto77.github.io/ReciPro/
Other
113 stars 13 forks source link

Suggestions for Diffraction Simulator: Pixel Size Calibration and Option for simple Bragg-Position Markers #30

Closed lukmuk closed 5 months ago

lukmuk commented 6 months ago

Hello!

Thanks for sharing and maintaining this great software! I use it mainly for electron diffraction and want to suggest to add the following features if you find time at some point:

  1. Scaling the simulated diffraction pattern with a given pixel size (e.g., nm-1) to more easily match it with the exp. patterns. At the moment, one must set the image size in pixels, the camera length, and a mm/px value. I think it would be great to add a "pixel size" option as well (very similar to #25 ). Then, a user can directly provide the image size (e.g., 512 x 512) and the pixel size in nm-1 from their exp. patterns. To match my DPs with ReciPro, I use an Excel file to help me calibrate the width of the ReciPro patterns to match my experimental patterns (https://github.com/lukmuk/em-stuff/blob/main/Excel%20Sheets/ReciPro_DiffractionScaler.xlsx) by fixing the camera length to an arbitrary value (e.g. 100 mm) and calculating the mm/px value to match my exp. patterns. The proposed change would make it more easy to match the patterns directly in ReciPro.

grafik

  1. Add an option to only show the "geometrical positions" of the Bragg spots (i.e., without any intensity consideration = same spot radius and brightness). Now the simulated spots always "fade" toward higher scattering angles when the Ewalds sphere/spot intensity is considered. Sometimes it may be useful to simply display the expected positions of the Bragg spots as points (i.e., a 2D grid of points). Maybe add something like "Simple geometry of spots" to the "Intensity calculation" section? That would be great!

grafik

Thanks again for providing this awesome toolbox and for consideration of these suggestions. :-)

seto77 commented 6 months ago

Thank you for the great ideas you gave me. I will consider those ideas within the next few days and take some action. Please wait a while.

seto77 commented 6 months ago

lukmuk-san,

I have improved ReciPro to meet your ideas.

image

As shown in the screenshot above, "nm^-1/pix" was added as a unit of monitor resolution. Selecting this unit allows the size of a single pixel in the vicinity of the direct spot to be set in the dimensions of the reciprocal space.

For your idea to display all spots as points of the same size, I added the option "Draw all spots with the same radius". This option appears only when "Only exicitation error" is selected.

Please try the latest version (ver 4.880) and let me know if this update implements your ideas properly.

lukmuk commented 6 months ago

seto-san,

thank you for the quick implementation of the proposed changes! 👍 I tested the diffraction simulator: The "Draw all spots with the same radius" works great! Is it possible to extend the spots so that they fill the full field of view of the currently displayed simulated pattern? If not, that's also fine.

Regarding the nm-1 scaling, I encountered an issue: I tested it with a experimental diffraction pattern (I binned it to 512x512 pixels) of GaAs in <110> zone axis. GaAs_110_nm-1_512

The pixel size is 0.01800743 nm-1, giving a total field of view of 512*0.01800743 nm-1 = 9.21 nm-1 (edge to edge of the image).

When I use this pixel size in Spot ID v2 (1), it works perfectly and the zone axis is determind nicely (2):

2024-03-15_12-11

However, if I try to simulate the few spots with the nm-1 option, the field-of-view seems way to large for some reason: 2024-03-15_12-14

What I expect: If I would put in 0.01800743 nm-1 and a size of 512x512 for the pattern, it should yield the same spot positions as the experimental patterns. I hope this info can help us in identifying the issue.

Thanks for your help and efforts!

Edit: I uploaded the diffraction pattern .tiff and .png for testing (https://github.com/lukmuk/em-stuff/tree/main/TestData).

seto77 commented 6 months ago

I apologize for the inconvenience. It was a simple mistake of not inverting the units. I have corrected it, so please try the latest version (ver4.882).

image

I tested the diffraction simulator: The "Draw all spots with the same radius" works great! Is it possible to extend the spots so that they fill the full field of view of the currently displayed simulated pattern? If not, that's also fine.

Since the algorithm calculates under the condition of a finite radius of the Ewald sphere, it is not possible to draw only the 0th Laue zone. However, by increasing the accelerating voltage (e.g., 10,000 kV), you can effectively expand the 0th Laue zone.

lukmuk commented 5 months ago

Thanks for quickly fixing the issue, scaling works nicely now!

Since the algorithm calculates under the condition of a finite radius of the Ewald sphere, it is not possible to draw only the 0th Laue zone. However, by increasing the accelerating voltage (e.g., 10,000 kV), you can effectively expand the 0th Laue zone.

Makes sense and the suggested workaround works great.

Thanks for the upgrades to ReciPro I will close this issue.