aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-08-02 22:28:17 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2017-08-02 22:28:17 +0200
commit2384a4e12cb029cbd6c8595fa9f3c5a666a391da (patch)
treef85afbc25f437c578c9fc7e49409b615794c930c /src/ee/tools
parentfb3fe7200c129bb23777ebb2a09bf86f7644bffd (diff)
downloadee-python-2384a4e12cb029cbd6c8595fa9f3c5a666a391da.tar.gz
ee-python-2384a4e12cb029cbd6c8595fa9f3c5a666a391da.tar.bz2
ee-python-2384a4e12cb029cbd6c8595fa9f3c5a666a391da.tar.xz
ee-python-2384a4e12cb029cbd6c8595fa9f3c5a666a391da.zip
o Importing formatting tools.
Diffstat (limited to 'src/ee/tools')
-rw-r--r--src/ee/tools/__init__.py0
-rw-r--r--src/ee/tools/read_ltspice_raw.py31
2 files changed, 31 insertions, 0 deletions
diff --git a/src/ee/tools/__init__.py b/src/ee/tools/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/ee/tools/__init__.py
diff --git a/src/ee/tools/read_ltspice_raw.py b/src/ee/tools/read_ltspice_raw.py
new file mode 100644
index 0000000..279fe73
--- /dev/null
+++ b/src/ee/tools/read_ltspice_raw.py
@@ -0,0 +1,31 @@
+import ee
+import sys
+
+raw = ee.read_ltspice_raw(sys.argv[1])
+
+#print("Variables:")
+#for i, v in enumerate(raw.variables):
+# print("{:2}: kind: {:20} expression: {}".format(i, v.kind, v.expression))
+
+#for i, v in enumerate(raw.variables):
+# print("{:2}: kind: {:20} expression: {}".format(i, v.kind, v.expression))
+# for p in raw.values[i]:
+# print(" {}".format(p))
+
+x = raw.get_variable(idx = 0)
+y = raw.get_variable(expression = 'V(load)')
+xs = raw.get_values(y)
+
+import matplotlib
+matplotlib.use('Agg')
+
+import matplotlib.pyplot as plt
+from matplotlib.ticker import FuncFormatter, MaxNLocator
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.plot(xs)
+ax.set_xlabel(x.expression)
+ax.set_ylabel(y.expression)
+
+with open("ltspice.png", "wb") as f:
+ plt.savefig(f, format="png")