Merge remote-tracking branch 'origin/master'
diff --git a/rewrite.py b/rewrite.py
index 76da301..ad60f84 100755
--- a/rewrite.py
+++ b/rewrite.py
@@ -1,15 +1,17 @@
 #!/usr/bin/env python3
 
 import csv
+import os
 import pprint
 import re
 import sys
 
+__dir__ = os.path.abspath(os.path.dirname(__file__))
 
 def main(argv):
 
     rewrites = []
-    with open('rewrites.csv', newline='') as f:
+    with open(os.path.join(__dir__, 'rewrites.csv'), newline='') as f:
         c = csv.DictReader(f)
         for r in c:
             rewrites.append((re.compile(('\\b'+r['from']+'\\b').encode('utf-8')), r['to'].encode('utf-8')))
diff --git a/spice_test_suite/cap4termval_test.spice.in b/spice_test_suite/cap4termval_test.spice.in
index c9e8164..31b5421 100644
--- a/spice_test_suite/cap4termval_test.spice.in
+++ b/spice_test_suite/cap4termval_test.spice.in
@@ -1,7 +1,7 @@
 * Capacitor (4 terminal w/separate shield) value test
 .param TEMP=27
 
-* Include SkyWater sky130 device models 
+* Include SkyWater sky130 device models
 INCLUDELINES
 
 .param freq = 1Meg
diff --git a/spice_test_suite/capval_test.spice.in b/spice_test_suite/capval_test.spice.in
index 6926c0b..8203f02 100644
--- a/spice_test_suite/capval_test.spice.in
+++ b/spice_test_suite/capval_test.spice.in
@@ -1,7 +1,7 @@
 * Capacitor value test
 .param TEMP=27
 
-* Include SkyWater sky130 device models 
+* Include SkyWater sky130 device models
 INCLUDELINES
 
 .param freq = 1Meg
diff --git a/spice_test_suite/diode_dev_vth.spice.in b/spice_test_suite/diode_dev_vth.spice.in
index 874b69d..2246ea1 100644
--- a/spice_test_suite/diode_dev_vth.spice.in
+++ b/spice_test_suite/diode_dev_vth.spice.in
@@ -15,7 +15,7 @@
 * Sweep Vdd from 0 to 2.0V
 dc Vdd 0 2.0 0.05
 * NOTE:  Internally accessed names MUST be in lowercase
-wrdata DEVICENAME.data -Vid#branch V(3)
+wrdata DEVICENAME__vth.data -Vid#branch V(3)
 * Find threshold
 let ih=-Vid#branch[38]
 let il=-Vid#branch[28]
diff --git a/spice_test_suite/diode_vth.spice.in b/spice_test_suite/diode_vth.spice.in
index c2433ab..cfb8f79 100644
--- a/spice_test_suite/diode_vth.spice.in
+++ b/spice_test_suite/diode_vth.spice.in
@@ -15,7 +15,7 @@
 * Sweep Vdd from 0 to 2.0V
 dc Vdd 0 2.0 0.05
 * NOTE:  Internally accessed names MUST be in lowercase
-wrdata DEVICENAME.data -Vid#branch V(3)
+wrdata DEVICENAME__vth.data -Vid#branch V(3)
 * Find threshold
 let ih=-Vid#branch[38]
 let il=-Vid#branch[28]
diff --git a/spice_test_suite/inductor_test.spice.in b/spice_test_suite/inductor_test.spice.in
index 54f3770..0b7eb98 100644
--- a/spice_test_suite/inductor_test.spice.in
+++ b/spice_test_suite/inductor_test.spice.in
@@ -1,7 +1,7 @@
 * Inductor value test
 .param TEMP=27
 
-* Include SkyWater sky130 device models 
+* Include SkyWater sky130 device models
 INCLUDELINES
 
 .param lofreq = 1Meg
diff --git a/spice_test_suite/mimcap_test.spice.in b/spice_test_suite/mimcap_test.spice.in
index fa81365..0e36360 100644
--- a/spice_test_suite/mimcap_test.spice.in
+++ b/spice_test_suite/mimcap_test.spice.in
@@ -1,7 +1,7 @@
 * MiM capacitor value test
 .param TEMP=27
 
-* Include SkyWater sky130 device models 
+* Include SkyWater sky130 device models
 INCLUDELINES
 
 .param freq = 1Meg
diff --git a/spice_test_suite/nfet5term_vth.spice.in b/spice_test_suite/nfet5term_vth.spice.in
index c0e999f..2bb437d 100644
--- a/spice_test_suite/nfet5term_vth.spice.in
+++ b/spice_test_suite/nfet5term_vth.spice.in
@@ -17,7 +17,7 @@
 .control
 * Sweep Vds from 0 to 1.8V
 dc Vdd 0 1.8 0.01 Vgb 0 1.2 0.01
-wrdata DEVICENAME.data Vid#branch V(1) V(3)
+wrdata DEVICENAME__vth.data Vid#branch V(1) V(3)
 
 * Sweep Vgs from 0 to 1.2V
 dc Vgb 0 1.2 0.01
