Skip to content

TAdeJong/pyGPA

Repository files navigation

pyGPA

CI Codecov DOI

A python package collecting an assortment of Geometric Phase Analysis algorithms and tools to analyse regular (moiré) lattices.

Geometric Phase Analysis enables the extraction of a displacement field from a distorted lattice, by comparing to reference waves. As such, it is a spatial variant of lock-in amplification. This package implements several specializations of GPA. In particular:

  • It extends the original GPA algorithm by optimizing over a range of reference vectors, (as previously described by[1]) to achieve accurate characterization of larger distortions. This is especially useful when analysing (atomic) small angle moiré patterns.
  • From the displacement field, it is possible to extract local properties of the underlying lattice.
  • It is also possible from this displacement field, to correct for the distortion, a process known in STM as the Lawler-Fujita algorithm [2].
  • Once the displacement field is known, it is also possible to perform unit cell averaging directly from the distorted image, creating low-noise or higher magnification (depending on the PSF of the instrument) images of the unit cell.
  • This unit cell average can be extended back to the full image to create a low noise version, or explore difference from mean unit cell.

Installation

Installation is somewhat non-trivial, due to dependency on a non-packaged implementation of the smooth + periodic decomposition. Furthermore, to use CuPy acceleration, a NVIDIA graphics card and working CUDA installation are needed.

First clone the repository. In the pyGPA folder, run the following:

$ pip install -e .
$ pip install git+https://github.com/TAdeJong/moisan2011.git#egg=moisan2011

For CUDA acceleration, follow installation instructions of CuPy https://docs.cupy.dev/en/stable/install.html.

Testing

This project uses pytest and hypothesis to run tests. The test coverage is far from complete and can be extented though! To test:

Install the test dependencies.

$ pip install -r requirements_test.txt

Run the tests.

$ pytest
========================== 20 passed in 42.28s ============================

Note: The cuGPA tests will be skipped automatically if no working CuPy installation is detected.

See also

https://github.com/TAdeJong/moire-lattice-generator

T.A. de Jong _et al._Imaging moiré deformation and dynamics in twisted bilayer graphene. Nat Commun 13, 70 (2022) (arxiv)

T. Benschop, T.A. de Jong et al. Phys. Rev. Research 3, 013153 (Code not actually used for that work, but builds upon the ideas)

https://github.com/TAdeJong/weighed_phase_unwrap

Kemao, Qian. "Two-dimensional windowed Fourier transform for fringe pattern analysis: principles, applications and implementations." Optics and Lasers in Engineering 45.2 (2007): 304-317.

Acknowledgement

This work was financially supported by the Netherlands Organisation for Scientific Research (NWO/OCW) as part of the Frontiers of Nanoscience (NanoFront) program.

About

A python package collecting an assortment of geometric phase analysis algorithms and tools to analyse regular (moiré) lattices.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages