Changeset 772 in ETALON


Ignore:
Timestamp:
May 28, 2018, 2:54:21 PM (6 years ago)
Author:
moutardier
Message:

automatisation du choix du nom du fichier de donnée

Location:
BPM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • BPM/initialise_motors.py

    r771 r772  
    245245    motor_disable(1)
    246246
    247 def horizontal_aquisition(begin,end,pas,fichier):
     247def horizontal_aquisition(begin,end,pas,bpm_name):
     248    idata = 0
     249    start_time_str=datetime.now().strftime("%Y%m%d_%H%M%S")
     250    data_name_and_path = data_dir+"data/position_vs_tension_"+bpm_name+"_"+start_time_str+"_"+str(idata)+".txt"
     251    while os.path.exists(data_name_and_path) :
     252        idata+=1
     253        data_name_and_path = data_dir+"position_vs_tension_"+bpm_name+start_time_str+"_"+str(idata)+".txt"
     254    fichier  = open(data_name_and_path, "w")
     255    motor_enable(1)
    248256    L = [[],[],[],[],[]]
    249     for i in range(begin, end+1,pas):
     257    for i in range(begin, end,pas):
    250258        move_motor_absolute(1,5000,i)
    251259        while motor_get(1, 'status') != 'READY':
     
    253261        time.sleep(1)
    254262        l = read_scope_and_write(i, fichier)
    255         for i in range(5):
    256             L[i].append(l[i])
     263        for j in range(5):
     264            L[j].append(l[j])
    257265    time.sleep(1)
    258     move_motor_absolute(1,5000,begin)
     266   
     267    move_motor_absolute(1,5000,end) # pour assuré le dernier pas, en aller ou retour
    259268    while motor_get(1, 'status') != 'READY':
    260269        time.sleep(1)
     270    time.sleep(1)
     271    l = read_scope_and_write(end, fichier)
     272    for j in range(5):
     273        L[j].append(l[j])
    261274    time.sleep(1)
    262275    motor_disable(1)
     
    264277         plt.plot(L[0],L[i+1])
    265278    plt.show()
    266 
     279    fichier.close()
    267280
    268281#controller_hello()
  • BPM/motor_control.py

    r771 r772  
    2626
    2727
     28
     29   
     30
     31
    2832turn_on()
    29 fichier = open("test.txt", "w")
    30 horizontal_aquisition(0,2,1,fichier)
    31 fichier.close()
    32 #turn_off()
    3333
     34horizontal_aquisition(0,400000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr")
     35
     36#horizontal_aquisition(400000,0,-4000,"ch1-3_bpm_ref_ch2-4_bpm_impr")   
     37
     38turn_off()
     39
     40#fichier = open("24-05-2018_aquisition_from_0_to_400000_step_of_1000.txt", "r")
    3441"""
    35 fichier = open("24-05-2018_aquisition_from_0_to_400000_step_of_1000.txt", "r")
    3642A = fichier.read()
    3743
     
    8591plt.plot(X,Y4)
    8692plt.show()
     93"""
    8794
    8895#fichier.close()
    89 """
     96
    9097
    9198
     
    111118
    112119#motor_disable(2) #commande dangeureuse
    113 
    114 
    115 
    116 
    117 
    118 
    119 
    120 
    121 
    122 
    123 
    124 
    125 
    126 
    127 
    128 
Note: See TracChangeset for help on using the changeset viewer.