diff --git a/spice_test_suite/nfet_vth.spice.in b/spice_test_suite/nfet_vth.spice.in
index a604b41..aa6e8fb 100644
--- a/spice_test_suite/nfet_vth.spice.in
+++ b/spice_test_suite/nfet_vth.spice.in
@@ -18,7 +18,7 @@
 .control
 * Sweep Vds from 0 to 1.8V
 dc Vdd 0 1.8 0.01 Vgb 0 1.2 0.01
-wrdata DEVICENAME.data Vid#branch V(1) V(3)
+wrdata DEVICENAME__vth.data Vid#branch V(1) V(3)
 
 * Sweep Vgs from 0 to 1.2V
 dc Vgb 0 1.2 0.01
diff --git a/spice_test_suite/npn_beta.spice.in b/spice_test_suite/npn.spice.in
similarity index 83%
rename from spice_test_suite/npn_beta.spice.in
rename to spice_test_suite/npn.spice.in
index 04be979..08621c1 100644
--- a/spice_test_suite/npn_beta.spice.in
+++ b/spice_test_suite/npn.spice.in
@@ -17,12 +17,12 @@
 .control
 * Sweep Vce from 0 to 1.8V
 dc Vce 0 1.8 0.01 vbb 0 1.2 0.01
-wrdata DEVICENAME.data -Vic#branch V(1) V(3)
+wrdata DEVICENAME__vth.data -Vic#branch V(1) V(3)
 
 * Sweep Vce from 0 to 3.3V, Vbb from 0 to 2.0V
 dc Vce 0 3.3 0.02 Vbb 0.6 0.9 0.01
 let beta = Vic#branch / Vbb#branch
-wrdata DEVICENAME_beta.data beta V(2) V(3)
+wrdata DEVICENAME__beta.data beta V(2) V(3)
 echo maximum beta
 print maximum(beta)
 quit
diff --git a/spice_test_suite/pfet_vth.spice.in b/spice_test_suite/pfet_vth.spice.in
index a5868ca..854981d 100644
--- a/spice_test_suite/pfet_vth.spice.in
+++ b/spice_test_suite/pfet_vth.spice.in
@@ -19,7 +19,7 @@
 dc Vdd 0 1.8 0.01 Vgb 0 1.2 0.01
 let vgs = V(5) - V(1)
 let vds = V(5) - V(3)
-wrdata DEVICENAME.data Vid#branch vgs vds
+wrdata DEVICENAME__vth.data Vid#branch vgs vds
 
 * Sweep Vgs from 0 to 1.2V
 dc Vgb 0 1.2 0.01
diff --git a/spice_test_suite/plot_bipolar_beta.py b/spice_test_suite/plot_bipolar_beta.py
index 9277076..b18bb74 100755
--- a/spice_test_suite/plot_bipolar_beta.py
+++ b/spice_test_suite/plot_bipolar_beta.py
@@ -1,15 +1,16 @@
 #!/usr/bin/env python3
 #
-# Plot Bipolar I/V curve from devicename + '.data' from running ngspice
+# 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:
+    with open(devicepath + '/' + devicename + '__beta.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -51,12 +52,11 @@
     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)
-
diff --git a/spice_test_suite/plot_bipolar_iv.py b/spice_test_suite/plot_bipolar_iv.py
index ac254ef..0e52067 100755
--- a/spice_test_suite/plot_bipolar_iv.py
+++ b/spice_test_suite/plot_bipolar_iv.py
@@ -1,15 +1,16 @@
 #!/usr/bin/env python3
 #
-# Plot Bipolar I/V curve from devicename + '.data' from running ngspice
+# Plot Bipolar I/V curve from devicename + '__vth.data' from running ngspice
 # on 'bipolar_test.spice'
 
 import os
 import sys
 import matplotlib.pyplot as plt
 
+
 def make_bipolar_iv_plot(devicepath, devicename, version, corner):
 
-    with open(devicepath + '/' + devicename + '.data', 'r') as ifile:
+    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -51,12 +52,11 @@
     plt.grid('on')
     plt.savefig(devicepath + '/' + devicename + '_ice_v_vbe.svg')
 
+
 if __name__ == '__main__':
-  
     if len(sys.argv) < 2:
         print("No device name given to plot_bipolar_iv")
         sys.exit(1)
 
     devicename = sys.argv[1]
     make_bipolar_iv_plot(os.getcwd(), devicename, version, corner)
-
diff --git a/spice_test_suite/plot_diode_iv.py b/spice_test_suite/plot_diode_iv.py
index 3eeabd6..a874bcd 100755
--- a/spice_test_suite/plot_diode_iv.py
+++ b/spice_test_suite/plot_diode_iv.py
@@ -1,15 +1,16 @@
 #!/usr/bin/env python3
 #
-# Plot MOSFET I/V curve from devicename + '.data' from running ngspice
+# Plot MOSFET I/V curve from devicename + '__vth.data' from running ngspice
 # on 'diode_iv.spice'
 
 import os
 import sys
 import matplotlib.pyplot as plt
 
