From 3ccb7a911a6dd91c94a1e6769c24c93200ecb915 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Fri, 16 Jun 2023 18:42:01 +0200
Subject: [PATCH] Adds plot_exec_log in test

---
 ohmpi/hardware_system.py | 4 ++--
 ohmpi/plots.py           | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py
index 72cb364a..2383feff 100644
--- a/ohmpi/hardware_system.py
+++ b/ohmpi/hardware_system.py
@@ -133,11 +133,11 @@ class OhmPiHardware:
         self._pulse = 0
 
     def _gain_auto(self):  # TODO: improve _gain_auto
-        self.exec_logger.event(f'OhmPiHardware\tGAin_Auto\tbegin\t{datetime.datetime.utcnow()}')
+        self.exec_logger.event(f'OhmPiHardware\tGain_Auto\tbegin\t{datetime.datetime.utcnow()}')
         self.tx_sync.wait()
         self.tx.adc_gain_auto()
         self.rx.adc_gain_auto()
-        self.exec_logger.event(f'OhmPiHardware\tGAin_Auto\tend\t{datetime.datetime.utcnow()}')
+        self.exec_logger.event(f'OhmPiHardware\tGain_Auto\tend\t{datetime.datetime.utcnow()}')
 
     def _inject(self, polarity=1, inj_time=None):  # TODO: deal with voltage or current pulse
         self.exec_logger.event(f'OhmPiHardware\tInject\tbegin\t{datetime.datetime.utcnow()}')
diff --git a/ohmpi/plots.py b/ohmpi/plots.py
index aab5d0e5..0e45d3ca 100644
--- a/ohmpi/plots.py
+++ b/ohmpi/plots.py
@@ -7,7 +7,8 @@ import matplotlib
 def plot_exec_log(exec_log,names=None,last_session=True):  # TODO: select session id instead of last session (if -1 : last)
     time, process_id, tag, msg, session = parse_log(exec_log)
     if last_session:
-        time, process_id, tag, msg = time[session==max(session)], process_id[session==max(session)], tag[session==max(session)], msg[session==max(session)]
+        time, process_id, tag, msg = time[session == max(session)], process_id[session == max(session)], \
+            tag[session == max(session)], msg[session == max(session)]
     events = msg[tag == 'EVENT']
     category, name, state, time = np.empty(events.shape[0]).astype(str), np.empty(events.shape[0]).astype(str), \
         np.empty(events.shape[0]).astype(str), np.empty(events.shape[0]).astype(str)
-- 
GitLab