summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-11-26 21:17:53 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-11-26 21:17:53 +0100
commit0e295b872b181e9623deb96a07111236272aeaa0 (patch)
tree1eddee22e60ee168533e6e69f188480b3fc8c30e
parent7eb451a6d9b11a0f84356509e1df347091919033 (diff)
only import matplotlib and multiprocessing when needed
-rwxr-xr-xbin/msp430-etv9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/msp430-etv b/bin/msp430-etv
index bd1617e..773d5fe 100755
--- a/bin/msp430-etv
+++ b/bin/msp430-etv
@@ -25,8 +25,6 @@ OPTIONS
import argparse
import itertools
import json
-import matplotlib.pyplot as plt
-from multiprocessing import Pool
import numpy as np
import os
from shutil import which
@@ -94,7 +92,8 @@ class PELT:
return normed_signal
def get_changepoints(self):
- # imported here as ruptures is only used for changepoint detection
+ # imported here as multiprocessing and ruptures are only used for changepoint detection
+ from multiprocessing import Pool
import ruptures
algo = ruptures.Pelt(
@@ -532,6 +531,8 @@ def main():
export_json(args.json_export, extra_data)
if args.plot:
+ import matplotlib.pyplot as plt
+
if args.plot == "U":
# mV
(energyhandle,) = plt.plot(
@@ -624,6 +625,8 @@ def main():
plt.show()
if args.histogram:
+ import matplotlib.pyplot as plt
+
bin_count = args.histogram
plt.title("EnergyTrace Data Analysis")