Electron Microscopy Machine Learning (EMicroML)
emicroml is a Python library for training machine learning models for
applications in microscopy.
The source code can be found in the emicroml GitHub repository.
Instructions for installing and uninstalling emicroml
For instructions on installing the emicroml library, see the
Instructions for installing and uninstalling emicroml page.
Learning how to use emicroml
For those new to the emicroml library, it is recommended that they take a
look at the Examples page, which contain code examples that show how
one can use the emicroml library. While going through the examples, readers
can consult the emicroml reference guide to understand what each line of code
is doing.
Reproducing data of preprints and published papers
arXiv:2509.01075 (2025)
The majority of the data presented in Ref. [Fitzpatrick1] can be reproduced by running all of the examples listed on the page Examples of distortion estimation of CBED patterns.
Contents
- Home
- 1. Instructions for installing and uninstalling
emicroml - 2. Reference
- 2.1. emicroml.modelling
- 2.1.1. emicroml.modelling.cbed
- 2.1.1.1. emicroml.modelling.cbed.distortion
- 2.1.1.1.1. emicroml.modelling.cbed.distortion.estimation
- 2.1.1.1.1.1. emicroml.modelling.cbed.distortion.estimation.combine_ml_dataset_files
- 2.1.1.1.1.2. emicroml.modelling.cbed.distortion.estimation.generate_and_save_ml_dataset
- 2.1.1.1.1.3. emicroml.modelling.cbed.distortion.estimation.load_ml_model_from_file
- 2.1.1.1.1.4. emicroml.modelling.cbed.distortion.estimation.load_ml_model_from_state_dict
- 2.1.1.1.1.5. emicroml.modelling.cbed.distortion.estimation.ml_data_dict_to_distortion_models
- 2.1.1.1.1.6. emicroml.modelling.cbed.distortion.estimation.ml_data_dict_to_signals
- 2.1.1.1.1.7. emicroml.modelling.cbed.distortion.estimation.normalize_normalizable_elems_in_ml_data_dict
- 2.1.1.1.1.8. emicroml.modelling.cbed.distortion.estimation.split_ml_dataset_file
- 2.1.1.1.1.9. emicroml.modelling.cbed.distortion.estimation.unnormalize_normalizable_elems_in_ml_data_dict
- 2.1.1.1.1.10. emicroml.modelling.cbed.distortion.estimation.DefaultCBEDPatternGenerator
- 2.1.1.1.1.11. emicroml.modelling.cbed.distortion.estimation.DefaultDistortionModelGenerator
- 2.1.1.1.1.12. emicroml.modelling.cbed.distortion.estimation.MLDataset
- 2.1.1.1.1.13. emicroml.modelling.cbed.distortion.estimation.MLDatasetManager
- 2.1.1.1.1.14. emicroml.modelling.cbed.distortion.estimation.MLModel
- 2.1.1.1.1.15. emicroml.modelling.cbed.distortion.estimation.MLModelTester
- 2.1.1.1.1.16. emicroml.modelling.cbed.distortion.estimation.MLModelTrainer
- 2.1.1.1.1. emicroml.modelling.cbed.distortion.estimation
- 2.1.1.1. emicroml.modelling.cbed.distortion
- 2.1.2. emicroml.modelling.lr
- 2.1.2.1. emicroml.modelling.lr.LRSchedulerManager
LRSchedulerManagerLRSchedulerManager.core_attrsLRSchedulerManager.de_pre_serialization_funcsLRSchedulerManager.de_pre_serialize()LRSchedulerManager.dump()LRSchedulerManager.dumps()LRSchedulerManager.get_core_attrs()LRSchedulerManager.get_de_pre_serialization_funcs()LRSchedulerManager.get_pre_serialization_funcs()LRSchedulerManager.get_validation_and_conversion_funcs()LRSchedulerManager.load()LRSchedulerManager.loads()LRSchedulerManager.pre_serialization_funcsLRSchedulerManager.pre_serialize()LRSchedulerManager.total_num_stepsLRSchedulerManager.update()LRSchedulerManager.validation_and_conversion_funcs
- 2.1.2.2. emicroml.modelling.lr.schedulers
- 2.1.2.2.1. emicroml.modelling.lr.schedulers.BaseLRScheduler
- 2.1.2.2.2. emicroml.modelling.lr.schedulers.Constant
- 2.1.2.2.3. emicroml.modelling.lr.schedulers.CosineAnnealingWithWarmRestarts
- 2.1.2.2.4. emicroml.modelling.lr.schedulers.Exponential
- 2.1.2.2.5. emicroml.modelling.lr.schedulers.Generic
- 2.1.2.2.6. emicroml.modelling.lr.schedulers.Linear
- 2.1.2.2.7. emicroml.modelling.lr.schedulers.Nonsequential
- 2.1.2.2.8. emicroml.modelling.lr.schedulers.ReduceOnPlateau
- 2.1.2.2.9. emicroml.modelling.lr.schedulers.Sequential
- 2.1.2.1. emicroml.modelling.lr.LRSchedulerManager
- 2.1.3. emicroml.modelling.optimizers
- 2.1.3.1. emicroml.modelling.optimizers.AdamW
AdamWAdamW.core_attrsAdamW.de_pre_serialization_funcsAdamW.de_pre_serialize()AdamW.dump()AdamW.dumps()AdamW.get_core_attrs()AdamW.get_de_pre_serialization_funcs()AdamW.get_pre_serialization_funcs()AdamW.get_validation_and_conversion_funcs()AdamW.load()AdamW.loads()AdamW.pre_serialization_funcsAdamW.pre_serialize()AdamW.update()AdamW.validation_and_conversion_funcs
- 2.1.3.2. emicroml.modelling.optimizers.BaseMLOptimizer
BaseMLOptimizerBaseMLOptimizer.core_attrsBaseMLOptimizer.de_pre_serialization_funcsBaseMLOptimizer.de_pre_serialize()BaseMLOptimizer.dump()BaseMLOptimizer.dumps()BaseMLOptimizer.get_core_attrs()BaseMLOptimizer.get_de_pre_serialization_funcs()BaseMLOptimizer.get_pre_serialization_funcs()BaseMLOptimizer.get_validation_and_conversion_funcs()BaseMLOptimizer.load()BaseMLOptimizer.loads()BaseMLOptimizer.pre_serialization_funcsBaseMLOptimizer.pre_serialize()BaseMLOptimizer.update()BaseMLOptimizer.validation_and_conversion_funcs
- 2.1.3.3. emicroml.modelling.optimizers.Generic
GenericGeneric.core_attrsGeneric.de_pre_serialization_funcsGeneric.de_pre_serialize()Generic.dump()Generic.dumps()Generic.get_core_attrs()Generic.get_de_pre_serialization_funcs()Generic.get_pre_serialization_funcs()Generic.get_validation_and_conversion_funcs()Generic.load()Generic.loads()Generic.pre_serialization_funcsGeneric.pre_serialize()Generic.update()Generic.validation_and_conversion_funcs
- 2.1.3.4. emicroml.modelling.optimizers.SGD
SGDSGD.core_attrsSGD.de_pre_serialization_funcsSGD.de_pre_serialize()SGD.dump()SGD.dumps()SGD.get_core_attrs()SGD.get_de_pre_serialization_funcs()SGD.get_pre_serialization_funcs()SGD.get_validation_and_conversion_funcs()SGD.load()SGD.loads()SGD.pre_serialization_funcsSGD.pre_serialize()SGD.update()SGD.validation_and_conversion_funcs
- 2.1.3.1. emicroml.modelling.optimizers.AdamW
- 2.1.1. emicroml.modelling.cbed
- 2.2. emicroml.version
- 2.1. emicroml.modelling
- 3. Examples
- 3.1. Examples of CBED-related tasks
- 3.1.1. Examples of CBED multislice simulations
- 3.1.1.1. Generating the atomic coordinates of a model of MoS2
- 3.1.1.2. Generating the atomic coordinates of a model of amorphous C superblock
- 3.1.1.3. Generating the atomic coordinates of a model of MoS2 on amorphous C
- 3.1.1.4. Generating the potential slices of a model of MoS2 on amorphous C
- 3.1.1.5. Generating simulated CBED patterns of a sample of MoS2 on amorphous C
- 3.1.2. Examples of distortion estimation of CBED patterns
- 3.1.2.1. Generating machine learning datasets for training and validation
- 3.1.2.2. Combining then splitting machine learning datasets for training and validation
- 3.1.2.3. Training machine learning models
- 3.1.2.4. Generating machine learning datasets for the machine learning model test set #1
- 3.1.2.5. Combining machine learning datasets for the machine learning model test set #1
- 3.1.2.6. Running the machine learning model test set #1
- 3.1.2.7. Running the RGM test set #1
- 3.1.2.8. Analyzing machine learning model training results
- 3.1.2.9. Analyzing machine learning model testing results
- 3.1.2.10. Correcting distortion in SAED data
- 3.1.1. Examples of CBED multislice simulations
- 3.1. Examples of CBED-related tasks
- 4. Literature
- 5. License