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

Uploaded Source

Built Distribution

atomai-0.3.1-py3-none-any.whl (52.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for atomai-0.3.1.tar.gz
Algorithm Hash digest
SHA256 09a2aec48276dac9c01e8c12c03ef1d33179e010f53a02497d473cf0ed0ac4fd
MD5 830c08ee6cf6f2cdc82eee6f69752b61
BLAKE2b-256 81e1794e2520dd743fa97c40a9873215368bf169c8d5af38865996f067166a9b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for atomai-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39a62204acd89a0eb393aac96ef05bfcd43a91a2e6e345f6f73570c7799cca24
MD5 941f721c77f4a7ceb132dbb5d826f0ad
BLAKE2b-256 390ce9b4b18a79b5693fdb42a6ca80578ef77d6b4f79316b3892cdb099132601

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