Material Files - derangedhk417/MicroscopeControl GitHub Wiki

Introduction

A material file is a *.json file that specifies the optical contrast values that are expected for various thicknesses of a specific material on a specific substrate. For example, the following material file specifies optical contrast values calculated for graphite/graphene on 90 nm silicon dioxide on a silicon substrate.

{
	"material"  : "HOPG on 90 nm SiO2",
	"threshold" : {
		"comment" : "Any pixel with a contrast value under this value will be set to zero and assumed to contain no relevant data.",
		"r" : 0.04993664667,
		"g" : 0.0688205,
		"b" : 0.08017303333
	},
	"comment" : "Each row of \"layers\" should be n_layers, thickness [m], r, g, b",
	"layers": [
		[1,  3.350000E-10, 7.950581E-02, 1.164617E-01, 1.410890E-01],
		[2,  8.100000E-10, 1.682133E-01, 2.593853E-01, 3.238369E-01],
		[3,  1.285000E-09, 2.922049E-01, 4.470709E-01, 5.521975E-01],
		[4,  1.760000E-09, 4.374985E-01, 6.644037E-01, 8.118163E-01],
		[5,  2.235000E-09, 6.064254E-01, 9.143403E-01, 1.105006E+00],
		[6,  2.710000E-09, 8.015585E-01, 1.200048E+00, 1.434053E+00],
		[7,  3.185000E-09, 1.025734E+00, 1.524902E+00, 1.801171E+00],
		[8,  3.660000E-09, 1.282072E+00, 1.892467E+00, 2.208442E+00],
		[9,  4.135000E-09, 1.574000E+00, 2.306487E+00, 2.657757E+00],
		[10, 4.610000E-09, 1.905274E+00, 2.770848E+00, 3.150744E+00]
	]
}

This specific file contains optical contrast values for between 1 and 10 layers of graphene. This file can be supplied to Scan.py, where it will be used to estimate the thickness of flakes in images.

Generating a File

Material files can technically be generated with many different methods. This could include experimentally determining the optical contrast of various thicknesses of material. In practice, the easiest way to do this is with the ContrastCalculator.py tool in the src/utils/ folder of this repository. This program uses classical thin-film interference calculations to estimate the optical contrast of various layer thicknesses of materials. In order to do this, it needs to have several pieces of information:

  1. The thickness and order of materials on the sample
  2. Which parts of the sample are considered substrate and which parts are the material you are looking for
  3. The wavelength dependent complex refractive index of the each material (usually from refractiveindex.info)
  4. The Numerical Aperture of your objective lens
  5. The angle dependence of the intensity of your source lamp
  6. The spectrum of your source lamp
  7. The wavelength response curve of your camera's image sensor

Using this information, ContrastCalculator.py will produce a matrix of values that can be inserted into a json structure like the one above in order to make a "material" file. At the time of this writing, this process requires a little bit of work and is not a simple command line interface. In order to generate this structure for a new material, you need to make some changes to the code.

Generating a File

ContrastCalculator.py is currently setup to generate a material file for HOPG on 90nm SiO2 on Silicon.

n = np.arange(10) + 1
d = 0.475e-9*n - 0.14e-9

These lines create an array of values corresponding to the thickness of 1-10 layers of graphene (in meters).

calculator = ContrastCalculatorLoader(
	["materials/graphene.csv", "materials/quartz_thin_film.csv", "materials/silicon.csv"],
	"cameras/IMX264.csv",
	4000,
	0.1,
	heights=[3.34e-10, 90e-9],
	lens={
		'NA' : 0.42,
		'spectral_domain' : [
			435e-9,
			655e-9
		]
	},
	wavelength_resolution=256,
	angle_resolution=256
).getCalculator()

These lines instantiate a ContrastCalculator object and supply it with the information necessary to perform a calculation. In this example, the materials, from top to bottom, are graphene, SiO2 and Silicon. The image sensor on this microscope is a Sony IMX264. The cameras/IMX264.csv file was produced by using GraphGrabber to extract values from the wavelength response curve in the datasheet for the image sensor. The 4000 specified under the camera is the color temperature of the source.

Important: Shortly before my last day, I realized that the spectrum of this source is actually not even remotely close to a black body spectrum. I used a spectrometer to measure the source spectrum immediately before the camera. The results of this measurement are in src/utils/source_spectrum.txt. I have not yet converted this into a file that can be used by the calculator. The calculator does support the use of a *.csv file for a source spectrum. Someone will have to convert it into a properly formatted csv file first.

The next argument is the source angle dependence. See utils/ContrastCalculator.py > ContrastCalculator > setSourceSpectrumMonochrome for details on how this parameter is used.

The wavelength_resolution and angle_resolution parameters determine how many steps are used when computing the wavelength dependent and angle dependent portions of the triple integral necessary to calculate optical contrast. They can almost always be left as is.

The remaining code in this file simply modifies the height of the first element in the stack (the graphite/graphene). It performs a contrast calculation for each height and then prints these values in a structure that can be copied and pasted into a json file.