py4dstem
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
13 of 31 committers (41.9%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.0%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: py4dstem
- License: gpl-3.0
- Language: Python
- Default Branch: dev
- Size: 246 MB
Statistics
- Stars: 235
- Watchers: 24
- Forks: 157
- Open Issues: 49
- Releases: 4
Metadata Files
README.md
:warning: py4DSTEM version 0.14 update :warning: Warning: this is a major update and we expect some workflows to break. You can still install previous versions of py4DSTEM as discussed here
:warning: Phase retrieval refactor version 0.14.9 :warning: Warning: The phase-retrieval modules in py4DSTEM (DPC, parallax, and ptychography) underwent a major refactor in version 0.14.9 and as such older tutorial notebooks will not work as expected. Notably, class names have been pruned to remove the trailing "Reconstruction" (
DPCReconstruction->DPCetc.), and regularization functions have dropped the_itersuffix (and are instead specified as boolean flags). See the updated tutorials for more information.

py4DSTEM is an open source set of python tools for processing and analysis of four-dimensional scanning transmission electron microscopy (4D-STEM) data. Additional information:
- Installation instructions
- The py4DSTEM documentation pages.
- Tutorials and example code
- Want to get involved?
- Our open access py4DSTEM publication in Microscopy and Microanalysis describing this project and demonstrating a variety of applications.
- Our open access 4D-STEM review in Microscopy and Microanalysis describing this project and demonstrating a variety of applications.
What is 4D-STEM?
In a traditional STEM experiment, a beam of high energy electrons is focused to a very fine probe - on the order of, or even smaller than, the spacing between atoms - and rastered across the surface of the sample. A conventional two-dimensional STEM image is formed by populating the value of each pixel with the electron flux through a detector at the corresponding beam position. In 4D-STEM, a pixelated detector is used instead, where a 2D image of the diffracted probe is recorded at every rastered probe position. A 4D-STEM scan thus results in a 4D data array.
4D-STEM data is information rich. A datacube can be collapsed in real space to yield information comparable to nanobeam electron diffraction experiment, or in diffraction space to yield a variety of virtual images, corresponding to both traditional STEM imaging modes as well as more exotic virtual imaging modalities. The structure, symmetries, and spacings of Bragg disks can be used to extract spatially resolved maps of crystallinity, grain orientations, and lattice strain. Redundant information in overlapping Bragg disks can be leveraged to calculate the sample potential. Structure in the diffracted halos of amorphous systems can be used to describe the short and medium range order.
py4DSTEM supports many different modes of 4DSTEM analysis. The tutorials, sample code, module, and function documentation all provide more detailed discussion on some of the analytical methods possible with this code.
py4DSTEM Installation
The recommended installation for py4DSTEM uses the Anaconda python distribution. First, download and install Anaconda: www.anaconda.com/download. If you prefer a more lightweight conda client, you can instead install Miniconda: https://docs.conda.io/en/latest/miniconda.html. Then open a conda terminal and run one of the following sets of commands to ensure everything is up-to-date and create a new environment for your py4DSTEM installation:
conda update conda
conda create -n py4dstem
conda activate py4dstem
conda install -c conda-forge py4dstem pymatgen jupyterlab
In order, these commands - ensure your installation of anaconda is up-to-date - make a virtual environment (see below) - enter the environment - install py4DSTEM, as well as pymatgen (used for crystal structure calculations) and JupyterLab (an interface for running Python notebooks like those in the py4DSTEM tutorials repository)
We've had some recent reports install of conda getting stuck trying to solve the environment using the above installation. If you run into this problem, you can install py4DSTEM using pip instead of conda by running:
conda update conda
conda create -n py4dstem python=3.10
conda activate py4dstem
pip install py4dstem pymatgen
Both conda and pip are programs which manage package installations, i.e. make sure different codes you're installing which depend on one another are using mutually compatible versions. Each has advantages and disadvantages; pip is a little more bare-bones, and we've seen this install work when conda doesn't. If you also want to use Jupyterlab you can then use either pip install jupyterlab or conda install jupyterlab.
If you would prefer to install only the base modules of py4DSTEM, and skip pymategen and Jupterlab, you can instead run:
conda install -c conda-forge py4dstem
Finally, regardless of which of the above approaches you used, in Windows you should then also run:
conda install pywin32
which enables Python to talk to the Windows API.
Please note that virtual environments are used in the instructions above in order to make sure packages that have different dependencies don't conflict with one another.
Because these directions install py4DSTEM to its own virtual environment, each time you want to use py4DSTEM you'll need to activate this environment.
You can do this in the command line by running conda activate py4dstem, or, if you're using the Anaconda Navigator, by clicking on the Environments tab and then clicking on py4dstem.
Last - as of the version 0.14.4 update, we've had a few reports of problems upgrading to the newest version. We're not sure what's causing the issue yet, but have found the new version can be installed successfully in these cases using a fresh Anaconda installation.
Legacy installations (version <0.14)
The latest version of py4DSTEM (v0.14) makes changes to the classes and functions which may not be compatible with code written for prior versions. We are working to ensure better backwards-compatibility in the future. For now, if you have code from earlier versions, you can either (1) install the legacy version of your choice, or (2) update legacy code to use the version 0.14 methods. To update your code to the new syntax, check out the examples in the py4DSTEM tutorials repository and the docstrings for the classes and functions you're using. To install the legacy version of py4DSTEM of your choice, you can call
pip install py4dstem==0.XX.XX
substituting the desired version for XX.XX. For instance, you can install the last version 13 release with
pip install py4dstem==0.13.17
or the last version 12 release with
pip install py4dstem==0.12.24
Advanced installations - GPU acceleration and ML functionality
To install the py4dstem with AI/ML functionality, follow the steps below. If you're using a machine with an Nvidia GPU and CUDA capability, run:
conda update conda
conda create -n py4dstem-aiml
conda activate py4dstem-aiml
conda install -c conda-forge cudatoolkit=11.0 cudnn=8.1 cupy
pip install "py4dstem[aiml-cuda]"
If your machine does not have a CUDA capable device, run
conda update conda
conda create -n py4dstem
conda activate py4dstem
conda install pip
pip install "py4dstem[aiml]"
The py4DSTEM GUI
The py4DSTEM GUI data browser has been moved to a separate repository. You can find that repository here. You can install the GUI from the command line with:
pip install py4D-browser
The py4D-browser can then be launched from the command line by calling:
py4DGUI
Running the code
The anaconda navigator can be used to launch various Python interfaces, including Jupyter Notebooks, JupyterLab, PyCharm, and others.
Once you're inside the conda environment where you installed py4DSTEM and you've launched an interface to the Python interpreter, you can import py4DSTEM to access all its modules and functions using import py4DSTEM.
Example code and tutorials
At this point you'll need code, and data!
Sample code demonstrating a variety of workflows can be found in the py4DSTEM tutorials repository in the /notebooks directory.
These sample files are provided as Jupyter notebooks.
Links to the data used in each notebook are provided in the intro cell of each notebook.
More information
Contributing Guide
We are grateful for your interest in contributing to py4DSTEM. There are many ways to contribute to py4DSTEM, including Reporting bugs, Submitting feature requests, Improving documentation and Developing new code
For more information checkout our Contributors Guide
Documentation
Our documentation pages are available here.
Scientific papers which use py4DSTEM
See a list here.
Acknowledgements
If you use py4DSTEM for a scientific study, please cite our open access py4DSTEM publication in Microscopy and Microanalysis. You are also free to use the py4DSTEM logo in PDF format or logo in PNG format for presentations or posters.
The developers gratefully acknowledge the financial support of the Toyota Research Institute for the research and development time which made this project possible.
Additional funding has been provided by the US Department of Energy, Office of Science, Basic Energy Sciences.
License
GNU GPLv3
py4DSTEM is open source software distributed under a GPLv3 license. It is free to use, alter, or build on, provided that any work derived from py4DSTEM is also kept free and open under a GPLv3 license.
Owner
- Name: py4dstem
- Login: py4dstem
- Kind: organization
- Repositories: 2
- Profile: https://github.com/py4dstem
Citation (CITATION.cff)
cff-version: 1.1.0
message: "If you use this software, please cite the accompanying paper."
abstract: "Scanning transmission electron microscopy (STEM) allows for imaging, diffraction, and spectroscopy of materials on length scales ranging from microns to atoms. By using a high-speed, direct electron detector, it is now possible to record a full two-dimensional (2D) image of the diffracted electron beam at each probe position, typically a 2D grid of probe positions. These 4D-STEM datasets are rich in information, including signatures of the local structure, orientation, deformation, electromagnetic fields, and other sample-dependent properties. However, extracting this information requires complex analysis pipelines that include data wrangling, calibration, analysis, and visualization, all while maintaining robustness against imaging distortions and artifacts. In this paper, we present py4DSTEM, an analysis toolkit for measuring material properties from 4D-STEM datasets, written in the Python language and released with an open-source license. We describe the algorithmic steps for dataset calibration and various 4D-STEM property measurements in detail and present results from several experimental datasets. We also implement a simple and universal file format appropriate for electron microscopy data in py4DSTEM, which uses the open-source HDF5 standard. We hope this tool will benefit the research community and help improve the standards for data and computational methods in electron microscopy, and we invite the community to contribute to this ongoing project."
authors:
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Savitzky
given-names: "Benjamin H."
-
affiliation: "Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: Zeltmann
given-names: "Steven E. "
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Hughes
given-names: "Lauren A."
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Brown
given-names: "Hamish G."
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA and Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: Zhao
given-names: Shiteng
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA and Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: Pelz
given-names: "Philipp M."
-
affiliation: "Institut für Physik, Humboldt-Universität zu Berlin, Newtonstraße 15, 12489 Berlin, Germany"
family-names: Pekin
given-names: "Thomas C."
-
affiliation: "Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Barnard
given-names: "Edward S."
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: Donohue
given-names: Jennifer
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: "Rangel DaCosta"
given-names: Luis
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: Kennedy
given-names: Ellis
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Xie
given-names: Yujun
-
affiliation: "Los Alamos National Laboratory, Los Alamos, NM 87545, USA"
family-names: Janish
given-names: "Matthew T."
-
affiliation: "Los Alamos National Laboratory, Los Alamos, NM 87545, USA"
family-names: Schneider
given-names: "Matthew M."
-
affiliation: "Toyota Research Institute, Los Altos, CA 94022, USA"
family-names: Herring
given-names: Patrick
-
affiliation: "Toyota Research Institute, Los Altos, CA 94022, USA"
family-names: Gopal
given-names: Chirranjeevi
-
affiliation: "Toyota Research Institute, Los Altos, CA 94022, USA"
family-names: Anapolsky
given-names: Abraham
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Dhall
given-names: Rohan
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Bustillo
given-names: "Karen C."
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Ercius
given-names: Peter
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: Scott
given-names: "Mary C."
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Ciston
given-names: Jim
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA Department of Materials Science and Engineering, University of California, Berkeley, CA 94720, USA"
family-names: Minor
given-names: "Andrew M."
-
affiliation: "National Center for Electron Microscopy, Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA"
family-names: Ophus
given-names: Colin
title: "py4DSTEM: A Software Package for Four-Dimensional Scanning Transmission Electron Microscopy Data Analysis"
version: 0.12.6
doi: 10.1017/S1431927621000477
date-released: 2021-05-21
GitHub Events
Total
- Issues event: 26
- Watch event: 26
- Issue comment event: 67
- Push event: 117
- Pull request review event: 22
- Pull request review comment event: 13
- Pull request event: 34
- Fork event: 17
- Create event: 1
Last Year
- Issues event: 26
- Watch event: 26
- Issue comment event: 67
- Push event: 117
- Pull request review event: 22
- Pull request review comment event: 13
- Pull request event: 34
- Fork event: 17
- Create event: 1
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| bsavitzky | b****y@g****m | 1,492 |
| SE Zeltmann | s****n@l****v | 503 |
| Colin | c****s@g****m | 419 |
| alex-rakowski | a****0@g****m | 169 |
| Stephanie Ribet | s****t@g****m | 122 |
| Georgios Varnavides | g****s@b****u | 90 |
| bsavitzky | b****y@u****m | 59 |
| Alex Bruefach | a****h@b****u | 46 |
| SE Zeltmann | s****n@n****u | 39 |
| Tom Pekin | t****n@g****m | 22 |
| jom317 | 6****7@u****m | 17 |
| SE Zeltmann | s****7@n****u | 17 |
| Steve Zeltmann | 3****t@u****m | 17 |
| Matt Henderson | m****n@l****v | 17 |
| gvarnavi | g****i@m****u | 11 |
| lerandc | l****c@u****u | 9 |
| Philipp Pelz | p****z@b****u | 6 |
| HamishGBrown | h****n@g****m | 6 |
| Edward Barnard | e****d@l****v | 4 |
| Tara Mishra | t****a@l****v | 3 |
| Tara Prasad Mishra | t****i@g****m | 3 |
| unknown | j****e@b****u | 3 |
| Yusuph Mkangara | y****a@o****m | 2 |
| Stephanie Ribet | 5****t@u****m | 2 |
| Joydeep Munshi | 6****0@u****m | 2 |
| Jordi Ferrer Orri | 9****o@u****m | 2 |
| Steven Zeltmann | s****n@c****u | 1 |
| Magnus Nord | m****r@g****m | 1 |
| David Ginsburg | d****d@d****m | 1 |
| Jan Janssen | j****n@u****m | 1 |
| and 1 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 101
- Total pull requests: 327
- Average time to close issues: 9 months
- Average time to close pull requests: 12 days
- Total issue authors: 52
- Total pull request authors: 27
- Average comments per issue: 1.95
- Average comments per pull request: 1.03
- Merged pull requests: 284
- Bot issues: 0
- Bot pull requests: 9
Past Year
- Issues: 19
- Pull requests: 47
- Average time to close issues: 25 days
- Average time to close pull requests: 16 days
- Issue authors: 17
- Pull request authors: 16
- Average comments per issue: 2.0
- Average comments per pull request: 1.15
- Merged pull requests: 32
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
- sezelt (14)
- bsavitzky (8)
- alex-rakowski (7)
- swelborn (5)
- Psiche91 (3)
- Cheng-Zhao-MCEM (3)
- alouiset (3)
- ZOUCHEN158 (3)
- erh3cq (2)
- sbachu6812 (2)
- yongsooyang (2)
- miaoleixin1994 (2)
- Marcraven (2)
- CSSFrancis (2)
- cophus (2)
Pull Request Authors
- cophus (66)
- bsavitzky (63)
- sezelt (43)
- alex-rakowski (42)
- smribet (39)
- gvarnavi (34)
- maclariz (20)
- dependabot[bot] (16)
- tcpekin (9)
- Quantumstud (6)
- shinjandutta (4)
- ZacharyVarley (4)
- edwinsupple (4)
- abruefach (4)
- mlhenderson (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 3,569 last-month
-
Total dependent packages: 1
(may contain duplicates) -
Total dependent repositories: 2
(may contain duplicates) - Total versions: 104
- Total maintainers: 3
pypi.org: py4dstem
An open source python package for processing and analysis of 4D STEM data.
- Homepage: https://github.com/py4dstem/py4DSTEM/
- Documentation: https://py4dstem.readthedocs.io/
- License: GNU GPLv3
-
Latest release: 0.14.18
published about 1 year ago
Rankings
conda-forge.org: py4dstem
py4DSTEM is a python tool for analysis of four-dimensional scanning transimission electron microscopy (4D-STEM) data.
- Homepage: https://github.com/py4dstem/py4DSTEM/
- License: GPL-3.0-only
-
Latest release: 0.13.7
published over 3 years ago
Rankings
Dependencies
- actions/checkout v3 composite
- github/super-linter v4 composite
- actions/checkout v3 composite
- actions/setup-python v2 composite
- pypa/gh-action-pypi-publish master composite
- tj-actions/changed-files v32 composite
- dask *
- dill *
- distributed *
- gdown *
- h5py *
- ipywidgets *
- matplotlib *
- ncempy *
- numpy *
- scikit-image *
- scikit-learn *
- scipy *
- tqdm *
- actions/checkout v3 composite
- psf/black stable composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- emdfile *

