Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Functon: Remove Outliers and Replace with Mean
Function
Function to recursively remove outliers in a 1D data set and replace them with either the rolling mean or zero
Version

version:20211018, v1.0

Author
D. R. G. Mitchell
Acknowledgements
-
Comments
This function removes outliers in a 1D data set and replaces those values with either the rolling mean or zero. The function can be instructed to remove up to a maximum number of points until the standard deviation of the data set falls below a target value.
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
Each time an outlier is removed, it is replaced with the mean of the remaining points (or zero). The rolling mean will change as points are removed. The script shows how to identify which points have been changed by displaying the original data, the cleaned data and a binary image showing which pixels have been changed.
Supported
Yes
Included Files
Main script file.
Source Code

See attached script file.