Changeset 783 in ETALON


Ignore:
Timestamp:
Jul 17, 2018, 4:02:19 PM (6 years ago)
Author:
moutardier
Message:

add line to wait until motor stop move befor doing anything else

Location:
BPM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • BPM/initialise_motors.py

    r779 r783  
    209209def move_motor_relative(motor, speed, steps):
    210210    motor_move_relative(motor, speed, steps)
     211    while motor_get(motor, 'status') != 'READY':
     212        time.sleep(1)
    211213
    212214def motor_move_absolute(motor, speed, steps):
     
    221223    "Moves a motor with the given parameters"
    222224    motor_move_absolute(motor, speed, steps)
    223 
     225    while motor_get(motor, 'status') != 'READY':
     226        time.sleep(1)
    224227
    225228def motor_wait_for_ready(motor,verbose=VERBOSE_DEFAULT):
  • BPM/motor_control.py

    r782 r783  
    1 import time
    2 import urllib
    3 import os
     1#import time
     2#import urllib
     3#import os
    44from initialise_motors import *
    55from scope_function import *
    6 import numpy as np
    7 import matplotlib.pyplot as plt
     6#import numpy as np
     7#import matplotlib.pyplot as plt
    88
    99# moteur 1 -> horizontal
     
    1616motor_enable(1)
    1717move_motor_absolute(1,5000,-5000)
     18#while motor_get(1, 'status') != 'READY':
     19#    time.sleep(1)
    1820move_motor_absolute(1,5000,0)
     21#while motor_get(1, 'status') != 'READY':
     22#    time.sleep(1)
    1923motor_disable(1)
    2024
  • BPM/print_datas.py

    r782 r783  
    22import matplotlib.pyplot as plt
    33from scipy import stats
     4
     5
     6global_index_figure = 0
    47
    58def float_list(l): # convert a list of char in a list of float
     
    5760def print_graph(L): # program to print graph of data set in a list with [[position][Va][Vb][Vc][Vd]], also do a linear regretion and print the equation
    5861#    a = np.array([L[0][i],L[1][i]] for i in range(len(L[0])))
    59     fig = plt.figure(1)
     62    global global_index_figure
     63    fig1 = plt.figure(global_index_figure)
     64    global_index_figure += 1
    6065    plt.clf()
    6166    lr1 = stats.linregress(L[0],L[1]) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    6267    plt.plot(L[0],L[1], "r", label = "BMP_ref")
    6368    plt.plot(L[0],[lr1.slope*i + lr1.intercept for i in L[0]], "r--", label = "BMP_ref regression line, \nerror = "+str(round(lr1.stderr,3))+",\ncorrelation coefficient = "+str(round(lr1.rvalue,3)))
    64    
     69
    6570    lr2 = stats.linregress(L[0],L[2])
    6671    plt.plot(L[0],L[2], "b", label = "BMP_impr")
     
    7681   
    7782    plt.legend()
    78     plt.xlabel("length in million motor step")
     83    plt.xlabel("length in million motor step") #, fontsize=20)
    7984    plt.ylabel("tension in mV")
    80     plt.show()
     85    plt.gca().yaxis.set_tick_params(labelsize = 8)
     86#    plt.show()
    8187
    8288def residu(L): # program to do graph of residu of data give in a list with [[position][Va][Vb][Vc][Vd]]
    83     fig = plt.figure(1)
     89    global global_index_figure
     90    fig1 = plt.figure(global_index_figure)
     91    global_index_figure += 1
    8492    plt.clf()
    8593    plt.title("Residu")
     
    8896        L[1][i] = L[1][i] -  lr1.slope*L[0][i] - lr1.intercept
    8997    plt.plot(L[0],L[1], "r", label = "BMP_ref")
    90    
     98
    9199    lr2 = stats.linregress(L[0],L[2])
    92100    for i in range(len(L[2])):
     
    98106        L[3][i] = L[3][i] -  lr3.slope*L[0][i] - lr3.intercept
    99107    plt.plot(L[0],L[3], "g", label = "BMP_ref")
    100  
     108
    101109    lr4 = stats.linregress(L[0],L[4])
    102110    for i in range(len(L[4])):
     
    106114    plt.xlabel("length in million motor step")
    107115    plt.ylabel("tension in mV")
    108     plt.show()
     116#    plt.show()
    109117   
    110118"""   
     
    127135        if  L[0][i] >= mini and L[0][i] <= maxi :
    128136            index_list.append(i)
    129     print(index_list)
    130137    return([[L[0][i] for i in index_list],[L[1][i] for i in index_list],[L[2][i] for i in index_list],[L[3][i] for i in index_list],[L[4][i] for i in index_list]])
    131138
     
    162169#print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
    163170#print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
     171plt.show()
     172
Note: See TracChangeset for help on using the changeset viewer.