summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart <lekaiser@uos.de>2020-09-22 00:03:23 +0200
committerLennart <lekaiser@uos.de>2020-09-22 00:03:23 +0200
commitf8cf50af8564094e145124af08e5e12e13ed352f (patch)
treefffcfbdf98b63c7c7d9e42cf7151d263446bde3d
parentaa0a56a8f1ba32235e1b2664835e35b6641a5715 (diff)
Changed code import and black formattedlennart
-rw-r--r--lib/loader.py3
-rw-r--r--lib/runner.py27
2 files changed, 14 insertions, 16 deletions
diff --git a/lib/loader.py b/lib/loader.py
index b4b2127..ea2b183 100644
--- a/lib/loader.py
+++ b/lib/loader.py
@@ -12,7 +12,6 @@ import tarfile
import hashlib
from multiprocessing import Pool
-from data.processing.DataProcessor import DataProcessor
from .utils import running_mean, soft_cast_int
logger = logging.getLogger(__name__)
@@ -1678,6 +1677,8 @@ class EnergyTraceWithLogicAnalyzer:
for state_or_transition in trace["trace"]:
names.append(state_or_transition["name"])
# print(names[:15])
+ from data.processing.DataProcessor import DataProcessor
+
dp = DataProcessor(sync_data=self.sync_data, energy_data=self.energy_data)
dp.run()
energy_trace_new = list()
diff --git a/lib/runner.py b/lib/runner.py
index 8093a55..4cab9ed 100644
--- a/lib/runner.py
+++ b/lib/runner.py
@@ -180,9 +180,7 @@ class EnergyTraceMonitor(SerialMonitor):
# MSP430FR5969: 3,6V (wird aktuell nicht unterstützt)
# MSP430FR5994: 3,3V (default)
def get_config(self) -> dict:
- return {
- "voltage": self._voltage,
- }
+ return {"voltage": self._voltage}
class EnergyTraceLogicAnalyzerMonitor(EnergyTraceMonitor):
@@ -191,13 +189,16 @@ class EnergyTraceLogicAnalyzerMonitor(EnergyTraceMonitor):
def __init__(self, port: str, baud: int, callback=None, voltage=3.3):
super().__init__(port=port, baud=baud, callback=callback, voltage=voltage)
- #TODO Max length
- options = {'length': 90, 'fake': False, 'sample_rate': 1_000_000}
- self.log_file = 'logic_output_log_%s.json' % (time.strftime("%Y%m%d-%H%M%S"))
+ # TODO Max length
+ options = {"length": 90, "fake": False, "sample_rate": 1_000_000}
+ self.log_file = "logic_output_log_%s.json" % (time.strftime("%Y%m%d-%H%M%S"))
# Initialization of Interfaces
- self.sig = SigrokCLIInterface(sample_rate=options['sample_rate'],
- sample_count=options['length'] * options['sample_rate'], fake=options['fake'])
+ self.sig = SigrokCLIInterface(
+ sample_rate=options["sample_rate"],
+ sample_count=options["length"] * options["sample_rate"],
+ fake=options["fake"],
+ )
# Start Measurements
self.sig.runMeasureAsynchronous()
@@ -205,11 +206,11 @@ class EnergyTraceLogicAnalyzerMonitor(EnergyTraceMonitor):
def close(self):
super().close()
# Read measured data
- #self.sig.waitForAsynchronousMeasure()
+ # self.sig.waitForAsynchronousMeasure()
self.sig.forceStopMeasure()
time.sleep(0.2)
sync_data = self.sig.getData()
- with open(self.log_file, 'w') as fp:
+ with open(self.log_file, "w") as fp:
json.dump(sync_data.getDict(), fp)
def get_files(self) -> list:
@@ -293,11 +294,7 @@ class MIMOSAMonitor(SerialMonitor):
return [self.mim_file]
def get_config(self) -> dict:
- return {
- "offset": self._offset,
- "shunt": self._shunt,
- "voltage": self._voltage,
- }
+ return {"offset": self._offset, "shunt": self._shunt, "voltage": self._voltage}
class ShellMonitor: