Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem this PR addresses
Lattice fringes in HRTEM images carry local phase and orientation information, but quantEM had no way to map them. This PR treats an HRTEM image as a pseudo-4DSTEM dataset: a tapered window moves across the image, and the local Fourier transform at each window position becomes a diffraction pattern. These patterns then go through the existing 4DSTEM workflow (Bragg disk detection and pixel size calibration), followed by phase and in-plane orientation mapping.
Left to right: HRTEM image with four positions of the moving window, the four tapered windows, their local Fourier transforms with the detected Bragg disks on the front pattern, and the phase map (LiF yellow, Li2O cyan) and LiF in-plane orientation map.
What's here
imaging/local_fft.py:LocalFFT.from_imagecuts a window ofwindow_sizepixels everysteppixels, applies a disk mask with a sin² taper over the full radius (window_mask), and stores the cropped power spectra as aDataset4dstemin Å and 1/Å. Each pattern is normalized by the azimuthal median of the scan-mean pattern asI / background - 1, so the background is 0 and the noise is close to 1 at every frequency, and the center disk is set to 0. The window centers are known exactly, soLocalFFT.originsgoes directly toBraggVectors.correct_peak_originsand we skip origin fitting and ellipse calibration.print(lfft)reports the window diameter and FWHM, which sets the spatial resolution.diffraction/systematic_row.py:SystematicRowMap. Most HRTEM windows show a single set of lattice fringes, which is a single systematic row: it determines the phase and the in-plane direction of g, but not the rotation of the crystal about g. Instead of full ACOM, we pair Friedel spots (+g and -g), assign |g| to the nearest reflection family of the candidate crystals, and map the phase and the in-plane angle of g (fiber texture). Plots:plot_rings,plot_phase,plot_orientationandplot_angle_distribution. Orientation colors use the same perceptually uniform hue as the rest of ACOM (array_to_rgba), with brightness from the row intensity, and angles follow the quantEM conventionatan2(g_col, g_row).Crystal.from_cifremoves the aseSpacegroupobject that the ase CIF reader leaves inatoms.info. Crystal finds the space group itself (Crystal.spacegroup), so it now holds only native data and saves without the dill fallback.LocalFFTandSystematicRowMap.Validation (notebook, not in the repo)
HRTEM image of LiF and Li2O recorded by Guoliang Hu, 300 kV, 4096 x 4096 pixels of 0.355 Å. We used a resolution of 20 Å (112 pixel window, 40 Å diameter) and a step of 28 pixels, giving 143 x 143 windows.
What should the reviewer(s) do
Review the new
LocalFFTandSystematicRowMapclasses and merge.🤖 Generated with Claude Code