Skip to main content

Deep and machine learning for atom-resolved data

Project description

PyPI version Build Status Documentation Status Codacy Badge Downloads Colab Gitpod ready-to-code

AtomAI

What is AtomAI

AtomAI is a simple Python package for machine learning-based analysis of experimental atom-resolved data from electron and scanning probe microscopes, which doesn't require any advanced knowledge of Python (or machine learning). It is the next iteration of the AICrystallographer project.

How to use it

AtomAI has two main core modules: atomnet and atomstat. The atomnet is for training neural networks (with just one line of code) and for applying trained models to finding atoms and defects in image data (which also takes a single line of code). The atomstat allows taking the atomnet predictions and performing the statistical analysis on the local image descriptors associated with the identified atoms and defects (e.g., principal component analysis of atomic distortions in a single image or computing gaussian mixture model components with the transition probabilities for movies).

Here is an example of how one can train a neural network for atom/defect finding with essentially one line of code:

from atomai import atomnet

# Here you load your training data
dataset = np.load('training_data.npz')
images_all = dataset['X_train']
labels_all = dataset['y_train']
images_test_all = dataset['X_test']
labels_test_all = dataset['y_test']

# Train a model
trained_model = atomnet.trainer(
    images_all, labels_all, 
    images_test_all, labels_test_all,
    training_cycles=500).run()   

Trained models can be used to find atoms/defects in the previously unseen (by a model) experimental data:

# Here you load new experimental data (as 2D or 3D numpy array)
expdata = np.load('expdata-test.npy')

# Get model's "raw" prediction, atomic coordinates and classes
nn_input, (nn_output, coordinates) = atomnet.predictor(expdata, trained_model, refine=False).run()

One can then perform statistical analysis using the information extracted by atomnet. For example, for a single image, one can identify domains with different ferroic distortions:

from atomai import atomstat

# Get local descriptors
imstack = atomstat.imlocal(nn_output, coordinates, crop_size=32, coord_class=1)

# Compute distortion "eigenvectors" with associated loading maps and plot results:
nmf_results = imstack.imblock_nmf(n_components=4, plot_results=True)

For movies, one can extract trajectories of individual defects and calculate the transition probabilities between different classes:

# Get local descriptors (such as subimages centered around impurities)
imstack = atomstat.imlocal(nn_output, coordinates, crop_size=32, coord_class=1)

# Calculate Gaussian mixture model (GMM) components
components, imgs, coords = imstack.gmm(n_components=10, plot_results=True)

# Calculate GMM components and transition probabilities for different trajectories
traj_all, trans_all, fram_all = imstack.transition_matrix(n_components=10, rmax=10)

# and more

Quickstart: AtomAI in the Cloud

The easiest way to start using AtomAI is via Google Colab

  1. Use AtomAI to train a deep NN for atom finding

  2. Analyze distortion domains in a single atomic image

  3. Analyze trajectories of atomic defects in atomic movie - TBA

  4. Prepare training data from experimental image with atomic coordinates (beta)

  5. Atom finding using deep ensembles for uncertainty quantification (advanced)

Installation

First, install PyTorch. Then, install AtomAI via

pip install atomai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atomai-0.3.3.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

atomai-0.3.3-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

File details

Details for the file atomai-0.3.3.tar.gz.

File metadata

  • Download URL: atomai-0.3.3.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for atomai-0.3.3.tar.gz
Algorithm Hash digest
SHA256 b91c150682958f15a4be0d0b428cd8117fa18dcfd4442d94e8988933fa93b99b
MD5 b769998f66d597779721aa8beb5deef3
BLAKE2b-256 15acfbd8a099181568fa678a4d38c633d98868ec661c0134816bff9946771c69

See more details on using hashes here.

File details

Details for the file atomai-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: atomai-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 54.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for atomai-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 da592b4391cb3b40362ab686bd123a1ab7c25a27c962d79df2fa8bb500bd6b5a
MD5 df31e324ca35ca384a5a5a1be5e4083e
BLAKE2b-256 4c5356e7f752b4035d4f5afb2f674351070e045dba1fcd9a9a96166d53d06c16

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page