Skip to main content

Deep and machine learning for atom-resolved data

Project description

Build Status Documentation Status Colab Codacy Badge

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 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)

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.2.0.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

atomai-0.2.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: atomai-0.2.0.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for atomai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3dce907748a465e3b57674e828d953f1e2afa7f774b7a02bc0f2bc6bbfbe1e99
MD5 7fa96a446b20548760d28368dbab7094
BLAKE2b-256 97bc48216f6645d5f9c72d74c366cffb07679c05a36d98164f16ee79684e696f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: atomai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for atomai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 495f212b53c021d9a8dab3c2dce645a0ab487954e8ef80818a661e5c83e01e87
MD5 ea8eeb2da0bd70f00f75c8718b3277c6
BLAKE2b-256 bb6dde1939b54e443c28cf6ce9d8baf8edb2ca5a42a93bd8dee768f22002ac52

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