Changeset 790 in ETALON


Ignore:
Timestamp:
Aug 3, 2018, 2:44:23 PM (6 years ago)
Author:
moutardier
Message:

code final version

Location:
BPM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • BPM/initialise_motors.py

    r787 r790  
    88from read_adc import *
    99import numpy as np
    10 import matplotlib.pyplot as plt
     10#import matplotlib.pyplot as plt
    1111from datetime import datetime
    1212
     
    1616write_to_motor_dated_log = data_dir + './write_to_motor_log'
    1717
    18 #from writeclient import *
     18from writeclient import *
    1919import time
    2020
     
    263263    motor_disable(1)
    264264
    265 def path(bpm_name): # create the path of the file what will contain data
     265def path(bpm_name, list_of_data): # create the path of the file what will contain data
    266266    idata = 0
    267267    start_time_str=datetime.now().strftime("%Y%m%d")
    268268    data_name_and_path = data_dir+"data/"
     269    string_of_data = ""
     270    for data_name in list_of_data:
     271        string_of_data += data_name + "_"
    269272    if not os.path.exists(data_name_and_path) :
    270273        os.makedirs(data_name_and_path)
    271     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+"_"
     274    data_name_and_path = data_name_and_path+string_of_data+bpm_name+"_"+start_time_str+"_"
    272275    while os.path.exists(data_name_and_path+str(idata)+".txt") :
    273276        idata+=1
     
    290293                           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
    291294
    292     data_name_and_path = path(title_bpm_name) #create the name of the datafile
     295    data_name_and_path = path(title_bpm_name, list_of_data) #create the name of the datafile
    293296    write_first_line(data_name_and_path, list_of_data) # write first line of the datafile with the name of the data
    294297    bpm_list = initialise_bpm(bpm_name1,bpm_name2,bpm_name3,bpm_name4) # initialise BPM (program on read_adc.py)
     
    312315                           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
    313316   
    314     data_name_and_path = path(title_bpm_name) #create the name of the datafile
     317    data_name_and_path = path(title_bpm_name, list_of_data) #create the name of the datafile
    315318    write_first_line(data_name_and_path, list_of_data)  # write first line of the datafile with the name of the data
    316319    bpm_list = initialise_bpm(bpm_name1,bpm_name2,bpm_name3,bpm_name4) # initialise BPM (program on read_adc.py)
     
    334337                   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
    335338   
    336     data_name_and_path = path(title_bpm_name)#create the name of the datafile
     339    data_name_and_path = path(title_bpm_name, list_of_data)#create the name of the datafile
    337340    write_first_line(data_name_and_path, list_of_data)# write first line of the datafile with the name of the data
    338341    bpm_list = initialise_bpm(bpm_name1,bpm_name2,bpm_name3,bpm_name4)# initialise BPM (program on read_adc.py)
     
    340343    motor_enable(2)
    341344    for y_position in np.linspace(begin2, end2, number_of_point2):           
    342          motor_move_absolute(2,2000,y_position)
     345       motor_move_absolute(2,2000,y_position)
    343346        print('moteur going to', y_position)
    344347        for x_position in np.linspace(begin1,end1,number_of_point1):
     
    349352            time.sleep(1)
    350353            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)
    351         begin1,end1 = end1,begin1 #to
     354        begin1,end1 = end1,begin1 #to go and back
    352355    motor_disable(1)
    353356    motor_disable(2)
  • BPM/motor_control.py

    r783 r790  
    11#import time
    2 #import urllib
    32#import os
    43from initialise_motors import *
    5 from scope_function import *
     4#from scope_function import *
    65#import numpy as np
    76#import matplotlib.pyplot as plt
     
    1312#motor_reset(2)
    1413#motor_disable(2)
    15 
     14"""
    1615motor_enable(1)
    1716move_motor_absolute(1,5000,-5000)
    18 #while motor_get(1, 'status') != 'READY':
    19 #    time.sleep(1)
    2017move_motor_absolute(1,5000,0)
    21 #while motor_get(1, 'status') != 'READY':
    22 #    time.sleep(1)
    2318motor_disable(1)
    24 
    25 """
    26 for i in range(5):
    27     motor_enable(2)
    28     move_motor_absolute(2,5000,-5000)
    29     while motor_get(2, 'status') != 'READY':
    30         time.sleep(1)
    31     time.sleep(10)
    32 
    33 
    34     move_motor_absolute(2,5000,0)
    35     while motor_get(2, 'status') != 'READY':
    36         time.sleep(1)
    37     motor_disable(2)
    38     time.sleep(10)
    3919"""
    4020
    41 #controller_hello()
    42 #move_motor_relative(1,1000,-1000)
    43 #time.sleep(1)
    44 #move_motor_relative(1,1000,1000)
    45 #urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/test2.png')
    46 #if not os.path.exists(repertoire):
    47 #os.makedirs('./test')    cree repertoir
     21#acquisition_2D(-200000,200000,400, -240000, -260000, 3, 'BPM0-E_BPM1-impr_BPM2-C_100pts-horizontal_3pts-vertical', statistic_number = 100)
     22#acquisition_2D(-15000,15000,3, 0, -500000, 400, 'BPM0-E_BPM1-impr_BPM2-C_3pts-horizontal_100pts-vertical', statistic_number = 100)
    4823
    49 #position_test_horizontal()
    50 
    51 
    52 #                                 creation graphique
    53 
    54 #horizontal_acquisition(4000,0,-4000,"test")   
    55 
    56 #acquisition(-100000,100000,20000,-50000,50000,10000,"test")
    57 
    58 #acquisition(-10000,10000,1000,-50000,0,5000,"test")
    59 
    60 #turn_on()
    61 
    62 #vertical_acquisition(-110000,90000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
    63 
    64 #vertical_acquisition(90000,-110000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
    65 
    66 #vertical_acquisition(0,-4000,2000,"test")
    67 #vertical_acquisition(4000,0,2000,"test2")
    68 
    69 #horizontal_acquisition(400000,0,-4000,"ch1-3_bpm_ref_ch2-4_bpm_impr")   
    70 
    71 #turn_off()
    72 
    73 #fichier = open("24-05-2018_acquisition_from_0_to_400000_step_of_1000.txt", "r")
    74 
    75 #fichier.close()
     24for i in range(5):
     25    acquisition_2D(0,0,1, -380000, -320000, 10, 'test_decrochage_BPM0-E_BPM1-impr_BPM2-C',statistic_number = 10)
     26    acquisition_2D(0,0,1, -320000, -380000, 10, 'test_decrochage_BPM0-E_BPM1-impr_BPM2-C',statistic_number = 10)
    7627
    7728
    7829
    79 """
    80 for i in range(3):
    81         move_motor_absolute(1,5000,i*10000)
    82         while motor_get(1, 'status') != 'READY':
    83                 time.sleep(1)
    84         time.sleep(1)
    85         urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/position_'+str(i*10000)+'.png')
    86         time.sleep(1)
    8730
     31#motor_enable(1)
    8832
    89 move_motor_absolute(1,5000,0)
    90 while motor_get(1, 'status') != 'READY':
    91         time.sleep(1)
    92 time.sleep(1)
    93 motor_disable(1)
    94 
    95 
    96 """
    9733#motor_enable(2)
    9834
    99 #motor_disable(2) #commande dangeureuse
     35#motor_disable(2)
  • BPM/print_datas.py

    r789 r790  
    188188
    189189def 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)
     190    if begin_mm is None and end_mm is None:
     191        return(data)
    190192    number_data_name = number_of_data_name(list_data_name, data_name)
    191193    begin_step,end_step = min_max(list_data_name, data, data_name)
     
    216218        return("Coordonnee y d'apres le moteur (en en million pas)")
    217219    elif data_name == "y_motor_mm" :
    218         return("Coordonnee y d'apres le moteur (en mm)")
     220        return("Coordonnee y d'apres la regle optique (en mm)")
    219221    elif data_name == "Va" :
    220222        return("Tension sur l'electrode a (en mV)")
     
    304306        return("y coordinate acording to motor (in step)")
    305307    elif data_name == "y_motor_mm" :
    306         return("y coordinate acording to motor (in mm)")
     308        return("y coordinate acording the optical rule (in mm)")
    307309    elif data_name == "Va" :
    308310        return("Tension on electrode a (in mV)")
     
    316318        return("Sum of tensions on electrodes (in mV)")
    317319    elif data_name == "x_libera_mm" :
    318         return("x coordinate acording d'apres le Libera (in mm)")
     320        return("x coordinate acording to Libera (in mm)")
    319321    elif data_name == "y_libera_mm" :
    320         return("Coordonnee x d'apres le Libera (en mm)")
     322        return("y coordonnee acording to Libera (in mm)")
    321323    elif data_name == "x_libera_um" :
    322         return("x coordinate acording d'apres le Libera (in um)")
     324        return("x coordinate acording to Libera (in um)")
    323325    elif data_name == "y_libera_um" :
    324         return("Coordonnee x d'apres le Libera (en um)")
     326        return("x coordonnee acording to Libera (in um)")
    325327    else:
    326328        print("unknow ask data_name named " + data_name)
     
    455457    plt.ylabel(y_label, fontsize=20)
    456458    if title is None:
    457         plt.title("Residu de " + y_label + " en fonction de " + x_label, fontsize=20)
    458     else:
    459         plt.title("Residu de " + y_label + " en fonction de " + x_label + "\n" +title, fontsize=20)
     459        plt.title("Residu de " + y_label + "\nen fonction de " + x_label, fontsize=20)
     460    else:
     461        plt.title("Residu de " + y_label + "\nen fonction de " + x_label + "\n" +title, fontsize=20)
    460462    plt.gca().xaxis.set_tick_params(labelsize = 15)
    461463    plt.gca().yaxis.set_tick_params(labelsize = 15)
     
    486488"""
    487489
    488 def oposit_name(list_data_name, data_name):
     490def oposit_name(list_data_name, data_name, data_name2 = None):
    489491    if data_name[0] == "x":
    490492        if "y_motor_step" in list_data_name:
    491493            return("y_motor_step")
    492     if data_name[0] == "y":
     494    elif data_name[0] == "y":
    493495        if "x_motor_step" in list_data_name:
    494496            return("x_motor_step")
     497    elif data_name[0] == "V":
     498        if data_name2[0] == "x":
     499            return("y_motor_step")
     500        elif data_name2[0] == "y":
     501            return("x_motor_step")
    495502    else:
    496503        print("ERROR MULTIPLE LINE")
     
    499506
    500507
    501 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):
     508def 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):
    502509    (list_data_name,data) = read_data(fichier)
     510    if not(x_data_name in list_data_name):
     511        print("This x_data_name doesn't exist, choise within : ")
     512        print(list_data_name)
     513        return(0)
     514    if not(y_data_name in list_data_name):
     515        print("This y_data_name doesn't exist, choise within : ")
     516        print(list_data_name)
     517        return(0)
    503518    data = convert_data(list_data_name, data)
    504519    global global_index_figure # to creat different figure
     
    515530    if "bpm_name" in list_data_name:
    516531        all_bpm_name = all_value_of_data(list_data_name, data, "bpm_name")
     532        if not(one_bpm is None):
     533            if one_bpm in all_bpm_name:
     534                all_bpm_name = [one_bpm]
     535            else:
     536                print("This BPM doesn't exist, choise within : ")
     537                print(all_bpm_name)
     538                return(0)   
    517539        while len(all_bpm_name) > len(color_list):
    518540            color_list += color_list
    519         oposit_y_data_name = oposit_name(list_data_name, y_data_name)
     541        oposit_y_data_name = oposit_name(list_data_name, y_data_name, x_data_name)
    520542        oposit_y_data_number = number_of_data_name(list_data_name, oposit_y_data_name)
    521543        if oposit_y_data_number == "":
     
    542564#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")
    543565
    544 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)
    545 
    546 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
    547 
    548 #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")
    549 
     566#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)
     567
     568#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
     569
     570#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")
     571graph_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.)
     572
     573#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")
    550574
    551575
  • BPM/read_adc.py

    r788 r790  
    11import PyTango
    22import os
     3import time
    34from bpm_constants import *
    45from datetime import datetime
     
    1011##PyTango.Database().get_device_exported('/opt/libera/sbin/libera-ds libera-instrument1')
    1112
     13
     14
    1215PyTango.ApiUtil.get_env_var("TANGO_HOST")
    1316
    1417def initialise_bpm(bpm_name1, bpm_name2, bpm_name3, bpm_name4):
    1518    bpm_list = []
    16     if not(bpm_name1 is None):
    17         bpm_list.append([bpm_name1,DeviceProxy("Maquette/diag/bpm1")])
    18     if not(bpm_name2 is None):
    19         bpm_list.append([bpm_name2,DeviceProxy("Maquette/diag/bpm2")])
    20     if not(bpm_name3 is None):
    21         bpm_list.append([bpm_name3,DeviceProxy("Maquette/diag/bpm3")])
    22     if not(bpm_name4 is None):
    23         bpm_list.append([bpm_name4,DeviceProxy("Maquette/diag/bpm4")])
    24     for bpm in bpm_list:
    25         bpm[1].SpEnable = True
    26         bpm[1].Kx = 14136
    27         bpm[1].Ky = 14136
    28         bpm[1].SpThreshold = 200
    29         bpm[1].SpNBefor = 1
    30         bpm[1].SpNAfter = 25
     19    successive_error = 0
     20    while bpm_list == []:
     21        try:
     22            #print(successive_error)
     23            successive_error += 1
     24            #print("\n")     
     25            if not(bpm_name1 is None):
     26                bpm_list.append([bpm_name1,DeviceProxy("Maquette/diag/bpm1")])
     27            if not(bpm_name2 is None):
     28                bpm_list.append([bpm_name2,DeviceProxy("Maquette/diag/bpm2")])
     29            if not(bpm_name3 is None):
     30                bpm_list.append([bpm_name3,DeviceProxy("Maquette/diag/bpm3")])
     31            if not(bpm_name4 is None):
     32                bpm_list.append([bpm_name4,DeviceProxy("Maquette/diag/bpm4")])
     33            for bpm in bpm_list:
     34                bpm[1].Fans = 6000
     35                bpm[1].AdcLength = 50
     36                bpm[1].SpEnable = True
     37                bpm[1].Kx = 14136
     38                bpm[1].Ky = 14136
     39                bpm[1].SpThreshold = 200
     40                bpm[1].SpNBefor = 1
     41                bpm[1].SpNAfter = 20
     42        except:
     43            print("error of initialise bpm")
     44            bpm_list = []
     45            if successive_error > 4:
     46                raise
    3147    return(bpm_list)
    3248
    3349       
    34 #bpm_list = [DeviceProxy("Maquette/diag/bpm1"), DeviceProxy("Maquette/diag/bpm2"), DeviceProxy("Maquette/diag/bpm3")] # global list that containe data for each used BPM
     50bpm_list = [DeviceProxy("Maquette/diag/bpm1"), DeviceProxy("Maquette/diag/bpm2"), DeviceProxy("Maquette/diag/bpm3")] # global list that containe data for each used BPM
    3551#, DeviceProxy("Maquette/diag/bpm4")]
    36 #bpm_list[1].Fans = 5000
     52#bpm_list[0].Fans = 2500
     53#print(bpm_list[0].get_attribute_list())  # give all the attribute of a bpm
     54#print(bpm_list[0].T2TrigCount) #give the trigger
     55#print(bpm_list[1].AdcLength)
    3756
    3857def read_all_bpm(bpm_list):
     
    5776
    5877
    59 def read_libera_and_write_2D(x_motor_step ,y_motor_step ,data_name_and_path, bpm_number, bpm, list_of_data):
     78def read_libera(bpm):
     79    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]
     80    while data_libera[8] != data_libera[0]:
     81        print("error trigger")
     82        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]
     83    else:
     84        return(data_libera)
     85
     86#print(read_libera([3.1415,bpm_list[0]]))
     87   
     88def read_libera_and_write_2D(x_motor_step ,y_motor_step , # position of motor in step
     89                             data_name_and_path,
     90                             bpm_number,
     91                             bpm, #list that contain in 0 the name of the bpm, and in 1 the bpm davice on libera
     92                             list_of_data): # list of data what we will read
     93    data_libera = []
     94    successive_error = 0
     95    while data_libera == []:
     96        try:
     97            #print(successive_error)
     98            successive_error += 1
     99            #print("\n")
     100            data_libera = read_libera(bpm)
     101        except:
     102            print("error of read libera")
     103            data_libera = []
     104            if successive_error > 4:
     105                raise
     106    fichier = open(data_name_and_path, "a")
    60107    for data in list_of_data:
    61         fichier = open(data_name_and_path, "a")
    62108        if data == "bpm_name" :
    63109            fichier.write(bpm[0])
     
    65111        elif data == "bpm_number" :
    66112            fichier.write(str(bpm_number))
    67             fichier.write(' ')
     113            fichier.write(' ') 
    68114        elif data == "x_motor_step" :
    69115            fichier.write(str(x_motor_step))
    70             fichier.write(' ')
     116            fichier.write(' ') 
    71117        elif data == "x_motor_mm" :
    72118            x_motor_mm = x_motor_step # will there isn't potentiometer, this value can't be read
    73119            fichier.write(str(x_motor_mm))
    74             fichier.write(' ')
     120            fichier.write(' ') 
    75121        elif data == "y_motor_step" :
    76122            fichier.write(str(y_motor_step))
    77             fichier.write(' ')
     123            fichier.write(' ') 
    78124        elif data == "y_motor_mm" :
    79 #            position = read_vertical_position()
    80             y_motor_mm = 0#position[0] # it's the number of the output of the optical rules
     125            position = read_vertical_position()
     126            y_motor_mm = position[0] # it's the number of the output of the optical rules
    81127            fichier.write(str(y_motor_mm))
    82             fichier.write(' ')
     128            fichier.write(' ') 
    83129        elif data == "Va" :
    84             fichier.write(str(bpm[1].SpVa))
    85             fichier.write(' ')
     130            fichier.write(str(data_libera[1]))
     131            fichier.write(' ') 
    86132        elif data == "Vb" :
    87             fichier.write(str(bpm[1].SpVb))
    88             fichier.write(' ')
     133            fichier.write(str(data_libera[2]))
     134            fichier.write(' ') 
    89135        elif data == "Vc" :
    90             fichier.write(str(bpm[1].SpVc))
    91             fichier.write(' ')
     136            fichier.write(str(data_libera[3]))
     137            fichier.write(' ') 
    92138        elif data == "Vd" :
    93             fichier.write(str(bpm[1].SpVd))
    94             fichier.write(' ')
     139            fichier.write(str(data_libera[4]))
     140            fichier.write(' ') 
    95141        elif data == "Sum" :
    96             fichier.write(str(bpm[1].SpSum))
    97             fichier.write(' ')
     142            fichier.write(str(data_libera[5]))
     143            fichier.write(' ') 
    98144        elif data == "x_libera_mm" :
    99             fichier.write(str(bpm[1].SpX))
    100             fichier.write(' ')
     145            fichier.write(str(data_libera[6]/1000.)) #libera give value un micrometer, converted in millimeter
     146            fichier.write(' ') 
    101147        elif data == "y_libera_mm" :
    102             fichier.write(str(bpm[1].SpY))
     148            fichier.write(str(data_libera[7]/1000.)) #libera give value un micrometer, we write value in mm
    103149            fichier.write(' ')
    104150        else:
     
    115161                       list_of_data, #list of the name of the data that the program will read
    116162                       bpm_list): #list of the bpm on which you need to read data with look like [["bpm_name1",bpm_DeviceProxy1],["bpm_name2",bpm_DeviceProxy2],...]
    117     for bpm_number in range(len(bpm_list)):
    118         for i in range(statistic_number): #take a set of statistic_number times the data for one set of parameters
     163    for i in range(statistic_number): #take a set of statistic_number times the data for one set of parameters
     164        for bpm_number in range(len(bpm_list)):
    119165            read_libera_and_write_2D(x_motor_step, y_motor_step,data_name_and_path, bpm_number, bpm_list[bpm_number], list_of_data)
    120166
  • BPM/read_position.py

    r788 r790  
    3838
    3939
    40 #print(read_vertical_position())
     40print(read_vertical_position())
Note: See TracChangeset for help on using the changeset viewer.