Index: /BPM/initialise_motors.py
===================================================================
--- /BPM/initialise_motors.py	(revision 789)
+++ /BPM/initialise_motors.py	(revision 790)
@@ -8,5 +8,5 @@
 from read_adc import *
 import numpy as np
-import matplotlib.pyplot as plt
+#import matplotlib.pyplot as plt
 from datetime import datetime
 
@@ -16,5 +16,5 @@
 write_to_motor_dated_log = data_dir + './write_to_motor_log'
 
-#from writeclient import *
+from writeclient import *
 import time
 
@@ -263,11 +263,14 @@
     motor_disable(1)
 
-def path(bpm_name): # create the path of the file what will contain data
+def path(bpm_name, list_of_data): # create the path of the file what will contain data
     idata = 0
     start_time_str=datetime.now().strftime("%Y%m%d")
     data_name_and_path = data_dir+"data/"
+    string_of_data = ""
+    for data_name in list_of_data:
+        string_of_data += data_name + "_"
     if not os.path.exists(data_name_and_path) :
 	os.makedirs(data_name_and_path)
-    data_name_and_path = data_name_and_path+"BPM-number_x-motor-step_x-motor-mm_y-motor-step_y-motor_mm_Va_Vb_Vc_Vd_Sum_X_Y_"+bpm_name+"_"+start_time_str+"_"
+    data_name_and_path = data_name_and_path+string_of_data+bpm_name+"_"+start_time_str+"_"
     while os.path.exists(data_name_and_path+str(idata)+".txt") :
         idata+=1
@@ -290,5 +293,5 @@
                            bpm_name1 = "BPM_E",bpm_name2 = "BPM_impr",bpm_name3 = "BPM_C",bpm_name4 = None): #name of the BPM used (as default, it the configuration of the BPM when this code was writen 
 
-    data_name_and_path = path(title_bpm_name) #create the name of the datafile
+    data_name_and_path = path(title_bpm_name, list_of_data) #create the name of the datafile
     write_first_line(data_name_and_path, list_of_data) # write first line of the datafile with the name of the data
     bpm_list = initialise_bpm(bpm_name1,bpm_name2,bpm_name3,bpm_name4) # initialise BPM (program on read_adc.py)
@@ -312,5 +315,5 @@
                            bpm_name1 = "BPM_E",bpm_name2 = "BPM_impr",bpm_name3 = "BPM_C",bpm_name4 = None): #name of the BPM used (as default, it the configuration of the BPM when this code was writen
     
-    data_name_and_path = path(title_bpm_name) #create the name of the datafile
+    data_name_and_path = path(title_bpm_name, list_of_data) #create the name of the datafile
     write_first_line(data_name_and_path, list_of_data)  # write first line of the datafile with the name of the data
     bpm_list = initialise_bpm(bpm_name1,bpm_name2,bpm_name3,bpm_name4) # initialise BPM (program on read_adc.py)
@@ -334,5 +337,5 @@
                    bpm_name1 = "BPM_E",bpm_name2 = "BPM_impr",bpm_name3 = "BPM_C",bpm_name4 = None):#name of the BPM used (as default, it the configuration of the BPM when this code was writen
     
-    data_name_and_path = path(title_bpm_name)#create the name of the datafile
+    data_name_and_path = path(title_bpm_name, list_of_data)#create the name of the datafile
     write_first_line(data_name_and_path, list_of_data)# write first line of the datafile with the name of the data
     bpm_list = initialise_bpm(bpm_name1,bpm_name2,bpm_name3,bpm_name4)# initialise BPM (program on read_adc.py)
@@ -340,5 +343,5 @@
     motor_enable(2)
     for y_position in np.linspace(begin2, end2, number_of_point2):            
- 	 motor_move_absolute(2,2000,y_position)
+        motor_move_absolute(2,2000,y_position)
         print('moteur going to', y_position)
         for x_position in np.linspace(begin1,end1,number_of_point1):
@@ -349,5 +352,5 @@
             time.sleep(1)
  	    acquisition_libera(x_position, y_position, data_name_and_path, statistic_number, list_of_data, bpm_list) # read_the data (program on read_adc.py)
