blob: b18bb745befca483f4a49a240110c96771f9e1bf [file] [log] [blame]
#!/usr/bin/env python3
#
# Plot Bipolar ?beta? I/V curve from devicename + '__beta.data' from running ngspice
# on 'bipolar_test.spice'
import os
import sys
import matplotlib.pyplot as plt
def make_bipolar_beta_plot(devicepath, devicename, version, corner):
with open(devicepath + '/' + devicename + '__beta.data', 'r') as ifile:
idata = ifile.read().split()
# Reformat data
nrows = int(len(idata) / 6)
allBeta = list(float(idata[p + 1]) for p in range(0, len(idata), 6))
allVbe = list(float(idata[p + 3]) for p in range(0, len(idata), 6))
allVce = list(float(idata[p + 5]) for p in range(0, len(idata), 6))
# Generate X/Y plots
plt.figure()
for i in range(0, len(allBeta), 166 * 10):
Beta = allBeta[i : i + 166]
Vbe = allVbe[i : i + 166]
Vce = allVce[i : i + 166]
plt.plot(Vce, Beta)
title = 'SkyWater sky130 PDK ' + version + ' ' + devicename + ' Beta vs. Vce at corner ' + corner
plt.title(title)
plt.xlabel('Vce (V)')
plt.ylabel('Beta')
plt.axis('on')
plt.grid('on')
plt.savefig(devicepath + '/' + devicename + '_beta_v_vce.svg')
plt.figure()
for i in range(0, 166, 18):
Beta = allBeta[i : len(allBeta): 166]
Vbe = allVbe[i : len(allVbe): 166]
Vce = allVce[i : len(allVce): 166]
plt.plot(Vbe, Beta)
title = 'SkyWater sky130 PDK ' + version + ' ' + devicename + ' Beta vs. Vbe at corner ' + corner
plt.title(title)
plt.xlabel('Vbe (V)')
plt.ylabel('Beta')
plt.axis('on')
plt.grid('on')
plt.savefig(devicepath + '/' + devicename + '_beta_v_vbe.svg')
if __name__ == '__main__':
if len(sys.argv) < 2:
print("No device name given to plot_bipolar_beta")
sys.exit(1)
devicename = sys.argv[1]
make_bipolar_beta_plot(os.getcwd(), devicename, version, corner)