Esempio n. 1
0
def CK():
    name = path.abspath('..' + '\\rec\\111.5.tsv')
    f, Aout = parsing(name, 0, 1)
    Ain = 3 / 2
    Aout = Aout / 2
    fig1 = figure()
    # title(r'Эммитерный повторитель')
    semilogx(f, Aout / Ain, 'r.', label='эксперимент')

    grid(which='major', linestyle='-')
    grid(which='minor', linestyle=':')
    minorticks_on()
    ylabel(r'$K,\text{отн.ед.}$', fontsize=16)
    xlabel(r'$\nu, \text{Гц}$', fontsize=16)
    ylim((0, 1.1))

    legend(loc='lower right')
    savefig(path.abspath('..' + '\\fig\\111_5.pdf'))

    name = path.abspath('..' + '\\rec\\111.3.tsv')

    Aout, Ain = parsing(name, 1, 0)
    Aout, Ain = Aout / 2, Ain / 2
    fig2 = figure()
    z = polyfit(Ain, Aout, 1)
    print(z[0])
    z = poly1d(z)
    x = linspace(Ain[0], Ain[-1], 100)
    y = z(x)
    plot(x, y, label='аппроксимация', color='darkblue')
    plot(Ain, Aout, 'r.', label='эксперимент')

    ylabel(r'$U^m_{\text{вых}}, \text{мВ}$', fontsize=16)
    xlabel(r'$U^m_{\text{вх}}, \text{мВ}$', fontsize=16)
    grid(which='major', linestyle='-')
    grid(which='minor', linestyle=':')
    minorticks_on()
    legend()
    savefig(path.abspath('..' + '\\fig\\111_3.pdf'))
    show()
Esempio n. 2
0

import numpy as np

from matplotlib import rc
rc('text', usetex=True)
rc('font', size=14)
rc('legend', fontsize=13)
rc('text.latex', preamble=r'\usepackage{cmbright}')
import matplotlib.pyplot as plt
from functions import parsing
x,y=parsing('filters1.tsv',0,2)

plt.plot(x,y)
plt.title('PFC',fontsize=16) 
plt.ylabel('$I_a$,A',fontsize=16) 
plt.xlabel('$\\varphi_y$,V',fontsize=16) 
plt.grid () 
plt.plot(x,y,'ko',markersize=2) 
plt.plot(x,y)
# plt.xticks([i for i in range(0,10,1)]) # Х-сетка
# plt.yticks([i for i in range(0,10,1)]) # Y-сетка

# plt.errorbar(x, y, yerr=0.1) #Погрешности
# plt.gca().xaxis.set_major_formatter(FuncFormatter(lambda x, _: int(x))) #???
# plt.xlim([0,5]) # Пределы оси
# plt.ylim([0,5]) #
# plt.savefig('filters1.pdf')
plt.show()

# Надписи
Esempio n. 3
0
import numpy as np
from functions import parsing
import csv
import matplotlib.pyplot as plt
name = 'rec\\2000.tsv'
x, y = parsing(name, 0, 1)
# plt.plot(x,y,'b')
plt.plot(x, y, 'ro')
a = 108
b = 78.33
f = a * x**2 + b * x
plt.plot(x, f)
plt.ylabel('$J$,мА', fontsize=12)
plt.xlabel('$I(d^2)$, у.е.', fontsize=12)
plt.grid()
plt.savefig('2000.pdf')
plt.show()
Esempio n. 4
0
from pylab import *
from functions import parsing
import os.path as path
from scipy.signal import medfilt
from scipy import interpolate
img = path.abspath('..' + '\\img\\DSC_0021 (1).txt')
x, y = parsing(img, 0, 1)
y = medfilt(y, 3)
plot(x, y)
show()
Esempio n. 5
0
import numpy as np
from functions import parsing
import matplotlib.pyplot as plt

name = 'rec\\n4.tsv'
f, I = parsing(name, 1, 2)

c = 299792458  #м/с
e = 1.60217662 * 10**(-19)  # Кл
h = 6.62607004081 * 10**-34
pi = 3.14159265
I = I / 17
print(f[1])
x = np.array([f[1] - 0.001, f[1], f[1] + 0.001])
y = np.array([0, I[1], 0])
plt.plot(x, y, 'r')
print(f[0])
x = np.array([f[0] - 0.001, f[0], f[0] + 0.001])
y = np.array([0, I[0], 0])
plt.plot(x, y, 'r')
print(f[2])
x = np.array([f[2] - 0.001, f[2], f[2] + 0.001])
y = np.array([0, I[2], 0])
plt.plot(x, y, 'r')
print(f[3])
x = np.array([f[3] - 0.001, f[3], f[3] + 0.001])
y = np.array([0, I[3], 0])
plt.plot(x, y, 'r')
# plt.plot(f,I,'*')

plt.ylabel('I, отн.е.', fontsize=12)
Esempio n. 6
0
import numpy as np
from functions import parsing
import matplotlib.pyplot as plt
name = 'rec\\n2.tsv'

l, I = parsing(name, 0, 1)
#из графика для ртутной лампы по 4 точкам соотнесли градусы на шкале с длинами волн


def f(x):  #x-- градусы
    p1 = -3.668 * 10**(7)
    p2 = -9.329 * 10**(9)
    p3 = 7.457 * 10**(14)
    f = p1 * x**2 + p2 * x + p3
    return f