-        begin1,end1 = end1,begin1 #to 
+        begin1,end1 = end1,begin1 #to go and back
     motor_disable(1)
     motor_disable(2)
Index: /BPM/motor_control.py
===================================================================
--- /BPM/motor_control.py	(revision 789)
+++ /BPM/motor_control.py	(revision 790)
@@ -1,7 +1,6 @@
 #import time
-#import urllib
 #import os
 from initialise_motors import *
-from scope_function import *
+#from scope_function import *
 #import numpy as np
 #import matplotlib.pyplot as plt
@@ -13,87 +12,24 @@
 #motor_reset(2)
 #motor_disable(2)
-
+"""
 motor_enable(1)
 move_motor_absolute(1,5000,-5000)
-#while motor_get(1, 'status') != 'READY':
-#    time.sleep(1)
 move_motor_absolute(1,5000,0)
-#while motor_get(1, 'status') != 'READY':
-#    time.sleep(1)
 motor_disable(1)
-
-"""
-for i in range(5):
-    motor_enable(2)
-    move_motor_absolute(2,5000,-5000)
-    while motor_get(2, 'status') != 'READY':
-        time.sleep(1)
-    time.sleep(10)
-
-
-    move_motor_absolute(2,5000,0)
-    while motor_get(2, 'status') != 'READY':
-        time.sleep(1)
-    motor_disable(2)
-    time.sleep(10)
 """
 
-#controller_hello()
-#move_motor_relative(1,1000,-1000)
-#time.sleep(1)
-#move_motor_relative(1,1000,1000)
-#urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/test2.png')
-#if not os.path.exists(repertoire):
-#os.makedirs('./test')    cree repertoir 
+#acquisition_2D(-200000,200000,400, -240000, -260000, 3, 'BPM0-E_BPM1-impr_BPM2-C_100pts-horizontal_3pts-vertical', statistic_number = 100)
+#acquisition_2D(-15000,15000,3, 0, -500000, 400, 'BPM0-E_BPM1-impr_BPM2-C_3pts-horizontal_100pts-vertical', statistic_number = 100)
 
-#position_test_horizontal()
-
-
-#                                 creation graphique
-
-#horizontal_acquisition(4000,0,-4000,"test")    
-
-#acquisition(-100000,100000,20000,-50000,50000,10000,"test")
-
-#acquisition(-10000,10000,1000,-50000,0,5000,"test")
-
-#turn_on()
-
-#vertical_acquisition(-110000,90000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
-
-#vertical_acquisition(90000,-110000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
-
-#vertical_acquisition(0,-4000,2000,"test")
-#vertical_acquisition(4000,0,2000,"test2")
-
-#horizontal_acquisition(400000,0,-4000,"ch1-3_bpm_ref_ch2-4_bpm_impr")    
-
-#turn_off()
-
-#fichier = open("24-05-2018_acquisition_from_0_to_400000_step_of_1000.txt", "r")
-
-#fichier.close()
+for i in range(5):
+    acquisition_2D(0,0,1, -380000, -320000, 10, 'test_decrochage_BPM0-E_BPM1-impr_BPM2-C',statistic_number = 10)
+    acquisition_2D(0,0,1, -320000, -380000, 10, 'test_decrochage_BPM0-E_BPM1-impr_BPM2-C',statistic_number = 10)
 
 
 
-"""
-for i in range(3):
-	move_motor_absolute(1,5000,i*10000)
-	while motor_get(1, 'status') != 'READY':
-		time.sleep(1)
-	time.sleep(1)
-	urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/position_'+str(i*10000)+'.png')
-	time.sleep(1)
 
+#motor_enable(1)
 
