Skip to main content

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 , matplotlib et scipy .


Module physapp.base

> Fonctions disponibles

derive(y, x)

integrale(y, x, xmin, xmax)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

physapp-0.3.3.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

physapp-0.3.3-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file physapp-0.3.3.tar.gz.

File metadata

  • Download URL: physapp-0.3.3.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for physapp-0.3.3.tar.gz
Algorithm Hash digest
SHA256 057540f181f08810dc75a70439f85ca70dcc039b3a2c9674a2f0910165a96539
MD5 011b321cc91ee249d8f02562b2e10204
BLAKE2b-256 4420299c53893197c8f36d7a94009899131ac89486849aa73bc088cb0595b418

See more details on using hashes here.

File details

Details for the file physapp-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: physapp-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for physapp-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 87b2445535117d1efdac1cad80c6b07a19733e0f90e2fce1af854c0ae4bdc3c7
MD5 e4d2124dd5e322c1bd8dbbd5eb8b17e8
BLAKE2b-256 51d1d512204deff2d235a36366e5328b0514ea7a937b29893b23efbd9bd373e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page