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 (>= 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


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.5.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

physapp-0.3.5-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: physapp-0.3.5.tar.gz
  • Upload date:
  • Size: 16.7 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.5.tar.gz
Algorithm Hash digest
SHA256 931dba0dd0ead433cdc7bfdd73d8d2dfb72e77b895e948cbb25deb1dd85641f6
MD5 0da27dd32126f1fe819779284fba005b
BLAKE2b-256 9aeff249729e49741bcc02f4024a08321d07faa83af867f2a7ae3199afe1644c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: physapp-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 20.8 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c024821206abb0c0ecc524437940b6a540ff924931b4729db05f4d89c57ab5b4
MD5 325334ff8dbf628132fd4ee662a77533
BLAKE2b-256 10bfd1b67cf9b31948e99708391176cb6af495286c5b69a48bdbc6126cc10299

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