Bin size and number of bins #18
-
I have been very impressed with this software and have been using it to understand differences between EBSD maps from a variety of samples. To make close comparisons I would like to have the same number of bins and bin sizes for each analysis. I can set the number of bins but I do not know how to set the bin size. Is this possible ? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi Joe. Thank you for using GrainSizeTools. To generate a histogram with a specific bin size you can use the # import numpy if you have not already done so
import numpy as np
# Create an array containing the limits of the bins using np.arange(Start of interval, End of interval, Spacing between values)
bin_size = 5.0
bin_edges= np.arange(dataset['diameters'].min(), dataset['diameters'].max() + bin_size, bin_size)
# generate the histogram
fig, ax = plot.distribution(dataset['diameters'], binsize=bin_edges) In the example above, I have used the minimum and maximum values of the distribution as the start and end values, and a step size of 5.0, but you can use any value you like. Note that the bin size should also be added to the maximum value to ensure no data is left out of the histogram. Let me know if it works for you. Best, Marco. PS. The way |
Beta Was this translation helpful? Give feedback.
Ok, this is a different problem.
In the case of Saltykov's method, you can only set the number of bins/classes by design, not the bin size. If you have more than one population of grain sizes, the bin size will only match if the range of grain sizes is similar between the populations, which I assume will not be the case. One option is to set an ad hoc upper limit for all your distributions. You cannot do this directly, as the method is not designed to do so, but you can modify a line of code to do it. In particular, if you open the
stereology.py
file and go to lines 107-109 you will see this: