From c73b107b43fc27090bc891d4248acf882093afb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20BRON=C3=88S?= <romain.brones@synchrotron-soleil.fr>
Date: Wed, 7 Aug 2024 14:18:05 +0200
Subject: [PATCH] Fix Operation sync argument

* Use only one list of tuple (BPMID, BPMPATH )
---
 FofbTool/Operation.py | 9 ++++-----
 FofbTool/Utils.py     | 3 +--
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/FofbTool/Operation.py b/FofbTool/Operation.py
index 7ee96f7..11ca749 100644
--- a/FofbTool/Operation.py
+++ b/FofbTool/Operation.py
@@ -556,17 +556,15 @@ def electron_stop_com(bpmlist):
 #    OPERATIONS FOR LBP and Electron SYNCHRONIZATION
 ###################################################################################################
 
-def sync_bpm(bpmlist, bpmidlist, lbpevrx, tlocal, tcentral):
+def sync_bpm(bpmidlist, lbpevrx, tlocal, tcentral):
     """
     Synchronize all BPM electronics, Electron and Brillance Plus.
     This will use the timing system (central and local board).
 
     PARAMETERS:
     -----------
-    bpmlist: list
-        list of Libera Electron tango path
-    bpmidlist: list
-        list of ID to put on Libera Electron
+    bpmidlist: list of tupme
+        list of tuple (ID, tangopath) to put on Libera Electron
     lbpevrx: list
         list of LBP Evrx tanfo path
     tlocal: list
@@ -576,6 +574,7 @@ def sync_bpm(bpmlist, bpmidlist, lbpevrx, tlocal, tcentral):
 
     """
     EVN=240 # Event number
+    bpmlist = [b[1] for b in bpmidlist]
 
     # ---------------------------------------------------------------------------------------------------------------
     # Init BPMs, stop first and put for each the ID number
diff --git a/FofbTool/Utils.py b/FofbTool/Utils.py
index c43e87d..372d2c0 100644
--- a/FofbTool/Utils.py
+++ b/FofbTool/Utils.py
@@ -460,7 +460,6 @@ def sync_all_bpm():
 
     db = tango.Database()
 
-    bpmlist = [n.split(':')[2] for n in db.get_property("FOFB", "bpmlist")['bpmlist'] if ":LIBERA:" in n]
     bpmidlist = [(int(n.split(':')[0]), n.split(':')[2]) for n in db.get_property("FOFB", "bpmlist")['bpmlist'] if 'LIBERA' in n]
 
     tlocal = tango.Group('tlocal')
@@ -472,5 +471,5 @@ def sync_all_bpm():
 
     tcentral = tango.DeviceProxy(config["tangopath"]["timing-central"])
 
-    FofbTool.Operation.sync_bpm(bpmlist, bpmidlist, lbpevrx, tlocal, tcentral)
+    FofbTool.Operation.sync_bpm(bpmidlist, lbpevrx, tlocal, tcentral)
 
-- 
GitLab