Librairie Python pour la physique appliquée
Project description
Librairie Python pour la physique appliquée
Installation
Dans un terminal :
pip install physapp
Mise à jour :
pip install --upgrade physapp
Dépendances
Cette librairie se base principalement sur les librairies numpy (>= 1.26.0) , matplotlib (>= 3.8.0) et scipy (>= 1.11.0).
Module physapp.base
> Fonctions disponibles
derive(y, x)
integrale(y, x, xinf, xsup)
spectre_amplitude(y, t, T)
spectre_RMS(y, t, T)
spectre_RMS_dBV(y, t, T)
> Exemple
import numpy as np
import matplotlib.pyplot as plt
from physapp import integrale
### IMPORTATION DES DONNEES ###
t, u = np.loadtxt('scope.csv', delimiter=',', skiprows=2, unpack=True)
### CALCULS ###
f = 125
T = 1/f
aire = integrale(u, t, 0, T, plot_ax=plt)
moy = aire/T
### COURBES ###
plt.plot(t, u)
plt.axhline(moy, ls="--", color="C3")
plt.text(0.65*T, moy+0.2, "Moy = {:.2f} V".format(moy), color="C3")
plt.title("Valeur moyenne d'un signal périodique")
plt.xlabel("t (s)")
plt.ylabel("u (V)")
plt.grid()
plt.show()
Module physapp.modelisation
Fonctions pour réaliser une modélisation d'une courbe expérimentale.
> Fonctions classiques
| Fonction | Description |
|---|---|
ajustement_lineaire(x, y) |
$y=a\cdot x$ |
ajustement_affine(x, y) |
$y=a\cdot x+b$ |
ajustement_parabolique(x, y) |
$y=a\cdot x^2+b\cdot x+c$ |
ajustement_exponentielle_croissante(x, y) |
$y=A\cdot(1-e^{-x/\tau})$ |
ajustement_exponentielle_decroissante(x, y) |
$y = A\cdot e^{-x/\tau}$ |
ajustement_exponentielle2_croissante(x, y) |
$y = A\cdot(1-e^{-kx})$ |
ajustement_exponentielle2_decroissante(x, y) |
$y = A\cdot e^{-kx}$ |
ajustement_puissance(x, y) |
$y=A\cdot x^n$ |
> Réponses fréquentielles
ajustement_ordre1_passe_bas_transmittance(f, T)
ajustement_ordre1_passe_bas_gain(f, G)
ajustement_ordre1_passe_bas_dephasage(f, phi)
ajustement_ordre1_passe_haut_transmittanc(f, T)
ajustement_ordre1_passe_haut_gain(f, G)
ajustement_ordre1_passe_haut_dephasage(f, phi)
ajustement_ordre2_passe_bas_transmittance(f, T)
ajustement_ordre2_passe_haut_transmittance(f, T)
ajustement_ordre2_passe_haut_dephasage(f, phi)
ajustement_ordre2_passe_bande_transmittance(f, T)
ajustement_ordre2_passe_bande_gain(f, G)
ajustement_ordre2_passe_bande_dephasage(f, phi)
> Exemple
import matplotlib.pyplot as plt
from physapp.modelisation import ajustement_parabolique
x = [0.003,0.141,0.275,0.410,0.554,0.686,0.820,0.958,1.089,1.227,1.359,1.490,1.599,1.705,1.801]
y = [0.746,0.990,1.175,1.336,1.432,1.505,1.528,1.505,1.454,1.355,1.207,1.018,0.797,0.544,0.266]
modele = ajustement_parabolique(x, y)
print(modele)
plt.plot(x, y, '+', label="Mesures")
modele.plot() # Trace la courbe du modèle
#modele.legend() # Affiche la légende du modèle
plt.legend()
plt.title("Trajectoire d'un ballon")
plt.xlabel("x (m)")
plt.ylabel("y (m)")
plt.grid()
plt.show()
Résultat :
Fonction parabolique
y = a*x^2 + b*x + c
a = (-1.25 ±0.060)
b = (2.04 ±0.11)
c = (0.717 ±0.045)
Intervalle de confiance à 95% sans incertitudes sur x et y.
Module physapp.csv
Module d'importation de tableau de données au format CSV à partir des logiciels Aviméca3, Regavi, ...
> Fonctions disponibles
load_txt(fileName)
load_avimeca3_txt(fileName)
load_regavi_txt(fileName)
load_regressi_txt(fileName)
load_regressi_csv(fileName)
load_oscillo_csv(filename)
load_ltspice_csv(filename)
save_txt(data, fileName)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file physapp-0.3.6.tar.gz.
File metadata
- Download URL: physapp-0.3.6.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97b721497151f5cc3079508dd15ac5dcb2eb5159cbac2a9db4485111bc77af26
|
|
| MD5 |
cb1c42f6da41b5a2cbc8b64372e87163
|
|
| BLAKE2b-256 |
d17ca984e5a657c985e1ac4bec42e92be41cbb90e06e94e851bd490aa92c8511
|
File details
Details for the file physapp-0.3.6-py3-none-any.whl.
File metadata
- Download URL: physapp-0.3.6-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61233b5b02925708bed64960b86df1b7b92b0cc05c89200e233e80638fdeb430
|
|
| MD5 |
64f670bdad67db6be14cc5259ef0a5a5
|
|
| BLAKE2b-256 |
7ceb24acb1e05eac04278b561373a9afdb289ae03c6529e744ec738a83ccd074
|