In [1]:
from IPython.core.display import Image, display
import numpy as np
import pandas as pd

Demo of Polybot Data Extraction tools

The data extraction component in Polybot provides various tools and functions for data plotting and analysis.
In [2]:
from polybot import data_tools
Here, we imported the data extraction tools as data_tools, and we will demonstrate its usage on example raw data collected from hardware modules in our robotic system.

Table of Contents

1. Spectrometer

  • Example raw UV/Vis data
  • Plot UV/Vis spectrum
  • Extract peaks

2. Electrical I-V

  • Example raw current-voltage data
  • Plot I-V curves
  • Analysis of I-V curves

3. Thin film Imaging

  • Example of defective films
  • Example of non-defective films
  • Identify defective films

1. Spectrometer

  • Example raw UV/Vis data:
In [3]:
data = pd.read_csv('spectro_data/1.csv',header=0)

data
Out[3]:
Wavelength (nm) Abs_sebs-0 Abs_dopstrain0-1-0 dopstrain0-1-0 dopstrain0-1-0.1
0 1100 0.251297 0.256858 0.005561 0.000000
1 1099 0.252104 0.257731 0.005627 0.000066
2 1098 0.252850 0.258198 0.005349 -0.000212
3 1097 0.253113 0.258448 0.005336 -0.000225
4 1096 0.253693 0.259032 0.005339 -0.000222
... ... ... ... ... ...
596 504 0.592828 0.632611 0.039783 0.034223
597 503 0.592440 0.632336 0.039896 0.034335
598 502 0.592055 0.632125 0.040070 0.034509
599 501 0.591591 0.631888 0.040297 0.034737
600 500 0.591165 0.631674 0.040509 0.034948

601 rows × 5 columns

In [4]:
x = data['Wavelength (nm)'].to_numpy()
y = data['Abs_sebs-0'].to_numpy()
  • Plot UV/Vis spectrum:
data_tools.spectro_plot (x, y, s=1.0, png='spectro_plot.png')

Parameters:
x (np.ndarray) : x-axis data
y (np.ndarray) : y-axis data
s (float, optional) : scaling factor for peak prominence
png (str, optional) : output image file

Returns:
out (None)
In [5]:
data_tools.spectro_plot(x, y, png='spectro_data/1.png')

print("top: raw data, bottom: smoothed curve and peak identification")
display(Image(filename="spectro_data/1.png",width=600))
top: raw data, bottom: smoothed curve and peak identification
  • Extract peaks:
data_tools.spectro_extract_peaks (x, y, s=1.0)

Parameters:
x (np.ndarray) : x-axis data
y (np.ndarray) : y-axis data
s (float, optional) : scaling factor for peak prominence

Returns:
out (dict) : {
'peaks' : np.ndarray of peak positions,
'peaks_y' : np.ndarray of peak heights,
}
In [6]:
out = data_tools.spectro_extract_peaks(x, y)
print('peak positions =',out['peaks'])
print('peak heights =',out['peaks_y'])
peak positions = [797 548 620]
peak heights = [0.54316649 0.61089741 0.51811974]

2. Electrical I-V

  • Example raw current-voltage data:
In [7]:
data = pd.read_csv('IV_data/1.csv',header=0)

data
Out[7]:
Time DrainI SourceI Time.1 GateI GateV GM IDLIN VT
0 0.517680 -6.685453e-10 -1.964147e-10 0.519860 -2.085400e-09 10.000 #REF 0.000026 -27.6417
1 0.935976 -6.345593e-10 -1.862870e-11 0.955917 -2.479200e-09 7.095 -11.6991E-12 0.000025 NaN
2 1.259000 -7.776247e-10 3.669502e-10 1.261200 -2.817500e-09 4.195 49.3329E-12 0.000028 NaN
3 1.696700 -4.136500e-09 3.737200e-09 1.716600 -2.655900e-09 1.290 1.1562E-9 0.000064 NaN
4 1.963100 -7.832450e-08 7.805570e-08 1.983300 -2.832600e-09 -1.615 25.5380E-9 0.000280 NaN
... ... ... ... ... ... ... ... ... ...
59 10.593300 -2.888790e-10 -1.073604e-10 10.595400 -2.494300e-09 -1.615 232.0648E-12 0.000017 NaN
60 11.056000 -3.963813e-10 -3.029871e-10 11.076300 -2.403500e-09 1.290 -37.0060E-12 0.000020 NaN
61 11.848200 -3.055116e-10 -1.232344e-10 11.832300 -2.534700e-09 4.195 31.2804E-12 0.000017 NaN
62 12.458600 -3.062930e-10 -2.877913e-10 12.478700 -2.489300e-09 7.095 -269.4492E-15 0.000018 NaN
63 13.264800 -2.966447e-10 -7.413690e-11 13.248900 -2.666000e-09 10.000 3.3213E-12 0.000017 NaN

64 rows × 9 columns

  • Plot I-V curves:
data_tools.IV_plot (data, png='IV_plot.png')

Parameters:
data (pd.DataFrame) : I-V raw data
png (str, optional) : output image file

Returns:
out (None)
In [8]:
data_tools.IV_plot(data, png='IV_data/1.png')

print("I-V curve of interest is in red")
display(Image(filename="IV_data/1.png",width=600))
I-V curve of interest is in red
  • Analysis of I-V curves:
data_tools.IV_analysis (data)

Parameters:
data (pd.DataFrame) : I-V raw data

Returns:
out (dict) : {
'slope' : float,
'intercept' : float,
}
In [9]:
out = data_tools.IV_analysis(data)

out
Out[9]:
{'slope': 0.00209, 'intercept': 0.00076194}

3. Thin film Imaging

  • Example of defective films:

left: trenches (acceptable but not preferred), right: bad morphology (must reject)


  • Example of non-defective films:

smooth surfaces hence low contrast

  • Identify defective films:
data_tools.imaging_variance (imagefile)

Parameters:
imagefile (str) : filename to read

Returns:
variance (float) : range [0,1], closer to 0 is non-defective
In [10]:
print("# image_file,           variance,   defective film?")
for i in [1,2,3,4]:
    imagefile = f"imaging_data/{i}.png"
    variance = data_tools.imaging_variance(imagefile)
    print(f"| {imagefile},   {variance:.6f},   {variance>0.001}")
# image_file,           variance,   defective film?
| imaging_data/1.png,   0.008359,   True
| imaging_data/2.png,   0.004139,   True
| imaging_data/3.png,   0.000025,   False
| imaging_data/4.png,   0.000064,   False

variance filter highlights defects in films

variance filter has minimal effect on non-defective films