-move_motor_absolute(1,5000,0)
-while motor_get(1, 'status') != 'READY':
-	time.sleep(1)
-time.sleep(1)
-motor_disable(1)
-
-
-"""
 #motor_enable(2)
 
-#motor_disable(2) #commande dangeureuse 
+#motor_disable(2) 
Index: /BPM/print_datas.py
===================================================================
--- /BPM/print_datas.py	(revision 789)
+++ /BPM/print_datas.py	(revision 790)
@@ -188,4 +188,6 @@
 
 def linear_fonction_on_data(list_data_name, data, data_name, begin_mm = None, end_mm = None): # convert the data name data_name (use to length convertion) 
+    if begin_mm is None and end_mm is None:
+        return(data)
     number_data_name = number_of_data_name(list_data_name, data_name)
     begin_step,end_step = min_max(list_data_name, data, data_name)
@@ -216,5 +218,5 @@
         return("Coordonnee y d'apres le moteur (en en million pas)")
     elif data_name == "y_motor_mm" :
-        return("Coordonnee y d'apres le moteur (en mm)")
+        return("Coordonnee y d'apres la regle optique (en mm)")
     elif data_name == "Va" :
         return("Tension sur l'electrode a (en mV)")
@@ -304,5 +306,5 @@
         return("y coordinate acording to motor (in step)")
     elif data_name == "y_motor_mm" :
-        return("y coordinate acording to motor (in mm)")
+        return("y coordinate acording the optical rule (in mm)")
     elif data_name == "Va" :
         return("Tension on electrode a (in mV)")
@@ -316,11 +318,11 @@
         return("Sum of tensions on electrodes (in mV)")
     elif data_name == "x_libera_mm" :
-        return("x coordinate acording d'apres le Libera (in mm)")
+        return("x coordinate acording to Libera (in mm)")
     elif data_name == "y_libera_mm" :
-        return("Coordonnee x d'apres le Libera (en mm)")
+        return("y coordonnee acording to Libera (in mm)")
     elif data_name == "x_libera_um" :
-        return("x coordinate acording d'apres le Libera (in um)")
+        return("x coordinate acording to Libera (in um)")
     elif data_name == "y_libera_um" :
-        return("Coordonnee x d'apres le Libera (en um)")
+        return("x coordonnee acording to Libera (in um)")
     else:
         print("unknow ask data_name named " + data_name)
@@ -455,7 +457,7 @@
     plt.ylabel(y_label, fontsize=20)
     if title is None:
-        plt.title("Residu de " + y_label + " en fonction de " + x_label, fontsize=20)
-    else:
-        plt.title("Residu de " + y_label + " en fonction de " + x_label + "\n" +title, fontsize=20)
+        plt.title("Residu de " + y_label + "\nen fonction de " + x_label, fontsize=20)
+    else:
+        plt.title("Residu de " + y_label + "\nen fonction de " + x_label + "\n" +title, fontsize=20)
     plt.gca().xaxis.set_tick_params(labelsize = 15)
     plt.gca().yaxis.set_tick_params(labelsize = 15)
@@ -486,11 +488,16 @@
 """
 
-def oposit_name(list_data_name, data_name):
+def oposit_name(list_data_name, data_name, data_name2 = None):
     if data_name[0] == "x":
         if "y_motor_step" in list_data_name:
             return("y_motor_step")
-    if data_name[0] == "y":
+    elif data_name[0] == "y":
         if "x_motor_step" in list_data_name:
             return("x_motor_step")
+    elif data_name[0] == "V":
+        if data_name2[0] == "x":
+            return("y_motor_step")
+        elif data_name2[0] == "y":
+            return("x_motor_step")
     else:
         print("ERROR MULTIPLE LINE")
@@ -499,6 +506,14 @@
 
 
-def graph_fr(fichier, x_data_name, y_data_name, lin_reg = None, residu = None, rms = None, x_begin_mm = None, x_end_mm = None, y_begin_mm = None, y_end_mm = None, x_minimal = None, x_maximal = None, y_minimal = None,  y_maximal = None, centrage = None):
+def graph_fr(fichier, x_data_name, y_data_name, lin_reg = None, residu = None, rms = None, x_begin_mm = None, x_end_mm = None, y_begin_mm = None, y_end_mm = None, x_minimal = None, x_maximal = None, y_minimal = None,  y_maximal = None, centrage = None, one_bpm = None):
     (list_data_name,data) = read_data(fichier)
+    if not(x_data_name in list_data_name):
+        print("This x_data_name doesn't exist, choise within : ")
+        print(list_data_name)
+        return(0)
+    if not(y_data_name in list_data_name):
+        print("This y_data_name doesn't exist, choise within : ")
+        print(list_data_name)
+        return(0)
     data = convert_data(list_data_name, data)
     global global_index_figure # to creat different figure
@@ -515,7 +530,14 @@
     if "bpm_name" in list_data_name:
         all_bpm_name = all_value_of_data(list_data_name, data, "bpm_name")
+        if not(one_bpm is None):
+            if one_bpm in all_bpm_name:
+                all_bpm_name = [one_bpm]
+            else:
+                print("This BPM doesn't exist, choise within : ")
+                print(all_bpm_name)
+                return(0)    
         while len(all_bpm_name) > len(color_list):
             color_list += color_list
-        oposit_y_data_name = oposit_name(list_data_name, y_data_name)
+        oposit_y_data_name = oposit_name(list_data_name, y_data_name, x_data_name)
         oposit_y_data_number = number_of_data_name(list_data_name, oposit_y_data_name)
         if oposit_y_data_number == "":
@@ -542,10 +564,12 @@
 #graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_100pts-horizontal_3pts-vertical_20180801_0.txt", "x_motor_step", "x_libera_mm",lin_reg = "true", residu = "yes", rms = "yes")
 
-graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_100pts-horizontal_3pts-vertical_20180801_1.txt", "x_motor_step", "x_libera_mm",lin_reg = "true", residu = "yes", rms = "yes")#, x_begin_mm =103.78 , x_end_mm = 72.5)
-
-graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_100pts-horizontal_3pts-vertical_20180801_1.txt", "x_motor_mm", "x_libera_mm",lin_reg = "true", residu = "yes", rms = "yes", centrage = "yes")#, x_begin_mm =103.78 , x_end_mm = 72.5, x_minimal = 77., x_maximal = 99, centrage = "yes")#, x_minimal = 77, x_maximal = 99
-
-#graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_3pts-horizontal_100pts-vertical_20180802_0.txt", "x_motor_mm", "x_libera_mm",lin_reg = "true", residu = "yes", rms = "yes")
-
+#graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_100pts-horizontal_3pts-vertical_20180801_1.txt", "x_motor_mm", "x_libera_mm",lin_reg = "true", residu = "yes", rms = "yes", x_begin_mm =103.78 , x_end_mm = 72.5)
+
+#graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_100pts-horizontal_3pts-vertical_20180801_1.txt", "x_motor_mm", "x_libera_mm",lin_reg = "true", residu = "yes", rms = "yes", centrage = "yes", x_begin_mm =103.78, x_end_mm = 72.5 , x_minimal = 86., x_maximal = 96.)#, centrage = "yes")#, x_minimal = 77, x_maximal = 99
+
+#graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_3pts-horizontal_100pts-vertical_20180802_0.txt", "y_motor_mm", "y_libera_mm",lin_reg = "true", residu = "yes", rms = "yes", centrage = "yes")
+graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_3pts-horizontal_100pts-vertical_20180802_0.txt", "y_motor_step", "y_libera_mm",lin_reg = "true", residu = "yes", rms = "yes")#, centrage = "yes", y_minimal = -20., y_maximal = -10.)
+
+#graph_fr("data/bpm_name_bpm_number_x_motor_step_x_motor_mm_y_motor_step_y_motor_mm_Va_Vb_Vc_Vd_Sum_x_libera_mm_y_libera_mm_BPM0-E_BPM1-impr_BPM2-C_3pts-horizontal_100pts-vertical_20180802_0.txt", "y_motor_mm", "Va", residu = "yes", centrage = "yes", one_bpm = "BPM_E")#, rms = "yes")
 
 
Index: /BPM/read_adc.py
===================================================================
--- /BPM/read_adc.py	(revision 789)
+++ /BPM/read_adc.py	(revision 790)
@@ -1,4 +1,5 @@
 import PyTango
 import os
+import time
 from bpm_constants import *
 from datetime import datetime
@@ -10,29 +11,47 @@
 ##PyTango.Database().get_device_exported('/opt/libera/sbin/libera-ds libera-instrument1')
 
+
+
 PyTango.ApiUtil.get_env_var("TANGO_HOST")
 
 def initialise_bpm(bpm_name1, bpm_name2, bpm_name3, bpm_name4):
     bpm_list = []
