Changeset 793 in ETALON


Ignore:
Timestamp:
Aug 7, 2018, 11:20:09 AM (6 years ago)
Author:
delerue
Message:

Minor bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BPM/print_datas.py

    r792 r793  
    265265        plt.errorbar(X,Y,yerr = rms, ecolor = color)
    266266    if not(lin_reg is None):
    267         lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     267        slope, intercept, r_value, p_value, std_err = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    268268        if legende is None:
    269             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)))
     269            plt.plot(X,[slope*i + intercept for i in X], color+"--", label =  " regression lineaire, \nerreur = "+str(round(std_err,3))+",\ncoefficient de correlation = "+str(round(r_value,3)) + "\npente de la regression lineaire = " + str(round(slope,3)))
    270270        else:
    271             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)))
    272             plt.legend(fontsize=15)
     271            plt.plot(X,[slope*i + intercept for i in X], color+"--", label = legende + " : regression lineaire, \nerreur = "+str(round(std_err,3))+",\ncoefficient de correlation  = "+str(round(r_value,3))+ "\npente de la regression lineaire = " + str(round(slope,3)))           
     272    plt.legend(fontsize=15)
    273273    x_label = plot_legend_fr(x_data_name)
    274274    y_label = plot_legend_fr(y_data_name)
     
    356356        plt.errorbar(X,Y,yerr = rms, ecolor = color)
    357357    if not(lin_reg is None):
    358         lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     358        slope, intercept, r_value, p_value, std_err = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    359359        if legende is None:
    360             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)))
     360            plt.plot(X,[slope*i + intercept for i in X], color+"--", label =  "linear regression, \nerror = "+str(round(std_err,3))+",\ncorrelation coefficient = "+str(round(r_value,3)) + "\nslope = " + str(round(slope,3)))
    361361        else:
    362             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)))
     362            plt.plot(X,[slope*i + intercept for i in X], color+"--", label = legende + " : lineare regression, \nerror = "+str(round(std_err,3))+",\ncorrelation coefficient = "+str(round(r_value,3))+ "\nslope = " + str(round(slope,3)))
    363363            plt.legend(fontsize=15)
    364364    x_label = plot_legend(x_data_name)
     
    394394    if y_data_name == "x_motor_step" or y_data_name == "y_motor_step":
    395395        Y = [i[y_data_number]/1000000. for i in data]
    396     lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     396    slope, intercept, r_value, p_value, std_err = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    397397    for index in range(len(Y)):
    398         Y[index] = abs(Y[index] - (lr1.slope*X[index] + lr1.intercept))
     398        Y[index] = abs(Y[index] - (slope*X[index] + intercept))
    399399    if legende is None:
    400400        plt.plot(X,Y, color+".")
     
    441441    if y_data_name == "x_motor_step" or y_data_name == "y_motor_step":
    442442        Y = [i[y_data_number]/1000000. for i in data]
    443     lr1 = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     443    slope, intercept, r_value, p_value, std_err = stats.linregress(X,Y) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    444444    moyenne = 0
    445445    len_Y = len(Y)
    446446    for index in range(len_Y):
    447         Y[index] = abs(Y[index] - (lr1.slope*X[index] + lr1.intercept))
     447        Y[index] = abs(Y[index] - (slope*X[index] + intercept))
    448448        moyenne += Y[index]/len_Y
    449449    if legende is None:
     
    570570
    571571#graph_fr("/Users/delerue/Downloads/BPM_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_test_decrochage_BPM0-E_BPM1-impr_BPM2-C_High_Stat_20180803_2.txt", "y_motor_step", "y_libera_mm",lin_reg = "true", residu = "yes", rms = "yes")#, centrage = "yes", y_minimal = -20., y_maximal = -10.)
    572 graph_fr("/Users/delerue/Downloads/BPM_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_test_decrochage_BPM0-E_BPM1-impr_BPM2-C_High_Stat_20180803_2.txt", "y_motor_step", "y_libera_mm",lin_reg = None, residu = None, rms = "yes" )#, centrage = "yes", y_minimal = -20., y_maximal = -10.)
     572graph_fr("/Users/delerue/Downloads/BPM_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_test_decrochage_BPM0-E_BPM1-impr_BPM2-C_High_Stat_20180803_2.txt", "y_motor_step", "y_libera_mm",lin_reg = "yes", residu = "yes", rms = "yes" )#, centrage = "yes", y_minimal = -20., y_maximal = -10.)
    573573
    574574#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")
Note: See TracChangeset for help on using the changeset viewer.