Exemplo n.º 1
0
def plothist(base, value, x, y, mean, median, std, stdAbs):
	ax= plt.subplot2grid((4,3),(1,1),colspan=1)
	font=20
	plt.plot(base[:-1],value,c='blue')	
	plt.plot(x,y,'--',c='red')
	plt.xlabel(r'$\mathtt{Contagens \; (adu)}$',size=font)
	plt.ylabel(r'$\mathtt{Frequ\^encia\;}$'+'(%)',size=font)
	plt.title(r'$\mathtt{Histograma \quad da \quad imagem \quad combinada}$',size=font)

	
	f = interp1d(base[:-1], value, kind='cubic')	
	x16 = mean-std
	x50 = mean
	x84 = mean+std	

	index16 = returnIndex(x,x16)
	index84 = returnIndex(x,x84)
	plt.ylim(ymax=1.1*f(x50))
	plt.plot(mean, f(mean),'o')
	drawLine(x16,0,f(x16),'1', pos='left')
	drawLine(x84,0,f(x84),'3')	
	plt.annotate('2',xy=(mean*1.0001,f(mean)*1.001),xycoords='data',size=17)
	plt.annotate('',xy=(x16,f(x16)/2), xycoords='data',xytext=(x84,f(x16)/2), textcoords='data',arrowprops=dict(arrowstyle="<->"),)
	plt.annotate(r'$\mathtt{\sigma^+_-}$', xy=(x50*0.9999,1.08*f(x16)/2), xycoords='data',fontsize=14)

	# Informacões dos intervalor da media +/- sigma

	num = algarismoSig(std)
	mean = str(round(mean,num))
	std = str(round(std,num))

	num = algarismoSig(stdAbs)
	median = str(round(median,num))
	stdAbs = str(round(stdAbs,num))

	textstr0 = ''
	textstr1 = ''
	textstr2 =  r'$\mathtt{Histograma: }$'
	textstr3 =  r'$\mathtt{Media= \; %s_-^+ \; %s \quad adu}$' %(mean, std)
	textstr4 =	r'$\mathtt{Mediana= \; %s_-^+ \; %s \quad adu}$'%(median,stdAbs)                                                                                                              
	textstr5 =  r'$\mathtt{1 \; - \;(%.2f \; adu,%.2f}$'%(x16,f(x16)) +' %' + r'$\mathtt{)}$'
	textstr6 =  r'$\mathtt{2 \; - \;(%.2f \; adu,%.2f}$'%(x50,f(x50)) +' %' + r'$\mathtt{)}$'
	textstr7 =  r'$\mathtt{3 \; - \;(%.2f \; adu,%.2f}$'%(x84,f(x84)) +' %' + r'$\mathtt{)}$'

	textstr = [textstr0,textstr1,textstr2,textstr3,textstr4,textstr5, textstr6, textstr7]	
	return textstr
Exemplo n.º 2
0
def dadosMeanTemp(vetor, vetorstd):
    mean = np.mean(vetor)
    std = np.std(vetor)
    meanStd = np.mean(vetorstd)

    num = algarismoSig(std)
    mean = round(mean, num)
    std = round(std, num)

    meanFrame = vetor[0]
    stdFrame = vetorstd[0]
    num = algarismoSig(stdFrame)
    meanFrame = round(meanFrame, num)
    stdFrame = round(stdFrame, num)

    ratio = stdFrame / std

    mean = str(mean)
    std = str(std)
    meanFrame = str(meanFrame)
    stdFrame = str(stdFrame)

    sinal = None
    textstr0 = ''
    textstr1 = r'$\mathtt{\barM_{temp} = \; %s_-^+ \; %s \;\; adu}$' % (mean,
                                                                        std)
    textstr2 = r'$\mathtt{\barM_{frame} = \; %s_-^+ \; %s \;\; adu}$' % (
        meanFrame, stdFrame)
    textstr3 = r'$\mathtt{\bar\sigma_{frame} = \; %.1f \; \sigma_{temp}}$' % (
        ratio)
    if ratio > 1.1:
        sinal = r'$\mathtt{\gg}$'
    if 0.9 < ratio < 1.1:
        sinal = r'$\mathtt{\approx}$'
    if ratio < 0.9:
        sinal = r'$\mathtt{\ll}$'

    textstr4 = r'$\mathtt{\bar\sigma_{frame}}$' + sinal + r'$\mathtt{ \sigma_{temp} \;\; (>10}$' + '%' + r'$\mathtt{)}$'

    textstr = [textstr0, textstr1, textstr2, textstr3, textstr4]
    caixa(textstr, 4, 3, 2, 2, font=26, space=0.15)

    return stdFrame
Exemplo n.º 3
0
def linhaReferencia(y):
	lenY = len(y)
	mean = np.mean(y)
	std = np.std(y)

	num = algarismoSig(std)
	mean = round(mean, num)
	std = round(std,num)

	linhaR = []
	lisStd = []
	i=0
	while i < lenY:
		linhaR.append(mean)		
		i+=1
	x = np.linspace(0,lenY, lenY)
	linhaR = np.asarray(linhaR)
	plt.plot(x,linhaR, '-', c='red', linewidth=1.5)
	plt.plot(x,linhaR - std, '--', c='red', linewidth=1.5)
	plt.plot(x,linhaR + std, '--', c='red', linewidth=1.5)
Exemplo n.º 4
0
def plotTempDC(temperatura, DC, std, ganho):
    ax = plt.subplot2grid((3, 2), (0, 1))
    DC = np.asarray(DC) / ganho
    std = np.asarray(std) / ganho
    font = 15
    i = 0
    #arredonda para a casa decimal com o primeiro algarismo significativo
    while i < len(DC):
        num = algarismoSig(std[i])
        DC[i] = round(DC[i], num)
        std[i] = round(std[i], num)
        i += 1
    plt.plot(temperatura, DC)
    plt.errorbar(temperatura, DC, std, c='blue', fmt='o')
    plt.xlabel(r'$\mathtt{Temperatura \quad (^oC)}$', size=font)
    plt.ylabel(r'$\mathtt{Corrente \quad de \quad escuro \quad (e-/pix/s)}$',
               size=font)
    plt.title(r'$\mathtt{Corrente \quad de \quad escuro \quad em \quad fun}$' +
              u'ç' + r'$\mathtt{\~ao \quad da \quad temperatura}$',
              size=font + 2)
    plt.xlim(xmax=temperatura[0] * 0.9)

    i = 0
    while i < len(DC):
        DC[i] = str(DC[i])
        std[i] = str(std[i])
        textstr = r'$\mathtt{DC(%i^oC) \; = \quad %s^+_- \; %s \; e-/pix/s}$' % (
            temperatura[i], DC[i], std[i])
        plt.text(0.05,
                 0.90 - i * 0.07,
                 textstr,
                 ha='left',
                 va='center',
                 size=font + 1,
                 transform=ax.transAxes)
        i += 1
    return (DC[-1], std[-1])
Exemplo n.º 5
0
def plotGradiente(posx, posy, Vetormean, eixo='x'):
    font = 20
    nDados = len(Vetormean)
    mean = np.mean(Vetormean)
    std = np.std(Vetormean)
    ax = plt.subplot2grid((4, 3), (posx, posy), colspan=1)
    x = np.linspace(0, nDados, nDados)

    num = algarismoSig(std)
    mean = str(round(mean, num))
    std = str(round(std, num))

    if eixo == 'x':
        textstr = r'$\mathtt{\barF_y = %s_-^+ \; %s \quad adu}$' % (mean, std)
        strX = r'$\mathtt{x (pixel)}$'
        strY = r'$\mathtt{M \acutee dia \; das \; contagens \; em \; Y}$'
    else:
        textstr = r'$\mathtt{\barF_x = %s_-^+ \; %s \quad adu }$' % (mean, std)
        strX = r'$\mathtt{y (pixel)}$'
        strY = r'$\mathtt{M \acutee dia \; das \; contagens \; em \; X}$'
    plt.plot(x, Vetormean, color='gray', alpha=0.8)
    plt.xlim(0, nDados)
    plt.xlabel(strX, size=font)
    plt.ylabel(strY, size=font)
    plt.gca().get_yaxis().get_major_formatter().set_useOffset(False)
    plt.text(0.05,
             0.90,
             textstr,
             va='center',
             ha='left',
             size=20,
             transform=ax.transAxes)
    linhaReferencia(Vetormean)
    meanBin, meanStdBin = binagem(x, Vetormean)

    return meanBin, meanStdBin
