From 8d351cd11fd5fd30c0635410e10cd2e92456b72f Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Fri, 20 Oct 2023 00:02:19 +0200
Subject: [PATCH] Adds constant strategy

---
 ohmpi/hardware_system.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py
index 8d4b1cee..18aa01f2 100644
--- a/ohmpi/hardware_system.py
+++ b/ohmpi/hardware_system.py
@@ -413,15 +413,16 @@ class OhmPiHardware:
             # Set gain at min
             self.rx.reset_gain()
             vab_opt = tx_volt
+            vab = np.min([np.abs(tx_volt), vab_max])
             if strategy == 'constant':
-                vab_max = tx_volt
-                tx_volt = tx_volt * .9
+                vab_max = vab
+                tx_volt = vab * .9
                 strategy = 'vmax'
             vab_max = np.abs(vab_max)
             vmn_min = np.abs(vmn_min)
             k = 0
             vab_list = np.zeros(n_steps + 1) * np.nan
-            vab = np.min([np.abs(tx_volt), vab_max])
+
             vab_list[k] = vab
             # self.tx.turn_on()
             switch_pwr_off, switch_tx_pwr_off = False, False  # TODO: check if these should be moved in kwargs
-- 
GitLab