+
 def make_diode_iv_plot(devicepath, devicename, version, corner):
 
-    with open(devicepath + '/' + devicename + '.data', 'r') as ifile:
+    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -34,8 +35,8 @@
     plt.grid('on')
     plt.savefig(devicepath + '/' + devicename + '_id_v_vd.svg')
 
+
 if __name__ == '__main__':
-    
     if len(sys.argv) < 2:
         print("No device name given to plot_diode_iv")
         sys.exit(1)
diff --git a/spice_test_suite/plot_mosfet_iv.py b/spice_test_suite/plot_mosfet_iv.py
index 6398c99..c59a1e7 100755
--- a/spice_test_suite/plot_mosfet_iv.py
+++ b/spice_test_suite/plot_mosfet_iv.py
@@ -1,15 +1,16 @@
 #!/usr/bin/env python3
 #
-# Plot MOSFET I/V curve from devicename + '.data' from running ngspice
+# Plot MOSFET I/V curve from devicename + '__vth.data' from running ngspice
 # on 'mosfet_test.spice'
 
 import os
 import sys
 import matplotlib.pyplot as plt
 
+
 def make_mosfet_iv_plot(devicepath, devicename, version, corner):
 
-    with open(devicepath + '/' + devicename + '.data', 'r') as ifile:
+    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -51,12 +52,11 @@
     plt.grid('on')
     plt.savefig(devicepath + '/' + devicename + '_ids_v_vgs.svg')
 
+
 if __name__ == '__main__':
-  
     if len(sys.argv) < 2:
         print("No device name given to plot_mosfet_iv")
         sys.exit(1)
 
     devicename = sys.argv[1]
     make_mosfet_iv_plot(os.getcwd(), devicename, version, corner)
-
diff --git a/spice_test_suite/plot_mosfet_vth.py b/spice_test_suite/plot_mosfet_vth.py
index 912d8b6..5994d3c 100755
--- a/spice_test_suite/plot_mosfet_vth.py
+++ b/spice_test_suite/plot_mosfet_vth.py
@@ -1,15 +1,16 @@
 #!/usr/bin/env python3
 #
-# Plot MOSFET I/V curve from devicename + '.data' from running ngspice
+# Plot MOSFET I/V curve from devicename + '__vth.data' from running ngspice
 # on 'mosfet_test.spice'
 
 import os
 import sys
 import matplotlib.pyplot as plt
 
+
 def make_mosfet_vth_plot(devicepath, devicename, version, corner):
 
-    with open(devicepath + '/' + devicename + '_vth.data', 'r') as ifile:
+    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -51,12 +52,11 @@
     plt.grid('on')
     plt.savefig(devicepath + '/' + devicename + '_vth_v_vgs.svg')
 
+
 if __name__ == '__main__':
-  
     if len(sys.argv) < 2:
         print("No device name given to plot_mosfet_vth")
         sys.exit(1)
 
     devicename = sys.argv[1]
     make_mosfet_vth_plot(os.getcwd(), devicename, version, corner)
-
diff --git a/spice_test_suite/pnp_beta.spice.in b/spice_test_suite/pnp.spice.in
similarity index 86%
rename from spice_test_suite/pnp_beta.spice.in
rename to spice_test_suite/pnp.spice.in
index fbcd0d5..c217c5e 100644
--- a/spice_test_suite/pnp_beta.spice.in
+++ b/spice_test_suite/pnp.spice.in
@@ -19,14 +19,14 @@
 dc Vce 0 1.8 0.01 Vbb 0 1.2 0.01
 let vc1 = V(5) - V(3)
 let vb1 = V(5) - V(2)
-wrdata DEVICENAME.data -Vic#branch vb1 vc1
+wrdata DEVICENAME__vth.data -Vic#branch vb1 vc1
 
 * Sweep Vce from 0 to 3.3V, Vbb from 0 to 2.0V
 dc Vce 0 3.3 0.02 Vbb 0.6 0.9 0.01
 let beta = Vic#branch / Vbb#branch
 let vc2 = V(5) - V(3)
 let vb2 = V(5) - V(2)
-wrdata DEVICENAME_beta.data beta vb2 vc2
+wrdata DEVICENAME__beta.data beta vb2 vc2
 echo maximum beta
 print maximum(beta)
 quit
diff --git a/spice_test_suite/run_spice_tests_new.py b/spice_test_suite/run_spice_tests_new.py
index a92ec42..1db9254 100755
--- a/spice_test_suite/run_spice_tests_new.py
+++ b/spice_test_suite/run_spice_tests_new.py
@@ -543,7 +543,7 @@
             make_mosfet_iv_plot(devicedir + '/tests', devicename, version, corner)
 
     elif devicetype == 'npn' or devicetype == 'pnp':
-        spicefile = genspice(devicedir, devicetype + '_beta.spice', devicename, includes, corner)
+        spicefile = genspice(devicedir, devicetype + '.spice', devicename, includes, corner)
         (result, reason) = runspice(spicefile, 'maximum beta', devicename, expectedval)
         reasons[devicename] = reason
         if baseline_run and isinstance(result, str):