-    if not(bpm_name1 is None):
-        bpm_list.append([bpm_name1,DeviceProxy("Maquette/diag/bpm1")])
-    if not(bpm_name2 is None):
-        bpm_list.append([bpm_name2,DeviceProxy("Maquette/diag/bpm2")])
-    if not(bpm_name3 is None):
-        bpm_list.append([bpm_name3,DeviceProxy("Maquette/diag/bpm3")])
-    if not(bpm_name4 is None):
-        bpm_list.append([bpm_name4,DeviceProxy("Maquette/diag/bpm4")])
-    for bpm in bpm_list:
-        bpm[1].SpEnable = True
-        bpm[1].Kx = 14136
-        bpm[1].Ky = 14136
-        bpm[1].SpThreshold = 200
-        bpm[1].SpNBefor = 1
-        bpm[1].SpNAfter = 25
+    successive_error = 0
+    while bpm_list == []:
+        try:
+            #print(successive_error)
+            successive_error += 1
+            #print("\n")      
+            if not(bpm_name1 is None):
+                bpm_list.append([bpm_name1,DeviceProxy("Maquette/diag/bpm1")])
+            if not(bpm_name2 is None):
+                bpm_list.append([bpm_name2,DeviceProxy("Maquette/diag/bpm2")])
+            if not(bpm_name3 is None):
+                bpm_list.append([bpm_name3,DeviceProxy("Maquette/diag/bpm3")])
+            if not(bpm_name4 is None):
+                bpm_list.append([bpm_name4,DeviceProxy("Maquette/diag/bpm4")])
+            for bpm in bpm_list:
+                bpm[1].Fans = 6000
+                bpm[1].AdcLength = 50 
+                bpm[1].SpEnable = True
+                bpm[1].Kx = 14136
+                bpm[1].Ky = 14136
+                bpm[1].SpThreshold = 200
+                bpm[1].SpNBefor = 1
+                bpm[1].SpNAfter = 20
+        except:
+            print("error of initialise bpm")
+            bpm_list = []
+            if successive_error > 4:
+                raise
     return(bpm_list)
 
         
-#bpm_list = [DeviceProxy("Maquette/diag/bpm1"), DeviceProxy("Maquette/diag/bpm2"), DeviceProxy("Maquette/diag/bpm3")] # global list that containe data for each used BPM
+bpm_list = [DeviceProxy("Maquette/diag/bpm1"), DeviceProxy("Maquette/diag/bpm2"), DeviceProxy("Maquette/diag/bpm3")] # global list that containe data for each used BPM
 #, DeviceProxy("Maquette/diag/bpm4")]
-#bpm_list[1].Fans = 5000
+#bpm_list[0].Fans = 2500
+#print(bpm_list[0].get_attribute_list())  # give all the attribute of a bpm
+#print(bpm_list[0].T2TrigCount) #give the trigger 
+#print(bpm_list[1].AdcLength)
 
 def read_all_bpm(bpm_list): 
@@ -57,7 +76,34 @@
 
 
-def read_libera_and_write_2D(x_motor_step ,y_motor_step ,data_name_and_path, bpm_number, bpm, list_of_data):
+def read_libera(bpm):
+    data_libera =  [bpm[1].T2TrigCount,bpm[1].SpVa,bpm[1].SpVb,bpm[1].SpVc,bpm[1].SpVd,bpm[1].SpSum,bpm[1].SpX,bpm[1].SpY,bpm[1].T2TrigCount]
+    while data_libera[8] != data_libera[0]:
+        print("error trigger")
+        data_libera =  [bpm[1].T2TrigCount,bpm[1].SpVa,bpm[1].SpVb,bpm[1].SpVc,bpm[1].SpVd,bpm[1].SpSum,bpm[1].SpX,bpm[1].SpY,bpm[1].T2TrigCount]
+    else:
+        return(data_libera)
+
+#print(read_libera([3.1415,bpm_list[0]]))
+    
+def read_libera_and_write_2D(x_motor_step ,y_motor_step , # position of motor in step
+                             data_name_and_path,
+                             bpm_number, 
+                             bpm, #list that contain in 0 the name of the bpm, and in 1 the bpm davice on libera
+                             list_of_data): # list of data what we will read
+    data_libera = []
+    successive_error = 0
+    while data_libera == []:
+        try:
+            #print(successive_error)
+            successive_error += 1
+            #print("\n")
+            data_libera = read_libera(bpm)
+        except:
+            print("error of read libera")
+            data_libera = []
+            if successive_error > 4:
+                raise
+    fichier = open(data_name_and_path, "a")
     for data in list_of_data:
