-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97eae47
commit 121fe52
Showing
14 changed files
with
213 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
:::LabIFSC2._operacoes_em_arrays.incertezas | ||
:::LabIFSC2._operacoes_em_arrays.nominais | ||
:::LabIFSC2._arrays.incertezas | ||
:::LabIFSC2._arrays.nominais | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
:::LabIFSC2._operacoes_em_arrays.linspace | ||
:::LabIFSC2._arrays.linspace | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
from LabIFSC2 import * | ||
|
||
campo_magnético=arrayM([210,90,70,54,39,32,33,27,22,20],1,'muT') | ||
distancias=linspace(1,10,10,0.01,'cm') | ||
|
||
unidade_x='cm' | ||
unidade_y='muT' | ||
|
||
regressao=regressao_potencia(distancias,campo_magnético) | ||
print(regressao) | ||
plt.style.use('ggplot') | ||
plt.errorbar(nominais(distancias,unidade_x),nominais(campo_magnético,unidade_y), | ||
xerr=incertezas(distancias,unidade_x),yerr=incertezas(campo_magnético,unidade_y), | ||
fmt='o',label='Dados experimentais',color='red') | ||
|
||
x=linspace(1,10,100,0,unidade_x) | ||
plt.plot(nominais(x,unidade_x),nominais(regressao(x),unidade_y),color='blue', | ||
label="Curva teórica") | ||
plt.fill_between(nominais(x,unidade_x),curva_min(regressao(x),unidade_y), | ||
curva_max(regressao(x),unidade_y),color='blue',alpha=0.3) | ||
plt.legend() | ||
plt.savefig('teste.jpg') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import matplotlib.pyplot as plt | ||
|
||
from LabIFSC2 import * | ||
|
||
campo_magnético=arrayM([250,150,110,90,70,60,55,40,25,20],1,'muT') | ||
distancias=linspace(1,10,10,0.5,'cm') | ||
|
||
unidade_x='cm' | ||
unidade_y='muT' | ||
|
||
plt.style.use('ggplot') | ||
plt.errorbar(nominais(distancias,unidade_x),nominais(campo_magnético,unidade_y), | ||
xerr=incertezas(distancias,unidade_x),yerr=incertezas(campo_magnético,unidade_y),fmt='o') | ||
|
||
plt.xlabel(f"Distancia ({unidade_x})") | ||
plt.ylabel(f"Campo magnético ({unidade_y})") | ||
#plt.savefig("exemplo.jpg") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from LabIFSC2 import * | ||
|
||
campo_magnético=arrayM([250,150,110,90,70,60,55,40,25,20],1,'muT') | ||
print(incertezas(campo_magnético,'muT')) | ||
#[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.] | ||
|
||
assert str(incertezas(campo_magnético,'muT'))=="[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from LabIFSC2 import * | ||
|
||
campo_magnético=arrayM([250,150,110,90,70,60,55,40,25,20],1,'muT') | ||
print(nominais(campo_magnético,'muT')) | ||
#[250. 150. 110. 90. 70. 60. 55. 40. 25. 20.] | ||
|
||
assert str(nominais(campo_magnético,'muT'))=="[250. 150. 110. 90. 70. 60. 55. 40. 25. 20.]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import pint | ||
import pytest | ||
|
||
from LabIFSC2 import * | ||
|
||
campo_magnético=arrayM([210,90,70,54,39,32,33,27,22,20],1,'muT') | ||
distancias=linspace(1,10,10,0.01,'cm') | ||
unidade_errada=linspace(1,10,10,0.001,'kg') | ||
|
||
def test_regressao_linear_unidades(): | ||
linha=regressao_linear(distancias,campo_magnético) | ||
linha(distancias) | ||
unidade_errada=linspace(1,10,10,0.001,'') | ||
with pytest.raises(ValueError): | ||
linha(unidade_errada) | ||
comparar_medidas(linha(distancias)[0],campo_magnético[0]) | ||
|
||
def test_regressao_cubica_unidades(): | ||
for grau in [1,2,3,4,5,6]: | ||
cubica=regressao_polinomial(distancias,campo_magnético,grau) | ||
cubica(distancias) | ||
with pytest.raises(ValueError): | ||
cubica(unidade_errada) | ||
comparar_medidas(cubica(distancias)[0],campo_magnético[0]) | ||
|
||
|
||
def test_regressao_exponencial_unidades(): | ||
exponencial=regressao_exponencial(distancias,campo_magnético) | ||
exponencial(distancias) | ||
with pytest.raises(pint.errors.DimensionalityError): | ||
exponencial(unidade_errada) | ||
comparar_medidas(exponencial(distancias)[0],campo_magnético[0]) | ||
|
||
def test_regressao_potencia_unidades(): | ||
potencia=regressao_potencia(distancias,campo_magnético) | ||
potencia(distancias) | ||
with pytest.raises(ValueError): | ||
potencia(unidade_errada) | ||
comparar_medidas(potencia(distancias)[0],campo_magnético[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters