Skip to content

Commit

Permalink
python formatting: autopep8 . --select E12,E101
Browse files Browse the repository at this point in the history
  • Loading branch information
tcaduser committed Jan 11, 2020
1 parent eb89ba3 commit a1f9a4f
Show file tree
Hide file tree
Showing 15 changed files with 931 additions and 931 deletions.
78 changes: 39 additions & 39 deletions data/ft.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@
filename = 'ft_data.out'

def create_data(data):
vbe = data[0,1]-data[0,3]
IC = data[0,5]
ic = data[:,9] + 1j*data[:,10]
ib = data[:,7] + 1j*data[:,8]
beta = abs(ic / ib)
f = data[:,0]
betadc = beta[0]
ft = None
if betadc > 1:
for i in range(1, len(beta)):
if beta[i] < 1:
# simple linear interpolation
# should use log
y1 = numpy.log(beta[i])
y0 = numpy.log(beta[i-1])
x1 = numpy.log(f[i])
x0 = numpy.log(f[i-1])
m = (y1-y0)/(x1-x0)
x = x1 - y1/m
ft = numpy.exp(x)
break
return (vbe, {
'f' : f,
'ib' : ib, #ac ib
'ic' : ic, #ac ic
'IC' : IC, #dc Ic
'beta' : beta, #ac beta
'ft' : ft,
})
vbe = data[0,1]-data[0,3]
IC = data[0,5]
ic = data[:,9] + 1j*data[:,10]
ib = data[:,7] + 1j*data[:,8]
beta = abs(ic / ib)
f = data[:,0]
betadc = beta[0]
ft = None
if betadc > 1:
for i in range(1, len(beta)):
if beta[i] < 1:
# simple linear interpolation
# should use log
y1 = numpy.log(beta[i])
y0 = numpy.log(beta[i-1])
x1 = numpy.log(f[i])
x0 = numpy.log(f[i-1])
m = (y1-y0)/(x1-x0)
x = x1 - y1/m
ft = numpy.exp(x)
break
return (vbe, {
'f' : f,
'ib' : ib, #ac ib
'ic' : ic, #ac ic
'IC' : IC, #dc Ic
'beta' : beta, #ac beta
'ft' : ft,
})

data = pylab.loadtxt(filename)
#print len(data)
Expand All @@ -57,17 +57,17 @@ def create_data(data):
imin = 0
datasets = []
for i in range(1,len(data)):
f = data[i,0]
if f == fmin:
datasets.append(create_data(data[imin:i]))
imin = i
f = data[i,0]
if f == fmin:
datasets.append(create_data(data[imin:i]))
imin = i
datasets.append(create_data(data[imin:i]))
#print datasets
pylab.figure()
for v, d in datasets:
#print '%g %d' %(v, round(v*10))
if abs(round(v*10.0) - v*10.0) < 1e-2:
pylab.loglog(d['f'], d['beta'], label=str(v))
#print '%g %d' %(v, round(v*10))
if abs(round(v*10.0) - v*10.0) < 1e-2:
pylab.loglog(d['f'], d['beta'], label=str(v))
pylab.xlabel(r'$f$ (Hz)')
pylab.ylabel(r'$|\beta\|$')
pylab.legend(loc='upper right')
Expand All @@ -80,9 +80,9 @@ def create_data(data):
ft = []
pylab.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
for i in datasets:
if i[1]['ft']:
IC.append(i[1]['IC'])
ft.append(i[1]['ft'])
if i[1]['ft']:
IC.append(i[1]['IC'])
ft.append(i[1]['ft'])
pylab.semilogx(IC, ft, '-+')
pylab.xlabel(r"$I_c$ (A/cm)")
pylab.ylabel(r"$f_T$ (Hz)")
Expand Down
8 changes: 4 additions & 4 deletions data/ic_vce.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
)

for filename in files:
data = pylab.loadtxt(filename)
vce = data[:,1]-data[:,2]
ic = data[:,4]
pylab.plot(vce, ic)
data = pylab.loadtxt(filename)
vce = data[:,1]-data[:,2]
ic = data[:,4]
pylab.plot(vce, ic)

pylab.xlabel(r"$V_{ce}$ (V)")
pylab.ylabel(r"$I_c$ (A/cm)")
Expand Down
138 changes: 69 additions & 69 deletions simdir/bjt_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,84 +18,84 @@
import netdoping

def make_bias(contact):
def mycall():
print("BIAS %s %1.15g" % (contact, get_circuit_node_value(solution="dcop", node=GetContactBiasName(contact))))
return mycall
def mycall():
print("BIAS %s %1.15g" % (contact, get_circuit_node_value(solution="dcop", node=GetContactBiasName(contact))))
return mycall

def make_sweep(contact_names, bias_names):
#cnames = ("base", "collector", "emitter")
def mycall():
v=[]
#cnames = ("base", "collector", "emitter")
def mycall():
v=[]
for c in contact_names:
v.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c)))
for b in bias_names:
v.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I"))
print("CURVE: " + " ".join(v))
h = []
for c in contact_names:
v.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c)))
for b in bias_names:
v.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I"))
print("CURVE: " + " ".join(v))
h = []
for c in contact_names:
h.append("V(%s)" % c)
for c in contact_names:
h.append("I(%s)" % c)
print("HEADER: " + " ".join(h))
return mycall
h.append("V(%s)" % c)
for c in contact_names:
h.append("I(%s)" % c)
print("HEADER: " + " ".join(h))
return mycall

def make_ac_callback(contact_names, bias_names, minf, maxf, ppd):
cnames = ("base", "collector", "emitter")
if (minf > maxf) or (minf <= 0.0) or (ppd <= 0):
raise NameError("minf must be less than maxf and greater than zero. ppd must be greater than 0")
ppde = pow(10, 1/ppd)
f = minf
freqs = [minf]
while f < maxf:
f *= ppde
if f > maxf:
f = maxf
freqs.append(f)
h = ["f"]
for c in contact_names:
h.append("V(%s)" % c)
for c in contact_names:
h.append("I(%s)" % c)
for c in contact_names:
h.append("IR(%s)" % c)
h.append("II(%s)" % c)
print("ACHEADER: " + " ".join(h))
def ac_callback():
# solve a few extra times for better ac sensitivity
solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40)
solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40)
solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40)
cinfo = []
cnames = ("base", "collector", "emitter")
if (minf > maxf) or (minf <= 0.0) or (ppd <= 0):
raise NameError("minf must be less than maxf and greater than zero. ppd must be greater than 0")
ppde = pow(10, 1/ppd)
f = minf
freqs = [minf]
while f < maxf:
f *= ppde
if f > maxf:
f = maxf
freqs.append(f)
h = ["f"]
for c in contact_names:
h.append("V(%s)" % c)
for c in contact_names:
h.append("I(%s)" % c)
for c in contact_names:
cinfo.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c)))
for b in bias_names:
cinfo.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I"))
for f in freqs:
v = ["%1.15g" % f]
v.extend(cinfo)
solve(type="ac", frequency=f)
for b in bias_names:
v.append("%1.15g" % -get_circuit_node_value(solution="ssac_real", node=b+".I"))
v.append("%1.15g" % -get_circuit_node_value(solution="ssac_imag", node=b+".I"))
print("AC: " + " ".join(v))
return ac_callback
h.append("IR(%s)" % c)
h.append("II(%s)" % c)
print("ACHEADER: " + " ".join(h))
def ac_callback():
# solve a few extra times for better ac sensitivity
solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40)
solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40)
solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40)
cinfo = []
for c in contact_names:
cinfo.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c)))
for b in bias_names:
cinfo.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I"))
for f in freqs:
v = ["%1.15g" % f]
v.extend(cinfo)
solve(type="ac", frequency=f)
for b in bias_names:
v.append("%1.15g" % -get_circuit_node_value(solution="ssac_real", node=b+".I"))
v.append("%1.15g" % -get_circuit_node_value(solution="ssac_imag", node=b+".I"))
print("AC: " + " ".join(v))
return ac_callback

def run():
device="bjt"
region="bjt"
load_devices(file="bjt_dd_0.msh")
bjt_params.run(device, region)
netdoping.set_params(device, region)
SetSiliconParameters(device, region)
device="bjt"
region="bjt"
load_devices(file="bjt_dd_0.msh")
bjt_params.run(device, region)
netdoping.set_params(device, region)
SetSiliconParameters(device, region)

for c in ("base", "emitter", "collector"):
#set_parameter(device=device, region=region, name=GetContactBiasName(c), value=0.0)
CreateSiliconDriftDiffusionContact(device, region, c, "Jn", "Jp", True)
# use first initial of each contact name
circuit_element(name="V%s" % c[0], n1=GetContactBiasName(c), n2="0", value=0.0)
for c in ("base", "emitter", "collector"):
#set_parameter(device=device, region=region, name=GetContactBiasName(c), value=0.0)
CreateSiliconDriftDiffusionContact(device, region, c, "Jn", "Jp", True)
# use first initial of each contact name
circuit_element(name="V%s" % c[0], n1=GetContactBiasName(c), n2="0", value=0.0)

solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40)
solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40)
solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40)
solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40)
solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40)
solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40)


2 changes: 1 addition & 1 deletion simdir/bjt_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from devsim import *

def run(device, region):
pass
pass
# set_parameter(device=device, region=region, name="BETAN", value=2.0)
# set_parameter(device=device, region=region, name="BETAP", value=1.0)
# set_parameter(device=device, region=region, name="VSATN0", value=2.4e7)
Expand Down
2 changes: 1 addition & 1 deletion simdir/bjt_refine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import refinement
refinement.run(device, region, outfile="bjt_bgmesh.pos", mincl=2.0e-6, maxcl=1e-4, pdiff=0.025)

# this is is the devsim format
write_devices (file="bjt_refine.tec", type="tecplot")

2 changes: 1 addition & 1 deletion simdir/bjt_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
set_parameter(device=device, region=region, name="p1", value=1e10)

for c in ("base", "emitter", "collector"):
set_parameter(device=device, region=region, name=GetContactBiasName(c), value=0.0)
set_parameter(device=device, region=region, name=GetContactBiasName(c), value=0.0)
solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40)
write_devices (file="bjt_dd_1.msh", type="devsim")

Loading

0 comments on commit a1f9a4f

Please sign in to comment.