<jupyter_start><jupyter_text>Imports<jupyter_code>%matplotlib inline
import matplotlib.pyplot as pyplot
import read_data as rd
import Pass
import numpy as np
import glob
from scipy.interpolate import interp1d<jupyter_output><empty_output><jupyter_text>Read and display data for interval selction<jupyter_code>fileList = sorted(glob.glob('data/profile/*.txt'))
passList = [rd.read_pass_data(file) for file in fileList]
siz = len(passList)


#fig1 = pyplot.figure()
for pas in passList:
    #ax = fig1.add_subplot( (siz)*100 + passList.index(pas)+11)
    fig = pyplot.figure()
    ax = fig.add_subplot(111)
    ax.plot(pas.depth)<jupyter_output><empty_output><jupyter_text>Compute coating thicknessPut min and max limits for substrat surface and coating surface.<jupyter_code>limits = [[0, 80, 100, 170],
          [0, 900, 1000, 1200],
          [0, 300, 430, 600],
          [0, 300, 350, 420],
          [0, 300, 390, 850]]

fig2 = pyplot.figure(figsize = (15,2*siz))

for i in range(len(passList)):
    min1 = limits[i][0]
    max1 = limits[i][1]
    min2 = limits[i][2]
    max2 = limits[i][3]
    fit1 = np.polyfit( passList[i].distance[min1:max1], passList[i].depth[min1:max1], 1 )
    fit2 = np.polyfit( passList[i].distance[min2:max2], passList[i].depth[min2:max2], 1 )
    print('for ' + fileList[i] + ' coating thickness is:')
    print(np.abs(fit1[1]-fit2[1]))
    print()
    passList[i].depth = passList[i].depth - np.poly1d(fit1)(passList[i].distance)
    ax = fig2.add_subplot( (siz)*100 + i+11)
    ax.plot(passList[i].distance[min1:max2], passList[i].depth[min1:max2])

pyplot.plot(passList[1].depth[1000:1200])<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup