Changeset 789 in ETALON


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

big modification of print_datas.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BPM/print_datas.py

    r786 r789  
    22import matplotlib.pyplot as plt
    33from scipy import stats
     4import math
     5from io import BytesIO
    46
    57
    68global_index_figure = 0
    79
    8 def float_list(l): # convert a list of char in a list of float
     10def float_list(l, avoid = []): # convert a list of char in a list of float, and it avoid all data in the list of index that must be avoid
    911    L = []
    10     for i in l:
    11         L.append(float(i))
     12    for i in range(len(l)):
     13        if i in avoid:
     14            L.append(l[i])
     15        else:
     16            L.append(float(l[i]))
    1217    return(L)
    1318
     
    1520    Lx = []
    1621    for i in L:
    17         Lx.append(i*x +b)
     22        Lx.append(i*x +b)   
    1823    return(Lx)
    1924
    20 def read_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(fichier): # program to read data from a file of data with position of motor and them Va, Vb, Vc and Vd
    21     fichier = open(fichier, "r")
    22     Data = fichier.read()
    23     Data_list = [[[] for i in range(9)] for j in range(3)]
    24     value = ""
    25     index = -1
    26     for i in Data:
    27         if (i == " ") :
    28             if index == -1:
    29                 bpm_index = int(value)
    30                 index +=1
    31             else:
    32                 Data_list[bpm_index][index].append(value)
    33                 index += 1
    34             value = ""
    35         elif (i == "\n") :
    36             if value != "":
    37                 Data_list[bpm_index][index].append(value)
    38                 value = ""
    39             index = -1
    40         else:
    41             value += i
    42     fichier.close()
    43     for bpm in Data_list:
    44         for i in range(len(bpm)):
    45             bpm[i] = float_list(bpm[i])
    46     return(Data_list)
     25
     26#print(read_first_line("data/test.txt"))
     27
     28"""    #other way to read data (without data of type different than float)
     29def read_data(fichier): # program to read data from a file of data with position of motor and them Va, Vb, Vc and Vd
     30    list_data_name = read_first_line(fichier) #create a list of the name of the data in the file
     31    data = np.genfromtxt(fichier, delimiter=",", dtype="|U5", autostrip=True)# np.genfromtxt('data/test.txt', delimiter=' ', skip_header = 1) ### can't be use with other thiks than number
     32    return(list_data_name,data)
    4733"""
    4834
    49         bpm[0] = product_list(Data_list[0],10**-6)
    50 
    51     for i in range(1,5):
    52         Data_list[i] = product_list(Data_list[i],1000)
     35def read_line(line): # allow to read one line of the files
     36    data_name = ""
     37    list_data = []
     38    for data_car in line:
     39        if (data_car == " ") or (data_car == "\n"):
     40            if data_name != "":
     41                list_data.append(data_name)
     42            data_name = ""
     43        else:
     44            data_name += data_car
     45    return(list_data)
     46
     47def read_data(fichier): # program to read data from a file of data
     48    data = open(fichier, 'r')
     49    data_list = []
     50    for line in data:
     51        #print(line)
     52        data_list.append(read_line(line))
     53    data.close()
     54    return(data_list[0],data_list[1:])
     55
     56def number_of_data_name(list_data_name, data_name): # give the number of a data in list_data_name with the name data_name
     57    name_number = float('nan')
     58    for number in range(len(list_data_name)):
     59        if data_name == list_data_name[number]:
     60            name_number = number
     61    return(name_number)
     62
     63def convert_data(list_data_name, data): # convert data from string to int
     64    data_avoid = number_of_data_name(list_data_name, "bpm_name") # all other data are string of float and must be convert in float
     65    float_data = []
     66    for sub_data in data:
     67        float_data.append(float_list(sub_data, avoid = [data_avoid]))
     68    return(float_data)
     69
     70def min_max(list_data_name, data, data_name):
     71    number_data_name = number_of_data_name(list_data_name, data_name)
     72    mini = data[0][number_data_name]
     73    maxi = data[0][number_data_name]
     74    for i in data:
     75        if mini > i[number_data_name]:
     76            mini = i[number_data_name]
     77        if maxi < i[number_data_name]:
     78            maxi = i[number_data_name]
     79    return(mini,maxi)
     80   
     81#(list_data_name,data) = read_data("data/test.txt")
     82#print(list_data_name)
     83#print()
     84#print(convert_data(list_data_name,data ))
     85
     86def all_value_of_data(list_data_name, data, data_name, data_name2 = None): #return a list that contain all different value that take data_name in data, data_name2 is to avoid 2 read of data for taken twice the same thing (used in moy_rms_data)
     87    data_number = number_of_data_name(list_data_name, data_name)
     88    #print(data_number)
     89    all_data_name = []
     90    if data_name2 is None:
     91        for data_list in data:
     92            #print(data_number)
     93            #print(data_name)
     94            #print(type(data_number))
     95            if not(data_list[data_number] in all_data_name):
     96                all_data_name.append(data_list[data_number])
     97        return(all_data_name)
     98    else:
     99        data_number2 = number_of_data_name(list_data_name, data_name2)
     100        all_data_name2 = []
     101        for data_list in data:
     102            if not(data_list[data_number] in all_data_name):
     103                all_data_name.append(data_list[data_number])
     104            if not(data_list[data_number2] in all_data_name2):
     105                all_data_name2.append(data_list[data_number2])
     106        return(all_data_name,all_data_name2)
     107   
     108#(list_data_name,data) = read_data("data/test.txt")   
     109#print(all_value_of_data(list_data_name, data, "bpm_name", data_name2 = None))
     110
     111def cut_data(list_data_name, data, data_name, inf = None, equal = None, sup = None): # return list of data with were there is a contrain on the data name "data_name"
     112    data_number = number_of_data_name(list_data_name, data_name)
     113    list_of_keep_data = []
     114    if data_number ==  float('nan'):
     115        print("ERREUR in the name of cut data ")
     116    elif not (inf is None):
     117        if not (equal is None):
     118            for value in range(len(data)):
     119                if data[value][data_number] < inf or data[value][data_number] == equal:
     120                    list_of_keep_data.append(value)
     121        else:
     122            for value in range(len(data)):
     123                if data[value][data_number] < inf:
     124                    list_of_keep_data.append(value)
     125    elif not (sup is None):
     126        if not (equal is None):
     127            for value in range(len(data)):
     128                if data[value][data_number] > sup or data[value][data_number] == equal:
     129                    list_of_keep_data.append(value)
     130        else:
     131            for value in range(len(data)):
     132                if data[value][data_number] > sup:
     133                    list_of_keep_data.append(value)
     134    elif not (equal is None):
     135        for value in range(len(data)):
     136            if data[value][data_number] == equal:
     137                list_of_keep_data.append(value)
     138    else:
     139        return(data)
     140    return([data[value] for value in list_of_keep_data])
     141
     142
     143#def select_data(list_data_name, data, data_name1, data_name2, data_name3, data_name4)
     144
     145#def print_graph(list_data_name
     146
     147   
     148#(list_data_name,data) = read_data("data/test.txt")
     149#print(data)
     150#print(cut_data(list_data_name, data, "bpm_name",equal = "bpm_E"))
     151
     152def moy_rms(list_data_name, data,data_name):
     153    number_data_name = number_of_data_name(list_data_name, data_name)
     154    moy = 0
     155    rms = 0
     156    data_len = float(len(data))
     157    for data_list in data:
     158        moy += data_list[number_data_name]/data_len
     159    for data_list in data:
     160        rms += (data_list[number_data_name] - moy)*(data_list[number_data_name] - moy)/data_len
     161    return(moy,np.sqrt(rms))
     162
     163
     164def moy_rms_data(list_data_name, data, x_data_name, y_data_name):
     165    x_number_data_name = number_of_data_name(list_data_name, x_data_name)
     166    moy_list = []
     167    rms_list = []
     168    X = []
     169    if "bpm_name" in list_data_name:
     170        bpm_number = number_of_data_name(list_data_name, "bpm_name")
     171        all_bpm_name, all_x_data_name = all_value_of_data(list_data_name, data, data_name = "bpm_name", data_name2 = x_data_name)
     172        for bpm_name in all_bpm_name:
     173            cut_dat = cut_data(list_data_name, data, "bpm_name", equal = bpm_name)
     174            for name in all_x_data_name:
     175                moy,rms = moy_rms(list_data_name, cut_data(list_data_name, cut_dat, x_data_name, equal = name), y_data_name)
     176                moy_list.append(moy)
     177                rms_list.append(rms)
     178                X.append(name)
     179    else:
     180        all_data_name = all_value_of_data(list_data_name, data, data_name = x_data_name)
     181        for name in all_data_name:
     182            moy,rms = moy_rms(list_data_name, cut_data(list_data_name, cut_data, x_data_name, equal = name), y_data_name)
     183            moy_list.append(moy)
     184            rms_list.append(rms)
     185            X.append(name)
     186    return(X,moy_list,rms_list)
     187
     188
     189def 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    number_data_name = number_of_data_name(list_data_name, data_name)
     191    begin_step,end_step = min_max(list_data_name, data, data_name)
     192    if begin_mm is None:
     193        begin_mm = begin_step
     194    if end_mm is None:
     195        end_mm = end_step
     196    if end_step == begin_step:
     197        return(data)
     198    a = float((end_mm - begin_mm))/(end_step - begin_step)
     199    b = begin_mm - a*begin_step
     200    #print(a,b)
     201    for index in range(len(data)):
     202        data[index][number_data_name] = a*data[index][number_data_name] + b
     203    return(data)
     204
     205
     206def plot_legend_fr(data_name): # return the legende in french for a graph according to the data read
     207    if data_name == "bpm_name" :
     208        return("Nom du BPM")
     209    elif data_name == "bpm_number" :
     210        return("Numero du BPM")
     211    elif data_name == "x_motor_step" :
     212        return("Coordonnee x d'apres le moteur (en million de pas)")
     213    elif data_name == "x_motor_mm" :
     214        return("Coordonnee x d'apres le moteur (en mm)")
     215    elif data_name == "y_motor_step" :
     216        return("Coordonnee y d'apres le moteur (en en million pas)")
     217    elif data_name == "y_motor_mm" :
     218        return("Coordonnee y d'apres le moteur (en mm)")
     219    elif data_name == "Va" :
     220        return("Tension sur l'electrode a (en mV)")
     221    elif data_name == "Vb" :
     222        return("Tension sur l'electrode b (en mV)")
     223    elif data_name == "Vc" :
     224        return("Tension sur l'electrode c (en mV)")
     225    elif data_name == "Vd" :
     226        return("Tension sur l'electrode d (en mV)")
     227    elif data_name == "Sum":
     228        return("Somme des tensions sur les electrodes (en mV)")
     229    elif data_name == "x_libera_mm" :
     230        return("Coordonnee x d'apres le Libera (en mm)")
     231    elif data_name == "y_libera_mm" :
     232        return("Coordonnee x d'apres le Libera (en mm)")
     233    else:
     234        print("unknow ask data_name named " + data_name)
     235        return("Inconnue")
     236
     237
     238
     239def print_graph_fr(list_data_name, data, x_data_name, y_data_name, index_figure, color = "r",title = None, legende = None, lin_reg = None, rms = None, centrage = None): # program to print graph of y_data_name vs x_data_name in french
     240    fig1 = plt.figure(index_figure)
     241    if not(centrage is None):
     242        mini,maxi =  min_max(list_data_name, data, x_data_name)
     243        data = linear_fonction_on_data(list_data_name, data, x_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     244        mini,maxi =  min_max(list_data_name, data, y_data_name)
     245        data = linear_fonction_on_data(list_data_name, data, y_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     246    if rms is None:
     247        x_data_number = number_of_data_name(list_data_name, x_data_name)
     248        X = [i[x_data_number] for i in data]
     249        y_data_number = number_of_data_name(list_data_name, y_data_name)
     250        Y = [i[y_data_number] for i in data]
     251        rms = [0 for i in data]
     252    else:
     253        X,Y,rms = moy_rms_data(list_data_name, data, x_data_name, y_data_name)
     254    if (x_data_name == "x_motor_step") or (x_data_name == "y_motor_step"):
     255        X = [i/1000000. for i in X]
     256    if y_data_name == "x_motor_step" or y_data_name == "y_motor_step":
     257        Y = [i[y_data_number]/1000000. for i in data]
     258    if legende is None:
     259        plt.plot(X,Y, color+".")
     260        plt.errorbar(X,Y,yerr = rms, ecolor = color)
     261    else:
     262        plt.plot(X,Y, color+".", label = legende)
     263        plt.errorbar(X,Y,yerr = rms, ecolor = color)
     264    if not(lin_reg is None):
     265        lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     266        if legende is None:
     267            plt.plot(X,[lr1.slope*i + lr1.intercept for i in X], color+"--", label =  " regression lineaire, \nerreur = "+str(round(lr1.stderr,3))+",\ncoefficient de correlation = "+str(round(lr1.rvalue,3)) + "\npente de la regression lineaire = " + str(round(lr1.slope,3)))
     268        else:
     269            plt.plot(X,[lr1.slope*i + lr1.intercept for i in X], color+"--", label = legende + " : regression lineaire, \nerreur = "+str(round(lr1.stderr,3))+",\ncoefficient de correlation  = "+str(round(lr1.rvalue,3))+ "\npente de la regression lineaire = " + str(round(lr1.slope,3)))
     270    plt.legend(fontsize=15)
     271    x_label = plot_legend_fr(x_data_name)
     272    y_label = plot_legend_fr(y_data_name)
     273    plt.xlabel(x_label, fontsize=20)
     274    plt.ylabel(y_label, fontsize=20)
     275    if title is None:
     276        plt.title(y_label + " en fonction de " + x_label, fontsize=20)
     277    else:
     278        plt.title(title, fontsize=20)
     279    plt.gca().xaxis.set_tick_params(labelsize = 15)
     280    plt.gca().yaxis.set_tick_params(labelsize = 15)
     281
     282   
     283
     284#(list_data_name,data) = read_data("data/test.txt")
     285#data = convert_data(list_data_name, data)
     286#print_graph_fr(list_data_name, data, "x_motor_mm", "x_motor_step", 1, color = "r", legende = "BPM_C", lin_reg = "true")
     287
     288#print_graph_fr(list_data_name, data, "x_motor_mm", "x_motor_step", 1, color = "b", legende = "BPM_C", lin_reg = "true")
     289
     290
     291
     292
     293
     294def plot_legend(data_name): # return the legende in english for a graph according to the data read
     295    if data_name == "bpm_name" :
     296        return("BPM name")
     297    elif data_name == "bpm_number" :
     298        return("BPM number")
     299    elif data_name == "x_motor_step" :
     300        return("x coordinate acording to motor (in step)")
     301    elif data_name == "x_motor_mm" :
     302        return("x coordinate acording to motor (in mm)")
     303    elif data_name == "y_motor_step" :
     304        return("y coordinate acording to motor (in step)")
     305    elif data_name == "y_motor_mm" :
     306        return("y coordinate acording to motor (in mm)")
     307    elif data_name == "Va" :
     308        return("Tension on electrode a (in mV)")
     309    elif data_name == "Vb" :
     310        return("Tension on electrode b (in mV)")
     311    elif data_name == "Vc" :
     312        return("Tension on electrode c (in mV)")
     313    elif data_name == "Vd" :
     314        return("Tension on electrode d (in mV)")
     315    elif data_name == "Sum":
     316        return("Sum of tensions on electrodes (in mV)")
     317    elif data_name == "x_libera_mm" :
     318        return("x coordinate acording d'apres le Libera (in mm)")
     319    elif data_name == "y_libera_mm" :
     320        return("Coordonnee x d'apres le Libera (en mm)")
     321    elif data_name == "x_libera_um" :
     322        return("x coordinate acording d'apres le Libera (in um)")
     323    elif data_name == "y_libera_um" :
     324        return("Coordonnee x d'apres le Libera (en um)")
     325    else:
     326        print("unknow ask data_name named " + data_name)
     327        return("Inconnue")
     328
     329   
     330def print_graph(list_data_name, data, x_data_name, y_data_name, index_figure, color = "r",title = None, legende = None, lin_reg = None, rms = None, centrage = None):  # program to print graph of y_data_name vs x_data_name in english
     331    if not(centrage is None):
     332        mini,maxi =  min_max(list_data_name, data, x_data_name)
     333        data = linear_fonction_on_data(list_data_name, data, x_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     334        mini,maxi =  min_max(list_data_name, data, y_data_name)
     335        data = linear_fonction_on_data(list_data_name, data, y_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     336    fig1 = plt.figure(index_figure)
     337    if rms is None:
     338        x_data_number = number_of_data_name(list_data_name, x_data_name)
     339        X = [i[x_data_number] for i in data]
     340        y_data_number = number_of_data_name(list_data_name, y_data_name)
     341        Y = [i[y_data_number] for i in data]
     342        rms = [0 for i in data]
     343    else:
     344        X,Y,rms = moy_rms_data(list_data_name, data, x_data_name, y_data_name)
     345    if (x_data_name == "x_motor_step") or (x_data_name == "y_motor_step"):
     346        X = [i/1000000. for i in X]
     347    if y_data_name == "x_motor_step" or y_data_name == "y_motor_step":
     348        Y = [i[y_data_number]/1000000. for i in data]
     349    if legende is None:
     350        plt.plot(X,Y, color+".")
     351        plt.errorbar(X,Y,yerr = rms, ecolor = color)
     352    else:
     353        plt.plot(X,Y, color+".", label = legende)
     354        plt.errorbar(X,Y,yerr = rms, ecolor = color)
     355    if not(lin_reg is None):
     356        lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     357        if legende is None:
     358            plt.plot(X,[lr1.slope*i + lr1.intercept for i in X], color+"--", label =  "linear regression, \nerror = "+str(round(lr1.stderr,3))+",\ncorrelation coefficient = "+str(round(lr1.rvalue,3)) + "\nslope = " + str(round(lr1.slope,3)))
     359        else:
     360            plt.plot(X,[lr1.slope*i + lr1.intercept for i in X], color+"--", label = legende + " : lineare regression, \nerror = "+str(round(lr1.stderr,3))+",\ncorrelation coefficient = "+str(round(lr1.rvalue,3))+ "\nslope = " + str(round(lr1.slope,3)))
     361    plt.legend(fontsize=15)
     362    x_label = plot_legend(x_data_name)
     363    y_label = plot_legend(y_data_name)
     364    plt.xlabel(x_label, fontsize=20)
     365    plt.ylabel(y_label, fontsize=20)
     366    if title is None:
     367        plt.title(y_label + " in fonction of " + x_label, fontsize=20)
     368    else:
     369        plt.title(title, fontsize=20)
     370    plt.gca().xaxis.set_tick_params(labelsize = 15)
     371    plt.gca().yaxis.set_tick_params(labelsize = 15)
     372
     373
     374   
     375def print_residu(list_data_name, data, x_data_name, y_data_name, index_figure, color = "r", legende = None , title = None, rms = None, centrage = None):  # program to print graph of residu of y_data_name vs x_data_name in english
     376    if not(centrage is None):
     377        mini,maxi =  min_max(list_data_name, data, x_data_name)
     378        data = linear_fonction_on_data(list_data_name, data, x_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     379        mini,maxi =  min_max(list_data_name, data, y_data_name)
     380        data = linear_fonction_on_data(list_data_name, data, y_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     381    fig1 = plt.figure(index_figure)
     382    if rms is None:
     383        x_data_number = number_of_data_name(list_data_name, x_data_name)
     384        X = [i[x_data_number] for i in data]
     385        y_data_number = number_of_data_name(list_data_name, y_data_name)
     386        Y = [i[y_data_number] for i in data]
     387        rms = [0 for i in data]
     388    else:
     389        X,Y,rms = moy_rms_data(list_data_name, data, x_data_name, y_data_name)
     390    if (x_data_name == "x_motor_step") or (x_data_name == "y_motor_step"):
     391        X = [i/1000000. for i in X]
     392    if y_data_name == "x_motor_step" or y_data_name == "y_motor_step":
     393        Y = [i[y_data_number]/1000000. for i in data]
     394    lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     395    for index in range(len(Y)):
     396        Y[index] = abs(Y[index] - (lr1.slope*X[index] + lr1.intercept))
     397    if legende is None:
     398        plt.plot(X,Y, color+".")
     399    else:
     400        plt.plot(X,Y, color+".", label = legende)
     401    plt.legend(fontsize=15)
     402    x_label = plot_legend(x_data_name)
     403    y_label = plot_legend(y_data_name)
     404    plt.xlabel(x_label, fontsize=20)
     405    plt.ylabel(y_label, fontsize=20)
     406    if title is None:
     407        plt.title("Residu of " + y_label + " in fonction of " + x_label, fontsize=20)
     408    else:
     409        plt.title("Residu of " + y_label + " in fonction of " + x_label + "\n" +title, fontsize=20)
     410    plt.gca().xaxis.set_tick_params(labelsize = 15)
     411    plt.gca().yaxis.set_tick_params(labelsize = 15)
     412
     413
     414
     415#(list_data_name,data) = read_data("data/test.txt")
     416#data = convert_data(list_data_name, data)
     417#print_residu(list_data_name, data, "x_motor_mm", "x_motor_step", 1, color = "r", legende = "BPM_C")
     418
     419
     420
     421
     422def print_residu_fr(list_data_name, data, x_data_name, y_data_name, index_figure, color = "r", legende = None, title = None, rms = None, centrage = None):  # program to print graph of residu of y_data_name vs x_data_name in french
     423    if not(centrage is None):
     424        mini,maxi =  min_max(list_data_name, data, x_data_name)
     425        data = linear_fonction_on_data(list_data_name, data, x_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     426        #mini,maxi =  min_max(list_data_name, data, y_data_name)
     427        #data = linear_fonction_on_data(list_data_name, data, y_data_name, begin_mm = (mini - maxi)/2., end_mm = (maxi - mini)/2.)
     428    fig1 = plt.figure(index_figure)
     429    if rms is None:
     430        x_data_number = number_of_data_name(list_data_name, x_data_name)
     431        X = [i[x_data_number] for i in data]
     432        y_data_number = number_of_data_name(list_data_name, y_data_name)
     433        Y = [i[y_data_number] for i in data]
     434        rms = [0 for i in data]
     435    else:
     436        X,Y,rms = moy_rms_data(list_data_name, data, x_data_name, y_data_name)
     437    if (x_data_name == "x_motor_step") or (x_data_name == "y_motor_step"):
     438        X = [i/1000000. for i in X]
     439    if y_data_name == "x_motor_step" or y_data_name == "y_motor_step":
     440        Y = [i[y_data_number]/1000000. for i in data]
     441    lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     442    moyenne = 0
     443    len_Y = len(Y)
     444    for index in range(len_Y):
     445        Y[index] = abs(Y[index] - (lr1.slope*X[index] + lr1.intercept))
     446        moyenne += Y[index]/len_Y
     447    if legende is None:
     448        plt.plot(X,Y, color+".")
     449    else:
     450        plt.plot(X,Y, color+".", label = legende + " residu moyen = " + str(round(moyenne,4)))
     451    plt.legend(fontsize=15)
     452    x_label = plot_legend_fr(x_data_name)
     453    y_label = plot_legend_fr(y_data_name)
     454    plt.xlabel(x_label, fontsize=20)
     455    plt.ylabel(y_label, fontsize=20)
     456    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)
     460    plt.gca().xaxis.set_tick_params(labelsize = 15)
     461    plt.gca().yaxis.set_tick_params(labelsize = 15)
     462
     463
    53464"""
    54 
    55 
    56 def read_data_position_Va_Vb_Vc_Vd(fichier): # program to read data from a file of data with position of motor and them Va, Vb, Vc and Vd
    57     fichier = open(fichier, "r")
    58     Data = fichier.read()
    59     Data_list = [[],[],[],[],[]]
    60     value = ""
    61     index = 0
    62     for i in Data:
    63         if (i == " ") :
    64             if index == 0:
    65                 Data_list[0].append(value)
    66                 index +=1
    67             elif index == 1:
    68                 Data_list[1].append(value)
    69                 #print(value)
    70                 index += 1
    71             elif index == 2:
    72                 Data_list[2].append(value)
    73                 index += 1
    74             elif index == 3:
    75                 Data_list[3].append(value)
    76                 index += 1
    77             else:
    78                 Data_list[4].append(value)
    79                 index = 0
    80             value = ""
    81         elif (i == "\n") :
    82             value = ""
    83         else:
    84             value += i
    85     fichier.close()
    86     for i in range(5):
    87         Data_list[i] = float_list(Data_list[i])
    88     Data_list[0] = product_list(Data_list[0],10**-6)
    89     for i in range(1,5):
    90         Data_list[i] = product_list(Data_list[i],1000)
    91     return(Data_list)
    92 
    93 
    94 
    95 
    96 
    97 def print_graph_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(data,lin_reg = None): # program to print graph of X_libera vs X_motor with a list data = [[[x_motor_position][y_motor_position][Va][Vb][Vc][Vd][sum][x_libera_position][y_libera_position]][same for BPM1][same for BPM2]],also do a linear regretion and print the equation
     465(list_data_name,data) = read_data("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")
     466data = convert_data(list_data_name, data)
     467print_graph(list_data_name, data, "x_motor_step", "x_libera_mm",0, color = "r", legende = "BPM_C", lin_reg = "true")
     468print_residu_fr(list_data_name, data, "x_motor_mm", "x_motor_step", 1, color = "r", legende = "BPM_C")
     469"""
     470
     471
     472
     473
     474
     475
     476
     477
     478"""
     479
     480(list_data_name,data) = read_data("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")
     481data = convert_data(list_data_name, data)
     482a,data = moy_rms_data(list_data_name, data, "x_motor_step", "x_libera_mm")
     483#print(data)
     484#print_graph(list_data_name, data, "x_motor_step", "x_libera_mm",0, color = "r", legende = "BPM_C", lin_reg = "true")
     485#print_residu_fr(list_data_name, data, "x_motor_mm", "x_motor_step", 1, color = "r", legende = "BPM_C")
     486"""
     487
     488def oposit_name(list_data_name, data_name):
     489    if data_name[0] == "x":
     490        if "y_motor_step" in list_data_name:
     491            return("y_motor_step")
     492    if data_name[0] == "y":
     493        if "x_motor_step" in list_data_name:
     494            return("x_motor_step")
     495    else:
     496        print("ERROR MULTIPLE LINE")
     497        return("")
     498
     499
     500
     501def 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):
     502    (list_data_name,data) = read_data(fichier)
     503    data = convert_data(list_data_name, data)
    98504    global global_index_figure # to creat different figure
    99     fig1 = plt.figure(global_index_figure)
    100     global_index_figure += 1
    101     plt.clf()
    102     color = ["r","g","b"]
    103     legende = ["BPM soleil","BPM impr","BPM ref"]
    104     for bpm_number in range(len(data)):
    105         plt.plot(data[bpm_number][0],data[bpm_number][7], color[bpm_number]+".", label = legende[bpm_number])
    106         if lin_reg == "yes":
    107             lr1 = stats.linregress(data[bpm_number][0],data[bpm_number][7]) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    108             plt.plot(data[bpm_number][0],[lr1.slope*i + lr1.intercept for i in data[bpm_number][0]], color[bpm_number]+"--", label = legende[bpm_number] + " regression line, \nerror = "+str(round(lr1.stderr,3))+",\ncorrelation coefficient = "+str(round(lr1.rvalue,3)))
    109     plt.legend()
    110     plt.xlabel("length in million motor step") #, fontsize=20)
    111     plt.ylabel("tension in mV")
    112     plt.gca().yaxis.set_tick_params(labelsize = 8)
    113     #plt.show(block = False)
    114        
    115 
    116 
    117 
    118 def print_graph_position_Va_Vb_Vc_Vd(L): # program to print graph of X_libera vs X_motor with a list L = [[position][Va][Vb][Vc][Vd]], also do a linear regretion and print the equation
    119     global global_index_figure # to creat different figure
    120     fig1 = plt.figure(global_index_figure)
    121     global_index_figure += 1
    122     plt.clf()
    123    
    124     lr1 = stats.linregress(L[0],L[1]) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    125     plt.plot(L[0],L[1], "r", label = "BMP_ref")
    126     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)))
    127 
    128     lr2 = stats.linregress(L[0],L[2])
    129     plt.plot(L[0],L[2], "b", label = "BMP_impr")
    130     plt.plot(L[0],[lr2.slope*i + lr2.intercept for i in L[0]], "b--", label = "BMP_impr regression line, \nerror = "+str(round(lr2.stderr,3))+",\ncorrelation coefficient = "+str(round(lr2.rvalue,3)))
    131 
    132     lr3 = stats.linregress(L[0],L[3])
    133     plt.plot(L[0],L[3], "g", label = "BMP_ref")
    134     plt.plot(L[0],[lr3.slope*i + lr3.intercept for i in L[0]], "g--", label = "BMP_ref regression line, \nerror = "+str(round(lr3.stderr,3))+",\ncorrelation coefficient = "+str(round(lr3.rvalue,3)))
    135 
    136     lr4 = stats.linregress(L[0],L[4])
    137     plt.plot(L[0],L[4], "m", label = "BMP_impr")
    138     plt.plot(L[0],[lr4.slope*i + lr4.intercept for i in L[0]], "m--", label = "BMP_impr regression line, \nerror = "+str(round(lr4.stderr,2))+",\ncorrelation coefficient = "+str(round(lr4.rvalue,3)))
    139    
    140     plt.legend()
    141     plt.xlabel("length in million motor step") #, fontsize=20)
    142     plt.ylabel("tension in mV")
    143     plt.gca().yaxis.set_tick_params(labelsize = 8)
    144     #plt.show(block = False)
    145 
    146     #    plt.show()
    147 
    148 def residu_position_Va_Vb_Vc_Vd(L): # program to do graph of residu of data give in a list with [[position][Va][Vb][Vc][Vd]]
    149     global global_index_figure
    150     fig1 = plt.figure(global_index_figure)
    151     global_index_figure += 1
    152     plt.clf()
    153     plt.title("Residu")
    154     lr1 = stats.linregress(L[0],L[1]) # return tuple (pente (.slope),ordonnee a l'origine (.intercept), coef de correlation (.rvalue), p-value (.pvalue ?), erreur standard de l'estimation (.stderr))
    155     for i in range(len(L[1])):
    156         L[1][i] = L[1][i] -  lr1.slope*L[0][i] - lr1.intercept
    157     plt.plot(L[0],L[1], "r", label = "BMP_ref")
    158 
    159     lr2 = stats.linregress(L[0],L[2])
    160     for i in range(len(L[2])):
    161         L[2][i] = L[2][i] -  lr2.slope*L[0][i] - lr2.intercept
    162     plt.plot(L[0],L[2], "b", label = "BMP_impr")
    163 
    164     lr3 = stats.linregress(L[0],L[3])
    165     for i in range(len(L[3])):
    166         L[3][i] = L[3][i] -  lr3.slope*L[0][i] - lr3.intercept
    167     plt.plot(L[0],L[3], "g", label = "BMP_ref")
    168 
    169     lr4 = stats.linregress(L[0],L[4])
    170     for i in range(len(L[4])):
    171         L[4][i] = L[4][i] -  lr4.slope*L[0][i] - lr4.intercept
    172     plt.plot(L[0],L[4], "m", label = "BMP_impr")
    173     plt.legend()
    174     plt.xlabel("length in million motor step")
    175     plt.ylabel("tension in mV")
    176     #plt.show(block = False)
    177 
    178 #    plt.show()
     505    linear_fonction_on_data(list_data_name, data, x_data_name, begin_mm = x_begin_mm, end_mm = x_end_mm)
     506    linear_fonction_on_data(list_data_name, data, y_data_name, begin_mm = y_begin_mm, end_mm = y_end_mm)
     507    data = cut_data(list_data_name, data, x_data_name, inf = x_maximal, equal = x_maximal)
     508    data = cut_data(list_data_name, data, x_data_name, sup = x_minimal, equal = x_minimal)
     509    data = cut_data(list_data_name, data, y_data_name, inf = y_maximal, equal = y_maximal)
     510    data = cut_data(list_data_name, data, y_data_name, sup = y_minimal, equal = y_minimal)
     511    if data == []:
     512        print("cut to high")
     513        return(0)
     514    color_list = ["r","g","b","k","m","c","y"]
     515    if "bpm_name" in list_data_name:
     516        all_bpm_name = all_value_of_data(list_data_name, data, "bpm_name")
     517        while len(all_bpm_name) > len(color_list):
     518            color_list += color_list
     519        oposit_y_data_name = oposit_name(list_data_name, y_data_name)
     520        oposit_y_data_number = number_of_data_name(list_data_name, oposit_y_data_name)
     521        if oposit_y_data_number == "":
     522            for bpm_number in range(len(all_bpm_name)):
     523                print_graph_fr(list_data_name, cut_data(list_data_name, data, "bpm_name", equal =  all_bpm_name[bpm_number]), x_data_name, y_data_name, global_index_figure, color = color_list[bpm_number], legende = all_bpm_name[bpm_number], lin_reg = lin_reg, rms = rms, centrage = centrage)
     524                if not(residu is None):
     525                    print_residu_fr(list_data_name,  cut_data(list_data_name, data, "bpm_name", equal = all_bpm_name[bpm_number]), x_data_name, y_data_name, global_index_figure + 1, color_list[bpm_number], legende = all_bpm_name[bpm_number], rms = rms, centrage = centrage)
     526            global_index_figure += 2
     527        else:
     528            all_oposit_y_value = all_value_of_data(list_data_name, data,oposit_y_data_name)
     529            for index_value in range(len(all_oposit_y_value)):
     530                data_cut =  cut_data(list_data_name, data, oposit_y_data_name, equal = all_oposit_y_value[index_value])
     531                for bpm_number in range(len(all_bpm_name)):
     532                    #print(cut_data(list_data_name, data_cut, "bpm_name", equal =  all_bpm_name[bpm_number]))
     533                    print_graph_fr(list_data_name, cut_data(list_data_name, data_cut, "bpm_name", equal =  all_bpm_name[bpm_number]), x_data_name, y_data_name, global_index_figure + 2*index_value, color = color_list[bpm_number], legende = all_bpm_name[bpm_number], lin_reg = lin_reg, rms = rms, title = oposit_y_data_name + " = " + str(all_oposit_y_value[index_value]), centrage = centrage)
     534                    if not(residu is None):
     535                        print_residu_fr(list_data_name, cut_data(list_data_name, data_cut, "bpm_name", equal = all_bpm_name[bpm_number]), x_data_name, y_data_name, global_index_figure + 2*index_value + 1, color_list[bpm_number], legende = all_bpm_name[bpm_number], rms = rms, title = oposit_y_data_name + " = " + str(all_oposit_y_value[index_value]), centrage = centrage)
     536            global_index_figure += 2*len(all_oposit_y_value)
     537    else: # need to be done, same as befor with "bpm_number" to replace "bpm_name"
     538        print("ERROR TYPE OF DATA")
     539
     540# ettendre linge
     541
     542#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")
     543
     544graph_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
     546graph_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
     550
     551
     552
     553#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",x_minimal = -10, x_maximal = -20)#need data complete
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571   
     572#print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_1.txt",  miny = 0, maxy = 57)
     573#print_residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_1.txt")
     574
     575#print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_2_convert-100000_94,36_100000_78,72.txt", begin_mm = 78.72, end_mm = 94.36)
     576#print_residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_2_convert-100000_94,36_100000_78,72.txt")
     577
     578#print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/test.txt", begin_mm = 100)
     579#print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/test.txt, begin_mm = 0, end_mm = 1")
     580#print_residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/test.txt")
     581
     582
     583#print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_160153_0.txt",0.1,0.3)
     584#print_residu_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_160153_0.txt",0.1,0.3)
     585#print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_163036_0.txt")
     586#print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
     587#print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
     588#plt.show(block = False)
     589plt.show()
     590
    179591   
    180592"""   
     
    185597    plt.show()
    186598"""
    187 
    188 
    189 
    190 
    191 
    192 
    193 
    194 def residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(data): # program to print graph of X_libera vs X_motor with a list data = [[[x_motor_position][y_motor_position][Va][Vb][Vc][Vd][sum][x_libera_position][y_libera_position]][same for BPM1][same for BPM2]],also do a linear regretion and print the equation
    195     global global_index_figure # to creat different figure
    196     fig1 = plt.figure(global_index_figure)
    197     global_index_figure += 1
    198     plt.clf()
    199     color = ["r","g","b"]
    200     legende = ["BPM soleil","BPM impr","BPM ref"]
    201     for bpm_number in range(len(data)):
    202         lr1 = stats.linregress(data[bpm_number][0],data[bpm_number][7]) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    203     #    residu = product_list(data[bpm_number][7], lr1.slope, b =  lr1.intercept)
    204         residu = []
    205         for i in range(len(data[bpm_number][0])):
    206             residu.append(abs(data[bpm_number][7][i] - data[bpm_number][0][i]*lr1.slope - lr1.intercept))
    207         plt.plot(data[bpm_number][0], residu, color[bpm_number]+".", label = legende[bpm_number])
    208     plt.legend()
    209     plt.title("Residu en fonction de la position")
    210     plt.xlabel("length in million motor step")
    211     plt.ylabel("tension in mV")
    212     plt.gca().yaxis.set_tick_params(labelsize = 8)
    213     #plt.show(block = False)
    214 
    215     #    plt.s
    216 
    217 
    218 
    219 
    220 
    221 def min_max(data, cut_index, mini = None ,maxi = None): #program to cut a list data = [[position][Va][Vb][Vc][Vd]] with minimum value of position = mini and maximum value of position = maxi
    222     if mini is None and maxi is None :
    223         return(data)
    224     elif mini is None :
    225         for i in data[cut_index]:
    226             if i < mini :
    227                 mini = i
    228     elif maxi is None:
    229         for i in data[cut_index]:
    230             if maxi < i :
    231                 maxi = i
    232     index_list = []
    233     for i in range(len(data[cut_index])):
    234         if  data[cut_index][i] >= mini and data[cut_index][i] <= maxi :
    235             index_list.append(i)
    236     return([[data[j][i] for i in index_list] for j in range(len(data))])
    237 
    238             #return([[data[0][i] for i in index_list],[data[1][i] for i in index_list],[data[2][i] for i in index_list],[data[3][i] for i in index_list],[data[4][i] for i in index_list]])
    239 
    240 
    241 def convertion_step_mm(data,begin_mm,end_mm): # length convertion
    242 #    print(data)
    243     if begin_mm is None:
    244         begin_mm = data[0]
    245     if end_mm is None:
    246         end_mm = data[len(data)-1]
    247     begin_step = data[0]
    248     end_step = data[len(data)-1]
    249     a = float((end_mm - begin_mm))/(end_step - begin_step)
    250     b = begin_mm - a*begin_step
    251     print(a,b)
    252     data = product_list(data, a, b)
    253     return(data)
    254    
    255 
    256 #L = [[i for i in range(51)] for j in range(5)]
    257 #print(convertion_step_mm(L[0],3.1,44520))
    258 
    259    
    260 def print_data_position_Va_Vb_Vc_Vd(fichier, min = None, max = None):
    261     L = min_max(read_data_position_Va_Vb_Vc_Vd(fichier), 0, mini = min, maxi = max)
    262     print_graph_position_Va_Vb_Vc_Vd(L)
    263     #print(L)
    264 
    265 def print_residu_position_Va_Vb_Vc_Vd(fichier, min_position = None, max_position = None):
    266     L = min_max(read_data_position_Va_Vb_Vc_Vd(fichier), 0, mini = min_position, maxi = max_position)
    267     residu_position_Va_Vb_Vc_Vd(L)
    268    
    269 def print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(fichier, lin_reg = "yes", minx = None, maxx = None, miny = None, maxy = None, begin_mm = None, end_mm = None):
    270     data = read_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(fichier)
    271     if (not minx is None) or (not maxx is None):
    272         data =  [min_max(bpm, 0, mini = minx, maxi = maxx) for bpm in data]
    273     if (not miny is None) or (not maxy is None):
    274         data =  [min_max(bpm, 1, mini = miny, maxi = maxy) for bpm in data]
    275     if (not begin_mm is None) or (not end_mm is None):
    276         for bpm_index in range(len(data)):
    277             data[bpm_index][0] = convertion_step_mm(data[bpm_index][0], (begin_mm - end_mm)/2, (-begin_mm +  end_mm)/2)
    278     print_graph_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(data,lin_reg)
    279    
    280 def print_residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(fichier, minx = None, maxx = None, miny = None, maxy = None):
    281     data = read_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(fichier)
    282     if (not minx is None) or (not maxx is None):
    283         data =  [min_max(bpm, 0, mini = minx, maxi = maxx) for bpm in data]
    284     if (not miny is None) or (not maxy is None):
    285         data =  [min_max(bpm, 1, mini = miny, maxi = maxy) for bpm in data]
    286     residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y(data)
    287 
    288 #print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_1.txt",  miny = 0, maxy = 57)
    289 #print_residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_1.txt")
    290 
    291 print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_2_convert-100000_94,36_100000_78,72.txt", begin_mm = 78.72, end_mm = 94.36)
    292 #print_residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/BPM-number_x-motor_y-motor_Va_Vb_Vc_Vd_Sum_X_Y_BPM0-soleil_BPM1-impr_BPM2-ref_20180718_2_convert-100000_94,36_100000_78,72.txt")
    293 
    294 #print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/test.txt", begin_mm = 100)
    295 #print_data_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/test.txt, begin_mm = 0, end_mm = 1")
    296 #print_residu_xmotor_ymotor_Va_Vb_Vc_Vd_sum_x_y("data/test.txt")
    297 
    298 
    299 #print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_160153_0.txt",0.1,0.3)
    300 #print_residu_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_160153_0.txt",0.1,0.3)
    301 #print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_163036_0.txt")
    302 #print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
    303 #print_data_position_Va_Vb_Vc_Vd("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
    304 #plt.show(block = False)
    305 plt.show()
    306 
Note: See TracChangeset for help on using the changeset viewer.