Sunday, July 8, 2018

Python code for Williamson-Hall plot

In this post I am adding a new calculator for crystallite size and strain calculation. This is based on  Williamson-Hall plot. However, this time calculator is written in python language and anyone can download this small code snippet as a local copy on your computer to calculate size and strain.

Before you use this calculator, you need to install the following  on your computer.

1. Python 2.7 or more
2. numpy
3. scipy
4. matplotlib

You can google it and install the above very easily.
  1. You download the file williamson-hall_plot.py file
  2.  Prepare a data file with peak position in column-1 and fwhm in column-2.
  3. Save this file as "data.txt" . You can use another name for this file provided you could able to change the same in the *.py file.
  4. You open a terminal (in linux and OSX) or cmd window in WINDOWS.
  5. Direct the terminal to the place where you want to work. Means move to that folder where your *.py  and "data.txt" file exists.
  6. run the command "python williamson-hall_plot.py
That generates a plot with size and strain printed in the terminal as well as it saves the png file.  The *py file and example data file are zipped and can be downloaded here. You can edit the data file with your own data.


Please read about Williamson-Hall plot before using this code.
In due course of time I will add more notes to this post. Till then
enjoy calculation.

In case of any difficulty please post a comment.

Thursday, April 17, 2014

Refractive Index calculator

Swanepoel method: Determination of Refractive index
of single absorbing thin film

  • Step.1 The transmission spectra has been measured.
  • Step.2 The transmission_max and transmission_min envelops has to be drawn.
  • Step.3 Now we have the T_max and T_min at every measured wavelength.
  • Step.4 Leaving the highly absorbing region,i.e the absorption edge, choose the transparent region.
  • Step.5 Aprrox. for 10 to 12 wavelengths mark the T_max and T_min.
  • Step.6 Use these values and the calculator below to determine the refractive index of the film at all the wavelengths where you have noted the Tmax and Tmin.
  • Later one can plot refractive index Vs wave length plot in any plotting program
  • I have added the entry called wavelength, only to indicate where you are calculating the refractive index.

Wavelength 'nm':
Substrate 'n':
T max :
T min :
Thin Film Refractive index:
Note: The instructions are not complete but the calculator is useful for those who knows what to be calculated. Please read the article by Swanepoel (http://iopscience.iop.org/0022-3735/16/12/023/) then you can see the utility of this calculator. Enjoy

Sunday, July 7, 2013

XRD Crystallite Size calculator


Here is the online crystallite size calculator  
Using Scherrer equation one can calculate crystallite size from XRD data.


Crystallite size = 0.94 * x ray wavelength / beta * cos (theta)




Dp Calculator : Using Scherrer formula
Wavelength: Ang
Peak Width: degrees
Peak Position: degrees
Crystallite size: nm
Lattice Strain:
Note: Don't bother about  β in radians. All the entries are in degrees. The conversions are taken care in the computing code.

Caution: The crystallite size may appear large from the above method compared to the size determined from other methods. However, these numbers will be within the tolerance limits. More suitable for entry level research students.