-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path__init__.py
61 lines (46 loc) · 1.52 KB
/
__init__.py
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
from os.path import join as joinpath
from os.path import dirname, abspath
from ds import set_parameter
DS_DATADIR = abspath(joinpath(dirname(__file__), 'data'))
class ParameterEnum(object):
def set_parameters_for(self, device, region):
"""
Use this function to register the parameters of this class into the
simulation context. Internally uses ds.set_parameters()
"""
props = [
pname for pname in dir(self)
if not pname.startswith('_') and not callable(getattr(self, pname))
]
for propname in props:
set_parameter(
device=device,
region=region,
name=propname,
value=getattr(self, propname)
)
class _PhysicalConstants(ParameterEnum):
# Vacuum permittivity or Dielectric constant (F/cm)
eps_0 = 8.854_187_817e-14
# The electron charge (Couloumbs)
q = 1.602_176_46e-19
ElectronCharge = q
# Boltzmann constant (J/K)
k = 1.380_648_52e-23
# Speed of light in vacuum (m/s)
c = 299_792_458
# The Planck Constant (J*s)
h = 6.626_0697e-34
# Planck's constant times speed of light (J*m)
hc = 1.986_445_683e-25
PhysicalConstants = _PhysicalConstants()
class _AmbientConditions(ParameterEnum):
# Ambient temperature (k)
T = 300
@property
def kT(self):
return PhysicalConstants.k * self.T
@property
def V_t(self):
return self.kT/PhysicalConstants.q
AmbientConditions = _AmbientConditions()