{"id":320002,"date":"2021-03-22T09:00:07","date_gmt":"2021-03-22T09:00:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320002"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320002","title":{"rendered":"\u0421\u0442\u0443\u0434\u0435\u043d\u0442\u044b, \u043b\u0430\u0431\u044b \u0438 python: \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4f4\/4f5\/b7d\/4f44f5b7dda48ab6b0b523aa2ef703eb.png\" width=\"751\" height=\"211\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/546956\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435<\/a> \u043d\u0430 \u0442\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"http:\/\/gnuplot.info\/\" rel=\"noopener noreferrer nofollow\">gnuplot<\/a> \u2013 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u043c\u043e\u0449\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c gnuplot, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0438\u0437\u0443\u0447\u0430\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0444\u0435\u0440\u0435. \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.python.org\/\" rel=\"noopener noreferrer nofollow\">python<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a <a href=\"https:\/\/www.scipy.org\/index.html\" rel=\"noopener noreferrer nofollow\">scipy<\/a> \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 <a href=\"https:\/\/matplotlib.org\/\" rel=\"noopener noreferrer nofollow\">matplotlib<\/a> \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. <\/p>\n<hr>\n<p>\u0412\u043e\u0437\u044c\u043c\u0451\u043c \u0442\u043e\u0442 \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e \u0438 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/546956\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0435<\/a>, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0421 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 python, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043b\u0435\u0433\u043a\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">from random import normalvariate from math   import pi, cos  GtoR, Uo, To, D, B = pi\/180., 0.7, 56.0, 1.0, 0.02  def U(T):      return Uo * cos(GtoR*(T + normalvariate(0.0, D) - To))**2 + B   with open('pyexp.dat', 'w') as fp:   for T in range(0,360,10):      fp.write('{:5.1f}  {:5.3f}\\n'.format(T, U(T)))<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0432 python \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0430-\u043b\u044f csv \u0438\u043b\u0438 pandas \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0434\u0435\u0440\u0436\u0438\u043c\u0441\u044f \u043e\u0442 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430 <a href=\"https:\/\/numpy.org\/\" rel=\"noopener noreferrer nofollow\">numpy<\/a> (\u0435\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 matplotlib). \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 python-\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">from math           import pi, cos, sin   # \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 from scipy.optimize import curve_fit      # \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 from scipy.special  import gammainc       # \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c p-value from matplotlib     import pyplot as plt  # \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432  GtoR = pi\/180.   angle, experiment = [], []  with open('pyexp.dat','r') as fp:  data = fp.readlines() for row in data:   a, u = row.strip().split()   angle.append(GtoR*float(a))     experiment.append(float(u))    def U(X, Uo, To, B): # \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f   Y = []   for x in X: Y.append(Uo * cos(x - To)**2 + B )   return Y  def V(X, Uo, To, D): # \u0415\u0451 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f   Y = []   for x in X: Y.append(abs(D*(Uo * sin(2*(To - x)))))   return Y  # \u041f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 \u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 popt, pcov = curve_fit(U, angle, experiment, p0 = [0.7, 1.0, 0.01], bounds=(0.0, [1., 180., 0.5]))  # \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0443\u0433\u043b\u043e\u0432 (1 \u0433\u0440\u0430\u0434\u0443\u0441) \u0432 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0439  errors = V(angle, popt[0], popt[1], 1.0*GtoR)  # \u041f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a popt, pcov = curve_fit(U, angle, experiment, p0 = popt, sigma=errors, absolute_sigma=True)  # \"\u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c\" \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 theory = U(angle, *popt) Chi2, NDF = 0.0, len(angle)-len(popt) for p in range(len(angle)): Chi2 += ((theory[p]-experiment[p])\/errors[p])**2 pvalue = 1 - gammainc(0.5*NDF, 0.5*Chi2) # gammainc - regularized upper incomplete gamma function To, dTo = popt[1]\/GtoR, pcov[1][1]**0.5\/GtoR tlabel  = '\u0442\u0435\u043e\u0440\u0438\u044f: '  tlabel += r'$\\chi^2\/NDF$ = {:.1f}\/{:2d}'.format(Chi2,NDF) tlabel += '\\nP-value = {:.2f}%'.format(100*pvalue)  theta   = [GtoR*i for i in range(0,360)] # \u0447\u0442\u043e\u0431\u044b \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0431\u0435\u0437 \u0438\u0437\u043b\u043e\u043c\u043e\u0432  plt.rc('grid', color='#316931', linewidth=0.5, linestyle='-.') fig = plt.figure(figsize=(8, 8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], projection='polar', facecolor='#fffff0') ax.set_title('\u041f\u043e\u0432\u043e\u0440\u043e\u0442 \u043e\u0441\u0438 \u043f\u043e\u043b\u044f\u0440\u043e\u0438\u0434\u0430: ' + r'$\\theta_0={:.2f}^\\circ\\pm{:.2f}^\\circ$'.format(To, dTo)+'\\n') ax.plot(angle, experiment, 'ro', label='\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442') ax.plot(theta, U(theta, *popt), 'b-', label = tlabel) ax.legend() plt.show() <\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b matplotlib \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u0442 \u043d\u0430\u043c \u0433\u0440\u0430\u0444\u0438\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439) \u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ec\/455\/d71\/8ec455d71b75afad68623c401014a059.png\" width=\"1011\" height=\"905\"><figcaption><\/figcaption><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u00ab\u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432\u00bb  \u2013 <br \/>\u0443\u0434\u0430\u0440\u043d\u0443\u044e \u0442\u0440\u043e\u0439\u043a\u0443 \u00abpython + scipy + matplotlib\u00bb \u0432\u043c\u0435\u0441\u0442\u043e gnuplot. \u0418 \u0434\u0430, \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0438, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 python \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u00ab\u0434\u043e\u0437\u0432\u043e\u043b\u0435\u043d\u043d\u043e\u0433\u043e\u00bb \u043f\u043e\u0447\u0442\u0438 \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438. \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 gnuplot-\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u043e\u0432\u044b:<\/p>\n<ol>\n<li>\n<p>\u041d\u0435\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0442\u0440\u0443\u0434\u043d\u0435\u0435, \u0447\u0435\u043c \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0430\u043a\u0435\u0442\u043e\u043c gnuplot. <\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 scipy \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c. \u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f: \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, <img decoding=\"async\" class=\"formula inline\" source=\"\\chi^2\" alt=\"\\chi^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bbe\/ee7\/f87\/bbeee7f87dc9bfdf1110f456010cb305.svg\">\u2013 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f p-value \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0433\u0430\u043c\u043c\u0430-\u0444\u0443\u043d\u043a\u0446\u0438\u044e. <\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 matplotlib \u0432\u0435\u0441\u044c\u043c\u0430 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0430, \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u2013 \u043d\u0430 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044f, \u0438 \u0435\u0449\u0451 \u2013 \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 (\u0443\u0441\u044b) \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0432 \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/548280\/\"> https:\/\/habr.com\/ru\/post\/548280\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"bordered full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/546956\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435<\/a> \u043d\u0430 \u0442\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"http:\/\/gnuplot.info\/\" rel=\"noopener noreferrer nofollow\">gnuplot<\/a> \u2013 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u043c\u043e\u0449\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c gnuplot, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0438\u0437\u0443\u0447\u0430\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0438\u0445 \u0431\u043e\u043b\u0435\u0435 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0444\u0435\u0440\u0435. \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 <a href=\"https:\/\/www.python.org\/\" rel=\"noopener noreferrer nofollow\">python<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a <a href=\"https:\/\/www.scipy.org\/index.html\" rel=\"noopener noreferrer nofollow\">scipy<\/a> \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 <a href=\"https:\/\/matplotlib.org\/\" rel=\"noopener noreferrer nofollow\">matplotlib<\/a> \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. <\/p>\n<hr>\n<p>\u0412\u043e\u0437\u044c\u043c\u0451\u043c \u0442\u043e\u0442 \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e \u0438 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/546956\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0435<\/a>, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0421 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 python, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043b\u0435\u0433\u043a\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">from random import normalvariate from math   import pi, cos  GtoR, Uo, To, D, B = pi\/180., 0.7, 56.0, 1.0, 0.02  def U(T):      return Uo * cos(GtoR*(T + normalvariate(0.0, D) - To))**2 + B   with open('pyexp.dat', 'w') as fp:   for T in range(0,360,10):      fp.write('{:5.1f}  {:5.3f}\\n'.format(T, U(T)))<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0432 python \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0430-\u043b\u044f csv \u0438\u043b\u0438 pandas \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0434\u0435\u0440\u0436\u0438\u043c\u0441\u044f \u043e\u0442 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430 <a href=\"https:\/\/numpy.org\/\" rel=\"noopener noreferrer nofollow\">numpy<\/a> (\u0435\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 matplotlib). \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 python-\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">from math           import pi, cos, sin   # \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 from scipy.optimize import curve_fit      # \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 from scipy.special  import gammainc       # \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c p-value from matplotlib     import pyplot as plt  # \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432  GtoR = pi\/180.   angle, experiment = [], []  with open('pyexp.dat','r') as fp:  data = fp.readlines() for row in data:   a, u = row.strip().split()   angle.append(GtoR*float(a))     experiment.append(float(u))    def U(X, Uo, To, B): # \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f   Y = []   for x in X: Y.append(Uo * cos(x - To)**2 + B )   return Y  def V(X, Uo, To, D): # \u0415\u0451 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f   Y = []   for x in X: Y.append(abs(D*(Uo * sin(2*(To - x)))))   return Y  # \u041f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 \u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 popt, pcov = curve_fit(U, angle, experiment, p0 = [0.7, 1.0, 0.01], bounds=(0.0, [1., 180., 0.5]))  # \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0443\u0433\u043b\u043e\u0432 (1 \u0433\u0440\u0430\u0434\u0443\u0441) \u0432 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0439  errors = V(angle, popt[0], popt[1], 1.0*GtoR)  # \u041f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a popt, pcov = curve_fit(U, angle, experiment, p0 = popt, sigma=errors, absolute_sigma=True)  # \"\u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c\" \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 theory = U(angle, *popt) Chi2, NDF = 0.0, len(angle)-len(popt) for p in range(len(angle)): Chi2 += ((theory[p]-experiment[p])\/errors[p])**2 pvalue = 1 - gammainc(0.5*NDF, 0.5*Chi2) # gammainc - regularized upper incomplete gamma function To, dTo = popt[1]\/GtoR, pcov[1][1]**0.5\/GtoR tlabel  = '\u0442\u0435\u043e\u0440\u0438\u044f: '  tlabel += r'$\\chi^2\/NDF$ = {:.1f}\/{:2d}'.format(Chi2,NDF) tlabel += '\\nP-value = {:.2f}%'.format(100*pvalue)  theta   = [GtoR*i for i in range(0,360)] # \u0447\u0442\u043e\u0431\u044b \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0431\u0435\u0437 \u0438\u0437\u043b\u043e\u043c\u043e\u0432  plt.rc('grid', color='#316931', linewidth=0.5, linestyle='-.') fig = plt.figure(figsize=(8, 8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], projection='polar', facecolor='#fffff0') ax.set_title('\u041f\u043e\u0432\u043e\u0440\u043e\u0442 \u043e\u0441\u0438 \u043f\u043e\u043b\u044f\u0440\u043e\u0438\u0434\u0430: ' + r'$\\theta_0={:.2f}^\\circ\\pm{:.2f}^\\circ$'.format(To, dTo)+'\\n') ax.plot(angle, experiment, 'ro', label='\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442') ax.plot(theta, U(theta, *popt), 'b-', label = tlabel) ax.legend() plt.show() <\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b matplotlib \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u0442 \u043d\u0430\u043c \u0433\u0440\u0430\u0444\u0438\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439) \u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u00ab\u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432\u00bb  \u2013 <br \/>\u0443\u0434\u0430\u0440\u043d\u0443\u044e \u0442\u0440\u043e\u0439\u043a\u0443 \u00abpython + scipy + matplotlib\u00bb \u0432\u043c\u0435\u0441\u0442\u043e gnuplot. \u0418 \u0434\u0430, \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0438, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 python \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u00ab\u0434\u043e\u0437\u0432\u043e\u043b\u0435\u043d\u043d\u043e\u0433\u043e\u00bb \u043f\u043e\u0447\u0442\u0438 \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438. \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 gnuplot-\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0442\u0430\u043a\u043e\u0432\u044b:<\/p>\n<ol>\n<li>\n<p>\u041d\u0435\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0442\u0440\u0443\u0434\u043d\u0435\u0435, \u0447\u0435\u043c \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0430\u043a\u0435\u0442\u043e\u043c gnuplot. <\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 scipy \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c. \u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f: \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u2013 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f p-value \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0433\u0430\u043c\u043c\u0430-\u0444\u0443\u043d\u043a\u0446\u0438\u044e. <\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 matplotlib \u0432\u0435\u0441\u044c\u043c\u0430 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0430, \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u2013 \u043d\u0430 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044f, \u0438 \u0435\u0449\u0451 \u2013 \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 (\u0443\u0441\u044b) \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0432 \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/548280\/\"> https:\/\/habr.com\/ru\/post\/548280\/<\/a><br \/><\/br><\/br><\/hr>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320002","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320002"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320002\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}