Giter VIP home page Giter VIP logo

ronchigram-matlab's Introduction

ronchigram-matlab

By Noah Schnitzer, Suk Hyun Sung @ Hovden Lab

Code accompanying our paper: Schnitzer, N., Sung, S. H., & Hovden, R. (2020). Optimal STEM Convergence Angle Selection Using a Convolutional Neural Network and the Strehl Ratio. Microscopy and Microanalysis, 26(5), 921-928.

A MATLAB library for quick simulation of the STEM probe and electron Ronchigram, and training of a CNN to assess probe quality from the Ronchigram.

See also: http://ronchigram.com/ (source) for a similar JS/Wasm project.

MATLAB scripts and functions are organized into folders but are mutually dependent -- all subfolders must be added to the path to work properly. assessment and simulation functions are well tested for reasonable inputs, dataset_building scripts are not and should be used cautiously/as examples.

To get started, check out misc/example.m

Description of scripts and functions:

  • assessment: functions to calculate heuristics for aberration functions
    • indiv_p4_calculator.m: Calculate the individual aberration phase shift convergence angle for a single aberration
    • par_strehl_calculator.m: Calculate the Strehl ratio converence angle (parallel) for aberrations
    • pi4_calculator.m: Calculate the total aberration phase shift convergence angle for a single aberration
    • probe_sizer.m: Wraps resolution_test.m to calculate 50% probe current diameter for given aberration functions and convergence angles
    • resolution_test.m: Poorly named probe size assessment, should be used with effprobe option
    • strehl_calculator.m: Calculate the Strehl ratio converence angle for aberrations
  • CNN: scripts to train and test CNN on simulated Ronchigrams
    • lim_net.m: Train CNN used in paper
    • transfer_learning.m: Transfer learn on Alexnet
  • dataset_building: scripts and functions to build data sets. Note many parameters are embedded in scripts, have only been tested for limitied inputs.
    • aberration_series.m: Calculates heuristics as specific aberrations are varied. Used to e.g. find defocus to balance other aberrations.
    • dataset_generator.m: Generates a dataset with a ~ uniform distibution of convergence angles.
    • defocus_distribution.m: More slowly generates a dataset with ~ uniform distribution of convergence angles and defocus set to compensate other aberrations.
    • distribution_generator.m: Subroutine to generate aberrations and dynamically scale to try to get uniform CA distribtion.
  • misc: miscellaneous scripts and functions, e.g. utilities and examples
    • ab_set.mat: Test set of in-focus randomly generated aberrations with a broad range of optimal convergence angles. Read by ronchi_game.m, used for testing network and human performance in paper.
    • colordef.m: Colors from paper
    • example.m: Brief walkthrough for Ronchigram simulation and heuristic calculation
    • get_aberration.m: Calculates the phase shift for a specific aberration
    • normalize_data.m: Normalizes data to min 0 max 1
    • px_to_ang.m : Calculates the scale factor ร…/px for a given accelerating voltage and simulation dimension
    • radial_average.m: Calculates a radial average
    • ronchi_game_labeling.m: Minimal version of ronchi_game GUI Application for human aperture selection. This version has no feedback and minimal UI for quick labeling of testing data. Requires a file ab_set.mat in the working directory with a variable abs with containing any number of aberrations. User selections will be saved in game_res_1.mat file in the working directory.
  • ronchi_game: GUI Application for human aperture selection, with optional feedback.
  • simulation: functions for STEM probe and Ronchigram simulation
    • aberration_generator.m: Generates aberrations with random magnitude and angle out to 5th order. Relative scale of magnitudes is based off observations from AC-STEM, Kirkland 2011 Ultramicrosc.
    • aperture_mask.m: Generates a binary disc of given radius
    • calculate_aberration_function.m: Calculates phase shift for an aberration function
    • calculate_probe.m: Calculates STEM probe given ab phase shift, convergence angle
    • shifted_ronchigram.m: Calculates a Ronchigram for an aberration function, shift in Ronch center relative to obj aperture, and convergence angle
    • shifted_ronchigram_o.m: Legacy shifted_ronchigram to match parameters (e.g. grating resize factor) of trained networks.

ronchigram-matlab's People

Contributors

noahschnitzer avatar sukhsung avatar

Stargazers

 avatar Jonathan Schwartz avatar

Watchers

James Cloos avatar

Forkers

ghzytp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.