Changeset 790 in ETALON for BPM/initialise_motors.py


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

code final version

File:
1 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)
Note: See TracChangeset for help on using the changeset viewer.