-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilamentAnalysis.py
More file actions
149 lines (127 loc) · 5.11 KB
/
Copy pathFilamentAnalysis.py
File metadata and controls
149 lines (127 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import pandas as pd
import numpy as np
from scipy import stats
from linearFitting import linearFitting
class FilamentExp:
def __init__(self, datapath, memo, filamentV, ionCut, peCutL, peCutR, cutBK_L = 0, cutBK_R = 2, cutRM_L = 6, cutRM_R = 8) -> None:
self.memo = memo
""" parameter """
self.filamentV = filamentV
self.cutIon = ionCut
self.cutPE_L = peCutL
self.cutPE_R = peCutR
self.cutBK_L = cutBK_L
self.cutBK_R = cutBK_R
self.cutRM_L = cutRM_L
self.cutRM_R = cutRM_R
""" make pandas df """
colName = ['Vb','I']
self.data = pd.read_csv(datapath, delimiter='\t', names=colName, header=None)
self.data = self.data.dropna().reset_index(drop=True)
""" 사용할 축들 """
self.dataV = self.data['Vb'].to_numpy()
self.dataI_original = self.data['I'].to_numpy()
# Ion 제거
self.dataI_del_Ion = None
# Ion, Primary electron 제거
self.dataI_del_Ion_PE = None
# Ion, Primary electron 제거하고 ln씌운거
self.dataI_del_Ion_PE_ln = None
""" 얻게될 결과 및 람다함수들 """
# result dictionary 구성
# dict{'polynomial': array([기울기, y절편]), 'determination': 결정계수}
# Ion curve
self.resultIon = None
self.curveIon = None
# Primary Electron curve
self.resultPE = None
self.curvePE = None
# Bulk Electron curve
self.resultBE = None
self.curveBE = None
# rightmost curve (플라즈마 전위구할때 씀)
self.resultRM = None
self.curveRM = None
""" characteristic values """
self.plasmaV = None
self.tempBE = None
self.nIon = None
self.nPE = None
self.nBE = None
def calculate(self):
self.linearFit_Ion()
self.linearFit_PE()
self.linearFit_BE()
self.linearFit_RM()
self.calcCharacteristics()
def linearFit_Ion(self):
self.resultIon = linearFitting(self.dataV,self.dataI_original,xTo=self.cutIon)
self.curveIon = np.poly1d(self.resultIon['polynomial'])
self.dataI_del_Ion = self.dataI_original - self.curveIon(self.dataV)
def linearFit_PE(self):
self.resultPE = linearFitting(self.dataV,self.dataI_del_Ion,xFrom=self.cutPE_L,xTo=self.cutPE_R)
self.curvePE = np.poly1d(self.resultPE['polynomial'])
self.dataI_del_Ion_PE = self.dataI_del_Ion - self.curvePE(self.dataV)
def linearFit_BE(self):
""" BE 전자의 linear fitting은 전류에(y축에) ln을 적용하고 이뤄짐 """
# abs를 취하는 이유는 ln 오류방지하기 위함. 큰 상관없음
self.dataI_del_Ion_PE_ln = np.log(np.abs(self.dataI_del_Ion_PE))
self.resultBE = linearFitting(self.dataV,self.dataI_del_Ion_PE_ln,xFrom=self.cutBK_L,xTo=self.cutBK_R)
self.curveBE = np.poly1d(self.resultBE['polynomial'])
def linearFit_RM(self):
self.resultRM = linearFitting(self.dataV,self.dataI_del_Ion_PE_ln,xFrom=self.cutRM_L,xTo=self.cutRM_R)
self.curveRM = np.poly1d(self.resultRM['polynomial'])
def calcCharacteristics(self):
""" 플라즈마 전위 """
coeffBE = self.resultBE['polynomial']
coeffRM = self.resultRM['polynomial']
self.plasmaV = - (coeffBE[1] - coeffRM[1])/(coeffBE[0] - coeffRM[0])
""" 전자 온도 """
# Bulk Electron ln 상에서 linearfit 한거 기울기 역수가 온도(eV)
self.tempBE = 1/coeffBE[0]
""" 상수 """
e = 1.6 * 10**(-19)
k = 8.617 * 10**(-5)
me = 9.109 * 10**(-31)
# 타겟기체 질량, 여기선 Ar
M_ion = 40 * 1.66 * 10**(-27)
Cs = np.sqrt(self.tempBE/M_ion)
# 탐침 면적
Area = np.pi * (0.005) ** 2
""" 이온 밀도 """
IonIsat = self.curveIon(self.plasmaV)
self.nIon = IonIsat/(0.6 * e * Area * Cs)
""" 주 전자 밀도 """
PEIsat = self.curvePE(self.plasmaV)
vp = np.sqrt(2*e*(self.plasmaV - self.filamentV) / me)
self.nPE = 4*PEIsat/(e * vp * Area)
""" 벌크 전자 밀도 """
BEIsat = np.exp(self.curveBE(self.plasmaV))
vth = np.sqrt(8*self.tempBE / np.pi * me)
self.nBE = 4*BEIsat/(e*vth*Area)
def breif(self):
print(self.memo)
# Ion curve
print("이온 커브")
print(self.resultIon)
# Primary Electron curve
print("PE 커브")
print(self.resultPE)
# Bulk Electron curve
print("bulk전자 커브(ln 씌운거)")
print(self.resultBE)
# rightmost curve (플라즈마 전위구할때 씀)
print("Rm 커브(ln 씌운거)")
print(self.resultRM)
""" characteristic values """
print("플라즈마 전위")
print(self.plasmaV)
print("벌크전자 온도")
print(self.tempBE)
print("이온 밀도")
print(self.nIon)
print("주전자 밀도")
print(self.nPE)
print("벌크전자 밀도")
print(self.nBE)
print("")