-        fichier = open(data_name_and_path, "a")
         if data == "bpm_name" :
             fichier.write(bpm[0])
@@ -65,40 +111,40 @@
         elif data == "bpm_number" :
             fichier.write(str(bpm_number))
-            fichier.write(' ')
+            fichier.write(' ') 
         elif data == "x_motor_step" :
             fichier.write(str(x_motor_step))
-            fichier.write(' ')
+            fichier.write(' ') 
         elif data == "x_motor_mm" :
             x_motor_mm = x_motor_step # will there isn't potentiometer, this value can't be read
             fichier.write(str(x_motor_mm))
-            fichier.write(' ')
+            fichier.write(' ') 
         elif data == "y_motor_step" :
             fichier.write(str(y_motor_step))
-            fichier.write(' ')
+            fichier.write(' ') 
         elif data == "y_motor_mm" :
-#            position = read_vertical_position()
-            y_motor_mm = 0#position[0] # it's the number of the output of the optical rules
+            position = read_vertical_position()
+            y_motor_mm = position[0] # it's the number of the output of the optical rules
             fichier.write(str(y_motor_mm))
-            fichier.write(' ')
+            fichier.write(' ') 
         elif data == "Va" :
-            fichier.write(str(bpm[1].SpVa))
-            fichier.write(' ')
+            fichier.write(str(data_libera[1]))
+            fichier.write(' ') 
         elif data == "Vb" :
-            fichier.write(str(bpm[1].SpVb))
-            fichier.write(' ')
+            fichier.write(str(data_libera[2]))
+            fichier.write(' ') 
         elif data == "Vc" :
-            fichier.write(str(bpm[1].SpVc))
-            fichier.write(' ')
+            fichier.write(str(data_libera[3]))
+            fichier.write(' ') 
         elif data == "Vd" :
-            fichier.write(str(bpm[1].SpVd))
-            fichier.write(' ')
+            fichier.write(str(data_libera[4]))
+            fichier.write(' ') 
         elif data == "Sum" :
-            fichier.write(str(bpm[1].SpSum))
-            fichier.write(' ')
+            fichier.write(str(data_libera[5]))
+            fichier.write(' ') 
         elif data == "x_libera_mm" :
-            fichier.write(str(bpm[1].SpX))
-            fichier.write(' ')
+            fichier.write(str(data_libera[6]/1000.)) #libera give value un micrometer, converted in millimeter 
+            fichier.write(' ') 
         elif data == "y_libera_mm" :
-            fichier.write(str(bpm[1].SpY))
+            fichier.write(str(data_libera[7]/1000.)) #libera give value un micrometer, we write value in mm 
             fichier.write(' ')
         else:
@@ -115,6 +161,6 @@
                        list_of_data, #list of the name of the data that the program will read
                        bpm_list): #list of the bpm on which you need to read data with look like [["bpm_name1",bpm_DeviceProxy1],["bpm_name2",bpm_DeviceProxy2],...]
-    for bpm_number in range(len(bpm_list)):
-        for i in range(statistic_number): #take a set of statistic_number times the data for one set of parameters 
+    for i in range(statistic_number): #take a set of statistic_number times the data for one set of parameters
+        for bpm_number in range(len(bpm_list)):
             read_libera_and_write_2D(x_motor_step, y_motor_step,data_name_and_path, bpm_number, bpm_list[bpm_number], list_of_data)
 
Index: /BPM/read_position.py
===================================================================
--- /BPM/read_position.py	(revision 789)
+++ /BPM/read_position.py	(revision 790)
@@ -38,3 +38,3 @@
 
 
-#print(read_vertical_position())
+print(read_vertical_position())
