GrainSizeTools script Icon

GrainSizeTools script

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




Homepage & documentation:

GrainSizeTools script is a free open-source cross-platform script written in Python that provides a number of tools with the aim of characterizing the grain size and the actual population of grain sizes in dynamically recrystallized rocks. The script is suitable to use in paleopiezometry studies, using different 1D grain size measures, as well as to derive the actual 3D population of grain sizes from 2D data (i.e. thin sections). The script only 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 (see documentation). For advanced users, the script is organized in a modular way using Python functions, which facilitates to modify, reuse or extend the code if needed.

GrainSizeTools script Web Site


Earth Sciences


Apache License V2.0


  • It allows to load and automatically extract data of interest from txt and csv files generated by the ImageJ or similar applications.
  • It allows to calculate the apparent diameters of the grain profiles from their sectional areas via the equivalent circular diameter. It also allows to correct the diameters calculated by adding the perimeter of the grains.
  • It allows to easily estimate different 1D grain sizes for paleopiezometry studies, including the mean, the median, the area-weighted mean and the frequency peak grain sizes of the apparent population of grain sizes.
  • It implements several algorithms to estimate the optimal bin size of histograms and the optimal bandwidth of the Gaussian KDE based on the population features.
  • It allows to estimate the actual 3D populations of grains from the population of apparent (2D) grain sizes using a variant of the Saltykov method to unfold the apparent grain size population. Similar to what the StripStar script does. It also returns an estimation of the volume of a particular grain fraction defined by the user.
  • In the case of completely dynamically recrystallized samples, it also allows to estimate the best-fit log-normal probability density function to the 3D population of grain sizes by estimating the best-fit optimal shape and scale parameters using a experimental method called the two-step method (Lopez-Sanchez and Llana-Fúnez, to submit soon).
  • It produces a number of different ready-to-publish plots, allowing to save the graphical output as a bitmap or vector images. The script include the following plots: i) the number- and area-weighted population of apparent grain sizes, ii) the frequency and volume-weighted cumulative frequency curve of the derived 3D grain size population, and iii) the best-fit log-normal probability density function with errors.


Write a Review

User Reviews

Be the first to post a review of GrainSizeTools script!

Additional Project Details

Intended Audience


Programming Language



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