mespy 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mespy-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Giancarmine-Sparso
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mespy-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: mespy
3
+ Version: 0.2.0
4
+ Summary: Toolbox Python per l'analisi dei dati di laboratorio
5
+ Author-email: Giancarmine Sparso <giancarminesparso@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/giancarmine-sparso/mespy
8
+ Project-URL: Repository, https://github.com/giancarmine-sparso/mespy
9
+ Project-URL: Issues, https://github.com/giancarmine-sparso/mespy/issues
10
+ Keywords: physics,statistics,data analysis,laboratory,mechanics
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Physics
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy
22
+ Requires-Dist: pandas
23
+ Requires-Dist: matplotlib
24
+ Provides-Extra: dev
25
+ Requires-Dist: build; extra == "dev"
26
+ Requires-Dist: pytest; extra == "dev"
27
+ Requires-Dist: setuptools>=68; extra == "dev"
28
+ Requires-Dist: twine; extra == "dev"
29
+ Requires-Dist: wheel; extra == "dev"
30
+ Requires-Dist: ipykernel; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # mespy
34
+
35
+ Toolbox Python per l'analisi dei dati di laboratorio di meccanica.
36
+
37
+ L'obiettivo del progetto e' raccogliere in un unico package le utility che tornano spesso nei notebook di laboratorio: caricamento CSV, statistiche descrittive e pesate, istogrammi e fit lineare con incertezze.
38
+
39
+ Lo stato attuale e' ancora `Alpha`: il package e' gia' utilizzabile per casi semplici, ma l'API non va considerata stabile.
40
+
41
+ ## Cosa c'e' oggi
42
+
43
+ Il package espone direttamente:
44
+
45
+ - `load_csv`
46
+ - `median`
47
+ - `weighted_mean`
48
+ - `variance`
49
+ - `covariance`
50
+ - `standard_deviation`
51
+ - `histogram`
52
+ - `lin_fit`
53
+
54
+ I moduli attualmente presenti in `src/mespy` sono:
55
+
56
+ - `io_utils.py`: lettura CSV con gestione di separatori, decimali, colonne richieste e missing values
57
+ - `stats_utils.py`: funzioni statistiche di base, anche con pesi
58
+ - `plot_utils.py`: istogrammi con media e banda `±1σ`
59
+ - `fit_utils.py`: fit lineare pesato con residui, incertezze sui parametri e grafico opzionale
60
+
61
+ ## Struttura del progetto
62
+
63
+ ```text
64
+ mespy/
65
+ ├── src/mespy/ # package Python
66
+ ├── tests/ # test pytest
67
+ ├── notebooks/ # notebook di prova e dimostrazione
68
+ ├── docs/ # documentazione LaTeX e PDF
69
+ ├── data/reference/ # dataset di riferimento per test/esempi
70
+ ├── figures/ # figure esportate
71
+ ├── tools/ # script di supporto
72
+ ├── pyproject.toml # metadata del package
73
+ └── Makefile # comandi di setup e documentazione
74
+ ```
75
+
76
+ ## Requisiti
77
+
78
+ - Python `>= 3.12`
79
+ - `git`
80
+ - `lualatex`, `latexmk` e `pygmentize` solo se vuoi ricompilare la documentazione
81
+ - font richiesti dalla build docs: `Libertinus Serif`, `Libertinus Math`, `Libertinus Sans`, `JetBrains Mono`, `Inter Display`
82
+
83
+ ## Installazione rapida
84
+
85
+ Clona il repository ed entra nella directory:
86
+
87
+ ```bash
88
+ git clone https://github.com/giancarmine-sparso/mespy
89
+ cd mespy
90
+ ```
91
+
92
+ Crea il virtualenv e installa il package con le dipendenze di sviluppo:
93
+
94
+ ```bash
95
+ make setup
96
+ ```
97
+
98
+ Questo installa anche gli strumenti usati per il check pre-release (`build` e `twine`).
99
+
100
+ Se vuoi attivare l'ambiente manualmente:
101
+
102
+ ```bash
103
+ source .venv/bin/activate
104
+ ```
105
+
106
+ ## Esempio minimo
107
+
108
+ ```python
109
+ from mespy import lin_fit, load_csv, weighted_mean
110
+
111
+ df = load_csv("data/reference/test_misure.csv", sep=",", decimal=".")
112
+
113
+ x = df["misura_n"].to_numpy(dtype=float)
114
+ y = df["lunghezza_mm"].to_numpy(dtype=float)
115
+ sigma_y = df["sigma_mm"].to_numpy(dtype=float)
116
+
117
+ y_bar = weighted_mean(y, 1 / sigma_y**2)
118
+
119
+ fit = lin_fit(
120
+ x=x,
121
+ y=y,
122
+ sigma_y=sigma_y,
123
+ xlabel="numero misura",
124
+ ylabel="lunghezza [mm]",
125
+ plot=False,
126
+ )
127
+
128
+ print("media pesata:", y_bar)
129
+ print("pendenza:", fit["m"])
130
+ ```
131
+
132
+ ## Documentazione
133
+
134
+ La documentazione del package e' in `docs/main.pdf`.
135
+
136
+ Per ricompilarla:
137
+
138
+ ```bash
139
+ make docs
140
+ ```
141
+
142
+ Il target usa `minted`, quindi richiede anche `pygmentize` disponibile nel `PATH`.
143
+ Inoltre il sorgente LaTeX usa i font `Libertinus Serif`, `Libertinus Math`, `Libertinus Sans`, `JetBrains Mono` e `Inter Display`.
144
+ `make check-tex` verifica i comandi necessari e, se `fc-match` e' disponibile nel sistema, controlla anche la presenza di questi font.
145
+
146
+ Le sezioni attualmente documentate sono:
147
+
148
+ - `io_utils`
149
+ - `stats_utils`
150
+ - `plot_utils`
151
+ - `fit_utils`
152
+
153
+ ## Check pre-release
154
+
155
+ Per eseguire il gate completo di release PyPI in locale:
156
+
157
+ ```bash
158
+ make release-check
159
+ ```
160
+
161
+ Il comando esegue test, `compileall`, `pip check`, build di `sdist` e `wheel`, validazione con `twine check` e smoke test degli import a partire dalla wheel generata.
162
+
163
+ ## Comandi utili
164
+
165
+ | Target | Descrizione |
166
+ | --- | --- |
167
+ | `make setup` | Crea il virtualenv e installa il package in editable mode con dipendenze `dev` |
168
+ | `make venv` | Crea solo il virtualenv |
169
+ | `make install` | Installa il package locale e le dipendenze |
170
+ | `make test` | Esegue l'intera suite `pytest` |
171
+ | `make dist` | Genera `sdist` e `wheel` in `dist/` |
172
+ | `make twine-check` | Valida gli artifact generati con `twine check` |
173
+ | `make release-check` | Esegue il gate completo pre-release per PyPI |
174
+ | `make check-tex` | Verifica i prerequisiti LaTeX e, se possibile, i font richiesti |
175
+ | `make docs` | Compila la documentazione PDF |
176
+ | `make docs-clean` | Rimuove i file temporanei LaTeX |
177
+ | `make dist-clean` | Rimuove gli artifact Python di build |
178
+ | `make clean` | Esegue la pulizia generale |
179
+
180
+ ## Note
181
+
182
+ - I notebook in `notebooks/` sono esempi di utilizzo e test esplorativi, non documentazione API stabile.
mespy-0.2.0/README.md ADDED
@@ -0,0 +1,150 @@
1
+ # mespy
2
+
3
+ Toolbox Python per l'analisi dei dati di laboratorio di meccanica.
4
+
5
+ L'obiettivo del progetto e' raccogliere in un unico package le utility che tornano spesso nei notebook di laboratorio: caricamento CSV, statistiche descrittive e pesate, istogrammi e fit lineare con incertezze.
6
+
7
+ Lo stato attuale e' ancora `Alpha`: il package e' gia' utilizzabile per casi semplici, ma l'API non va considerata stabile.
8
+
9
+ ## Cosa c'e' oggi
10
+
11
+ Il package espone direttamente:
12
+
13
+ - `load_csv`
14
+ - `median`
15
+ - `weighted_mean`
16
+ - `variance`
17
+ - `covariance`
18
+ - `standard_deviation`
19
+ - `histogram`
20
+ - `lin_fit`
21
+
22
+ I moduli attualmente presenti in `src/mespy` sono:
23
+
24
+ - `io_utils.py`: lettura CSV con gestione di separatori, decimali, colonne richieste e missing values
25
+ - `stats_utils.py`: funzioni statistiche di base, anche con pesi
26
+ - `plot_utils.py`: istogrammi con media e banda `±1σ`
27
+ - `fit_utils.py`: fit lineare pesato con residui, incertezze sui parametri e grafico opzionale
28
+
29
+ ## Struttura del progetto
30
+
31
+ ```text
32
+ mespy/
33
+ ├── src/mespy/ # package Python
34
+ ├── tests/ # test pytest
35
+ ├── notebooks/ # notebook di prova e dimostrazione
36
+ ├── docs/ # documentazione LaTeX e PDF
37
+ ├── data/reference/ # dataset di riferimento per test/esempi
38
+ ├── figures/ # figure esportate
39
+ ├── tools/ # script di supporto
40
+ ├── pyproject.toml # metadata del package
41
+ └── Makefile # comandi di setup e documentazione
42
+ ```
43
+
44
+ ## Requisiti
45
+
46
+ - Python `>= 3.12`
47
+ - `git`
48
+ - `lualatex`, `latexmk` e `pygmentize` solo se vuoi ricompilare la documentazione
49
+ - font richiesti dalla build docs: `Libertinus Serif`, `Libertinus Math`, `Libertinus Sans`, `JetBrains Mono`, `Inter Display`
50
+
51
+ ## Installazione rapida
52
+
53
+ Clona il repository ed entra nella directory:
54
+
55
+ ```bash
56
+ git clone https://github.com/giancarmine-sparso/mespy
57
+ cd mespy
58
+ ```
59
+
60
+ Crea il virtualenv e installa il package con le dipendenze di sviluppo:
61
+
62
+ ```bash
63
+ make setup
64
+ ```
65
+
66
+ Questo installa anche gli strumenti usati per il check pre-release (`build` e `twine`).
67
+
68
+ Se vuoi attivare l'ambiente manualmente:
69
+
70
+ ```bash
71
+ source .venv/bin/activate
72
+ ```
73
+
74
+ ## Esempio minimo
75
+
76
+ ```python
77
+ from mespy import lin_fit, load_csv, weighted_mean
78
+
79
+ df = load_csv("data/reference/test_misure.csv", sep=",", decimal=".")
80
+
81
+ x = df["misura_n"].to_numpy(dtype=float)
82
+ y = df["lunghezza_mm"].to_numpy(dtype=float)
83
+ sigma_y = df["sigma_mm"].to_numpy(dtype=float)
84
+
85
+ y_bar = weighted_mean(y, 1 / sigma_y**2)
86
+
87
+ fit = lin_fit(
88
+ x=x,
89
+ y=y,
90
+ sigma_y=sigma_y,
91
+ xlabel="numero misura",
92
+ ylabel="lunghezza [mm]",
93
+ plot=False,
94
+ )
95
+
96
+ print("media pesata:", y_bar)
97
+ print("pendenza:", fit["m"])
98
+ ```
99
+
100
+ ## Documentazione
101
+
102
+ La documentazione del package e' in `docs/main.pdf`.
103
+
104
+ Per ricompilarla:
105
+
106
+ ```bash
107
+ make docs
108
+ ```
109
+
110
+ Il target usa `minted`, quindi richiede anche `pygmentize` disponibile nel `PATH`.
111
+ Inoltre il sorgente LaTeX usa i font `Libertinus Serif`, `Libertinus Math`, `Libertinus Sans`, `JetBrains Mono` e `Inter Display`.
112
+ `make check-tex` verifica i comandi necessari e, se `fc-match` e' disponibile nel sistema, controlla anche la presenza di questi font.
113
+
114
+ Le sezioni attualmente documentate sono:
115
+
116
+ - `io_utils`
117
+ - `stats_utils`
118
+ - `plot_utils`
119
+ - `fit_utils`
120
+
121
+ ## Check pre-release
122
+
123
+ Per eseguire il gate completo di release PyPI in locale:
124
+
125
+ ```bash
126
+ make release-check
127
+ ```
128
+
129
+ Il comando esegue test, `compileall`, `pip check`, build di `sdist` e `wheel`, validazione con `twine check` e smoke test degli import a partire dalla wheel generata.
130
+
131
+ ## Comandi utili
132
+
133
+ | Target | Descrizione |
134
+ | --- | --- |
135
+ | `make setup` | Crea il virtualenv e installa il package in editable mode con dipendenze `dev` |
136
+ | `make venv` | Crea solo il virtualenv |
137
+ | `make install` | Installa il package locale e le dipendenze |
138
+ | `make test` | Esegue l'intera suite `pytest` |
139
+ | `make dist` | Genera `sdist` e `wheel` in `dist/` |
140
+ | `make twine-check` | Valida gli artifact generati con `twine check` |
141
+ | `make release-check` | Esegue il gate completo pre-release per PyPI |
142
+ | `make check-tex` | Verifica i prerequisiti LaTeX e, se possibile, i font richiesti |
143
+ | `make docs` | Compila la documentazione PDF |
144
+ | `make docs-clean` | Rimuove i file temporanei LaTeX |
145
+ | `make dist-clean` | Rimuove gli artifact Python di build |
146
+ | `make clean` | Esegue la pulizia generale |
147
+
148
+ ## Note
149
+
150
+ - I notebook in `notebooks/` sono esempi di utilizzo e test esplorativi, non documentazione API stabile.
@@ -0,0 +1,46 @@
1
+ [project]
2
+ name = "mespy"
3
+ version = "0.2.0"
4
+ description = "Toolbox Python per l'analisi dei dati di laboratorio"
5
+ readme = { file = "README.md", content-type = "text/markdown" }
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Giancarmine Sparso", email = "giancarminesparso@gmail.com" }]
9
+ requires-python = ">=3.12"
10
+ keywords = ["physics", "statistics", "data analysis", "laboratory", "mechanics"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Science/Research",
14
+ "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3 :: Only",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Topic :: Scientific/Engineering :: Physics",
19
+ ]
20
+ dependencies = [
21
+ "numpy",
22
+ "pandas",
23
+ "matplotlib",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/giancarmine-sparso/mespy"
28
+ Repository = "https://github.com/giancarmine-sparso/mespy"
29
+ Issues = "https://github.com/giancarmine-sparso/mespy/issues"
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "build",
34
+ "pytest",
35
+ "setuptools>=68",
36
+ "twine",
37
+ "wheel",
38
+ "ipykernel",
39
+ ]
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
43
+
44
+ [build-system]
45
+ requires = ["setuptools>=68", "wheel"]
46
+ build-backend = "setuptools.build_meta"
mespy-0.2.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,22 @@
1
+ from .fit_utils import lin_fit
2
+ from .io_utils import load_csv
3
+
4
+ from .plot_utils import histogram
5
+ from .stats_utils import (
6
+ covariance,
7
+ median,
8
+ standard_deviation,
9
+ variance,
10
+ weighted_mean,
11
+ )
12
+
13
+ __all__ = [
14
+ "load_csv",
15
+ "median",
16
+ "weighted_mean",
17
+ "variance",
18
+ "covariance",
19
+ "standard_deviation",
20
+ "lin_fit",
21
+ "histogram",
22
+ ]