x = np.arange(200, 3500, 1)
plt.plot(x, f(x))
plt.grid()
plt.ylabel('$\\nu$, Гц', fontsize=12)
plt.xlabel('градусы на монохроматоре', fontsize=12)  #
plt.savefig('podgon.pdf')
plt.show()

c = 299792458
freq = f(l)
plt.figure('Задание 5.2')
plt.plot(freq, I, 'b')
plt.plot(freq, I, 'ro')
plt.ylabel('$I_ф$,мА', fontsize=12)
Esempio n. 7
0
from math import pi
import os.path as path
import sys
rc('text', usetex=True)
rc('text.latex',
   preamble=[
       r'\usepackage[russian]{babel}', r'\usepackage{amsmath}',
       r'\usepackage{amssymb}'
   ])

rc('font', family='serif')

concentration = path.abspath('..' + '\\scripts\\concentration.txt')
density = path.abspath('..' + '\\scripts\\density.txt')

t, freq1 = parsing(concentration, 1, 0)
r, freq2 = parsing(density, 1, 0)
omegares = array(freq1 * 2 * pi * 10**9)
omegares1 = array(freq2 * 2 * pi * 10**9)

t = np.array(t)


def N(omegap):
    N = m * omegap**2 / (4 * pi * e**2)
    return N


# print(lam)
# omega-- плазменная частота
# omega0res-- собственная частота резонатора в отсутствии плазмы в рад/с
Esempio n. 8
0
import numpy as np
from functions import parsing
import matplotlib.pyplot as plt
name = 'rec\\n3.tsv'
l, V = parsing(name, 0, 1)


def f(x):  #x-- градусы
    p1 = -3.668 * 10**(7)
    p2 = -9.329 * 10**(9)
    p3 = 7.457 * 10**(14)
    f = p1 * x**2 + p2 * x + p3
    return f


# plt.plot(l,V)
# plt.show()
x = f(l)
print(x)
plt.plot(f(l), V, 'r.')
plt.ylabel('$V_з$,мА', fontsize=16)
plt.xlabel('$\\nu, 10^{14}$Гц', fontsize=12)
# yerror=V*0.01
# # plt.errorbar(yerr=yerror) #Погрешности
# e=1.60217662*10**-19 #Кулона
# k= 8.307
# b= -25.26
# h=6.28*k*10**-6*e
# plt.plot(x,k*x+b)
# print('Постоянная Планка h=',h) #Херня конечно, но вдруг так и есть
# plt.grid()
Esempio n. 9
0
def CE():
    C_off = path.abspath('..' + '\\rec\\3.C_off.tsv')
    C_on = path.abspath('..' + '\\rec\\3.C_on.tsv')
    Aout, Ain = parsing(C_off, 1, 0)
    Aout, Ain = Aout / 2, Ain / 2 / 1000
    figOff3 = figure('3.C_off')
    ylabel(r'$U^m_{\text{вых}}, \text{В}$', fontsize=16)
    xlabel(r'$U^m_{\text{вх}}, \text{мВ}$', fontsize=16)
    grid(which='major', linestyle='-')
    grid(which='minor', linestyle=':')
    minorticks_on()

    z = polyfit(Ain[1:-1] * 1000, Aout[1:-1], 1)
    print(z[0])
    z = poly1d(z)
    x = linspace(Ain[0] * 1000, Ain[-1] * 1000, 1000)
    y = z(x)

    plot(x, y, label=r'$C_{\text{Э}}$ выключен')
    plot(Ain * 1000, Aout, '.')
    Aout, Ain = parsing(C_on, 1, 0)
    Aout, Ain = Aout / 2, Ain / 2 / 1000
    z = polyfit(Ain[6:-1] * 1000, Aout[6:-1], 1)
    print(z[0])
    z = poly1d(z)
    x = linspace(Ain[0] * 1000, Ain[-1] * 1000, 1000)
    y = z(x)

    plot(x, y, label=r'$C_{\text{Э}}$ включен', color='darkblue')
    plot(Ain * 1000, Aout, 'r.')
    legend()
    savefig(path.abspath('..' + '\\fig\\3.pdf'))
    show()

    C_off = path.abspath('..' + '\\rec\\5.C_off_new.tsv')
    C_on = path.abspath('..' + '\\rec\\5.C_on.tsv')

    f, Aout = parsing(C_off, 0, 1)
    Ain = 0.1 / 2
    Aout = Aout / 2

    figOff = figure('5')
    g = interpolate.interp1d(f, Aout / Ain, 'cubic')
    x = linspace(20, 200 * 10**3, 10000)

    plot(x, g(x), label=r'$C_\text{э}$ выключен', color='olivedrab')
    semilogx(f, Aout / Ain, '.')

    grid(which='major', linestyle='-')
    grid(which='minor', linestyle=':')
    minorticks_on()
    ylabel(r'$K,\text{отн.ед.}$', fontsize=16)
    xlabel(r'$\nu, \text{Гц}$', fontsize=16)

    f, Aout = parsing(C_on, 0, 1)
    Ain = 0.1 / 2
    Aout = Aout / 2
    g = interpolate.interp1d(f, Aout / Ain, 'quadratic')
    x = linspace(20, 200 * 10**3, 100000)
    plot(x, g(x), '-.', label=r'$C_\text{э}$ включен', color='darkblue')
    semilogx(f, Aout / Ain, 'r.')
    legend()
    savefig(path.abspath('..' + '\\fig\\5.pdf'))