GrainSizeTools Icon



A Python script for estimating the grain size from thin sections

Add a Review
1 Download (This Week)
Last Update:
Browse All Files
Windows Mac Linux



GrainSizeTools is a free open-source cross-platform script written in Python that provides a number of tools with the aim of characterizing the population of grain sizes in dynamically recrystallized mylonites. The script is suitable to use in paleopiezometry studies using different parameters as well as to derive the actual population of grain sizes from thin sections (available since v.0.3). The script requires the previous measurement of the grain sectional areas from a thin section. There is no need of previous knowledge of Python language to use the script and get the results. For advanced users, the script is organized in a modular way using Python functions, which facilitates to modify, reuse or extend the code.

A full paper describing the method applied by the script for paleopiezometry studies can be found here:

about the author:

GrainSizeTools Web Site


  • It allows to load text files -txt or csv- with the sectional areas of the grains
  • It allows to calculate the apparent diameters of the grains from the sectional areas via the equivalent circular diameter
  • It allows to correct the diameters calculated by adding the perimeter of the grains
  • It returns the mean, the median and the area-weighted grain size of the apparent population of grain sizes.
  • It returns the peak of the frequency grain size via the Gaussian kernel density estimator and the central values of the modal intervals in the number- and area-weighted plots
  • The script implements several algorithms to estimate the optimal bin size of the histogram and the bandwidth of the Gaussian KDE based on population features
  • It estimates the actual 3D populations of grains from the population of apparent (2D) grain sizes using the Scheil-Schwartz-Saltykov method to unfold the 2D population. Similar to the StripStar script.
  • It produces ready-to-publish plots, allowing to save the graphical output as a bitmap or vector images.


Write a Review

User Reviews

Be the first to post a review of GrainSizeTools!

Additional Project Details

Intended Audience


Programming Language



Screenshots can attract more users to your project.
Features can attract more users to your project.

Icons must be PNG, GIF, or JPEG and less than 1 MiB in size. They will be displayed as 48x48 images.