Exemplo n.º 6
0
def Graph_residuos(x, y, std, image_path):
    i, font, residuo, err = 0, 17, [], []
    for dado in y:
        residuo.append(dado - coefAng * x[i] - intercept)
        i += 1
    for dado in std:
        err.append(sqrt(dado**2 + stdLinAjust**2))

    ax = plt.subplot(122)
    plt.plot(x, residuo, c='blue')
    plt.errorbar(x, residuo, err, c='blue', fmt='o')
    plt.xlabel(r'$\mathtt{Vari\^ancia \quad (adu)}$', size=font)
    plt.ylabel(r'$\mathtt{Intensidade \quad do \quad sinal \quad (e-)}$',
               size=font)
    plt.title(
        r'$\mathtt{Curva: \quad res \acute\iota duos \quad = \quad sinal \quad - \quad ajuste \quad linear}$'
        + '\n',
        size=font)
    plt.xlim(xmin=0.99 * x[0], xmax=1.01 * x[-1])
    linhaReferencia(x, residuo)

    num = algarismoSig(np.std(residuo))
    mean = str(round(np.mean(residuo), num))
    std = str(round(np.std(residuo), num))
    if '-0.0' == mean:
        mean = mean[1:]
    plt.text(
        0.05,
        0.9,
        r'$\mathtt{M\acuteedia \; = \; %s^+_- \; %s \quad el\acuteetrons}$' %
        (mean, std),
        va='center',
        ha='left',
        size=font + 3,
        transform=ax.transAxes)
    plt.savefig(image_path + '\\' + 'Relatório Ganho.pdf', format='pdf')
Exemplo n.º 7
0
def caixaInfo(vetorx, vetory, meanBinX, stdBinX, meanBinY, stdBinY):

    stdx = np.std(vetorx)
    num = algarismoSig(stdx)
    stdx = round(stdx, num)

    num = algarismoSig(stdBinX)
    meanBinX = round(meanBinX, num)
    stdBinX = round(stdBinX, num)

    stdRelativeX = stdx / stdBinX

    stdy = np.std(vetory)
    num = algarismoSig(stdy)
    stdy = round(stdy, num)

    num = algarismoSig(stdBinY)
    meanBinY = round(meanBinY, num)
    stdBinY = round(stdBinY, num)

    stdRelativeY = stdy / stdBinY

    meanBinX = str(meanBinX)
    stdBinX = str(stdBinX)
    meanBinY = str(meanBinY)
    stdBinY = str(stdBinY)

    fonte = 24
    sinal = None
    textstr0 = r'$\mathtt{Gradiente:}$'
    textstr1 = r'$\mathtt{Eixo \quad Y \; ---------}$'
    textstr2 = r'$\mathtt{\barF_{bin}= \; %s_-^+ \; %s \;\; adu} }$' % (
        meanBinX, stdBinX)
    textstr3 = r'$\mathtt{\sigma_x = \; %.1f \;\; \bar\sigma_{bin}}$' % (
        stdRelativeX)
    if 0.9 < stdRelativeX < 1.1:
        sinal = [r'$\mathtt{\approx}$', '']
    if stdRelativeX > 1.1:
        sinal = [
            r'$\mathtt{\gg}$', r'$\mathtt{(> \; 10}$' + ' %' + r'$\mathtt{)}$'
        ]
    if stdRelativeX < 0.9:
        sinal = [
            r'$\mathtt{\ll}$', r'$\mathtt{(< \; 10}$' + ' %' + r'$\mathtt{)}$'
        ]

    textstr4 = r'$\mathtt{\sigma_x \;}$' + sinal[
        0] + r'$\mathtt{\; \sigma_{bin} \; }$' + sinal[1]

    textstr5 = r'$\mathtt{Eixo \quad X \; ---------}$'
    textstr6 = r'$\mathtt{\barF_{bin}= \; %s_-^+ \; %s \;\; adu} }$' % (
        meanBinY, stdBinY)
    textstr7 = r'$\mathtt{\sigma_y = \; %.1f \;\; \bar\sigma_{bin}}$' % (
        stdRelativeY)
    if 0.9 < stdRelativeY < 1.1:
        sinal = [r'$\mathtt{\approx}$', '']
    if stdRelativeY > 1.1:
        sinal = [
            r'$\mathtt{\gg}$', r'$\mathtt{(> \; 10}$' + ' %' + r'$\mathtt{)}$'
        ]
    if stdRelativeY < 0.9:
        sinal = [
            r'$\mathtt{\ll}$', r'$\mathtt{(< \; 10}$' + ' %' + r'$\mathtt{)}$'
        ]

    textstr8 = r'$\mathtt{\sigma_y \;}$' + sinal[
        0] + r'$\mathtt{\; \sigma_{bin} \; }$' + sinal[1]

    textstr = [
        textstr0, textstr1, textstr2, textstr3, textstr4, textstr5, textstr6,
        textstr7, textstr8
    ]
    return textstr