# Librairie Python pour la physique appliquée
## Installation
Dans un terminal :
pip install physapp
Mise à jour :
```python
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
```python
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
```python
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 :
```python
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)`
---
Raw data
{
"_id": null,
"home_page": "https://github.com/david-therincourt/physapp",
"name": "physapp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "David THERINCOURT",
"author_email": "dtherincourt@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d1/7c/a984e5a657c985e1ac4bec42e92be41cbb90e06e94e851bd490aa92c8511/physapp-0.3.6.tar.gz",
"platform": null,
"description": "# Librairie Python pour la physique appliqu\u00e9e\n\n## Installation\n\nDans un terminal :\n\n pip install physapp\n\nMise \u00e0 jour :\n\n```python\npip install --upgrade physapp\n```\n\n---\n\n## D\u00e9pendances\n\nCette librairie se base principalement sur les librairies `numpy (>= 1.26.0)` , `matplotlib (>= 3.8.0)` et `scipy (>= 1.11.0)`.\n\n---\n\n## Module `physapp.base`\n\n### > Fonctions disponibles\n\n`derive(y, x)`\n\n`integrale(y, x, xinf, xsup)`\n\n`spectre_amplitude(y, t, T)`\n\n`spectre_RMS(y, t, T)`\n\n`spectre_RMS_dBV(y, t, T)`\n\n### > Exemple\n\n```python\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom physapp import integrale\n\n### IMPORTATION DES DONNEES ###\nt, u = np.loadtxt('scope.csv', delimiter=',', skiprows=2, unpack=True)\n\n### CALCULS ###\nf = 125\nT = 1/f\naire = integrale(u, t, 0, T, plot_ax=plt)\nmoy = aire/T\n\n### COURBES ###\nplt.plot(t, u)\nplt.axhline(moy, ls=\"--\", color=\"C3\")\nplt.text(0.65*T, moy+0.2, \"Moy = {:.2f} V\".format(moy), color=\"C3\")\nplt.title(\"Valeur moyenne d'un signal p\u00e9riodique\")\nplt.xlabel(\"t (s)\")\nplt.ylabel(\"u (V)\")\nplt.grid()\nplt.show()\n```\n\n\n\n## Module `physapp.modelisation`\n\nFonctions pour r\u00e9aliser une mod\u00e9lisation d'une courbe exp\u00e9rimentale.\n\n### > Fonctions classiques\n\n| Fonction | Description |\n| ---------------------------------------------- | ------------------------- |\n| `ajustement_lineaire(x, y)` | $y=a\\cdot x$ |\n| `ajustement_affine(x, y)` | $y=a\\cdot x+b$ |\n| `ajustement_parabolique(x, y)` | $y=a\\cdot x^2+b\\cdot x+c$ |\n| `ajustement_exponentielle_croissante(x, y)` | $y=A\\cdot(1-e^{-x/\\tau})$ |\n| `ajustement_exponentielle_decroissante(x, y)` | $y = A\\cdot e^{-x/\\tau}$ |\n| `ajustement_exponentielle2_croissante(x, y)` | $y = A\\cdot(1-e^{-kx})$ |\n| `ajustement_exponentielle2_decroissante(x, y)` | $y = A\\cdot e^{-kx}$ |\n| `ajustement_puissance(x, y)` | $y=A\\cdot x^n$ |\n\n### > R\u00e9ponses fr\u00e9quentielles\n\n`ajustement_ordre1_passe_bas_transmittance(f, T)`\n\n`ajustement_ordre1_passe_bas_gain(f, G)`\n\n`ajustement_ordre1_passe_bas_dephasage(f, phi)`\n\n`ajustement_ordre1_passe_haut_transmittanc(f, T)`\n\n`ajustement_ordre1_passe_haut_gain(f, G)`\n\n`ajustement_ordre1_passe_haut_dephasage(f, phi)`\n\n`ajustement_ordre2_passe_bas_transmittance(f, T)`\n\n`ajustement_ordre2_passe_haut_transmittance(f, T)`\n\n`ajustement_ordre2_passe_haut_dephasage(f, phi)`\n\n`ajustement_ordre2_passe_bande_transmittance(f, T)`\n\n`ajustement_ordre2_passe_bande_gain(f, G)`\n\n`ajustement_ordre2_passe_bande_dephasage(f, phi)`\n\n### > Exemple\n\n```python\nimport matplotlib.pyplot as plt\nfrom physapp.modelisation import ajustement_parabolique\n\nx = [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]\ny = [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]\n\nmodele = ajustement_parabolique(x, y)\nprint(modele)\n\nplt.plot(x, y, '+', label=\"Mesures\")\nmodele.plot() # Trace la courbe du mod\u00e8le \n#modele.legend() # Affiche la l\u00e9gende du mod\u00e8le\nplt.legend()\nplt.title(\"Trajectoire d'un ballon\")\nplt.xlabel(\"x (m)\")\nplt.ylabel(\"y (m)\")\nplt.grid()\nplt.show()\n```\n\nR\u00e9sultat :\n\n```python\nFonction parabolique\ny = a*x^2 + b*x + c\na = (-1.25 \u00b10.060)\nb = (2.04 \u00b10.11)\nc = (0.717 \u00b10.045)\nIntervalle de confiance \u00e0 95% sans incertitudes sur x et y.\n```\n\n\n\n---\n\n## Module `physapp.csv`\n\nModule d'importation de tableau de donn\u00e9es au format CSV \u00e0 partir des logiciels Avim\u00e9ca3, Regavi, ...\n\n#### > Fonctions disponibles\n\n`load_txt(fileName)`\n\n`load_avimeca3_txt(fileName)` \n\n`load_regavi_txt(fileName)`\n\n`load_regressi_txt(fileName)`\n\n`load_regressi_csv(fileName)`\n\n`load_oscillo_csv(filename)`\n\n`load_ltspice_csv(filename)`\n\n`save_txt(data, fileName)`\n\n---\n",
"bugtrack_url": null,
"license": null,
"summary": "Librairie Python pour la physique appliqu\u00e9e",
"version": "0.3.6",
"project_urls": {
"Homepage": "https://github.com/david-therincourt/physapp"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ceb24acb1e05eac04278b561373a9afdb289ae03c6529e744ec738a83ccd074",
"md5": "64f670bdad67db6be14cc5259ef0a5a5",
"sha256": "61233b5b02925708bed64960b86df1b7b92b0cc05c89200e233e80638fdeb430"
},
"downloads": -1,
"filename": "physapp-0.3.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "64f670bdad67db6be14cc5259ef0a5a5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 20773,
"upload_time": "2024-09-08T16:54:41",
"upload_time_iso_8601": "2024-09-08T16:54:41.587703Z",
"url": "https://files.pythonhosted.org/packages/7c/eb/24acb1e05eac04278b561373a9afdb289ae03c6529e744ec738a83ccd074/physapp-0.3.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d17ca984e5a657c985e1ac4bec42e92be41cbb90e06e94e851bd490aa92c8511",
"md5": "cb1c42f6da41b5a2cbc8b64372e87163",
"sha256": "97b721497151f5cc3079508dd15ac5dcb2eb5159cbac2a9db4485111bc77af26"
},
"downloads": -1,
"filename": "physapp-0.3.6.tar.gz",
"has_sig": false,
"md5_digest": "cb1c42f6da41b5a2cbc8b64372e87163",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 16755,
"upload_time": "2024-09-08T16:54:43",
"upload_time_iso_8601": "2024-09-08T16:54:43.670139Z",
"url": "https://files.pythonhosted.org/packages/d1/7c/a984e5a657c985e1ac4bec42e92be41cbb90e06e94e851bd490aa92c8511/physapp-0.3.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-08 16:54:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "david-therincourt",
"github_project": "physapp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "physapp"
}