lab-physics-tools 1.2.2__tar.gz → 1.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lab-physics-tools
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Toolkit Python per fit chi-quadro, mappe 2D e tipografia scientifica per laboratori di fisica.
5
5
  Project-URL: Source, https://github.com/el-coda-coda/LabPhysicsTools.git
6
6
  Author: Andrea Codarin
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "lab-physics-tools"
7
- version = "1.2.2"
7
+ version = "1.2.3"
8
8
  description = "Toolkit Python per fit chi-quadro, mappe 2D e tipografia scientifica per laboratori di fisica."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -6,4 +6,4 @@ from .chi_squared_fit import *
6
6
  from .chi_squared_2d_map import *
7
7
  from .plot_typo import *
8
8
 
9
- __version__ = "1.1.0"
9
+ __version__ = "1.2.3"
@@ -500,10 +500,6 @@ class GlobalFitPipeline:
500
500
  if __name__ == "__main__":
501
501
  import matplotlib.pyplot as plt
502
502
 
503
- current_dir = Path(__file__).resolve().parent
504
- save_folder = current_dir / "examples"
505
- save_folder.mkdir(parents=True, exist_ok=True)
506
-
507
503
  # ──────────────────────────────────────────────────────────────────────────────
508
504
  # ESEMPIO 1: Oscillatore smorzato ad alta frequenza
509
505
  # ──────────────────────────────────────────────────────────────────────────────
@@ -537,8 +533,6 @@ if __name__ == "__main__":
537
533
  ax2.errorbar(t, res1.residui, yerr=s_y, fmt='.', alpha=0.4)
538
534
  ax2.axhline(0, color='r', ls='--'); ax2.set_ylabel('residui'); ax2.set_xlabel('t [s]')
539
535
  fig1.tight_layout()
540
- fig1.savefig(save_folder / "example_1_fit_pipeline.pdf", dpi=300, bbox_inches="tight")
541
- print("\nGrafico Esempio 1 salvato.")
542
536
 
543
537
  # ──────────────────────────────────────────────────────────────────────────────
544
538
  # ESEMPIO 2: Confronto ODR Newton vs ODR Linearizzato
@@ -604,9 +598,6 @@ if __name__ == "__main__":
604
598
  ax_bot.set_xlabel("x")
605
599
  ax_bot.legend()
606
600
  fig2.tight_layout()
607
- fig2.savefig(save_folder / "example_2_odr_difference_fit.pdf", dpi=300, bbox_inches="tight")
608
-
609
- print("Grafico Esempio 2 salvato.")
610
601
 
611
602
  # ──────────────────────────────────────────────────────────────────────────────
612
603
  # ESEMPIO 3: Retta di calibrazione con errori su x e y
@@ -658,7 +649,6 @@ if __name__ == "__main__":
658
649
  ax2.set_xlabel("Grandezza applicata $x$ [u.a.]")
659
650
  ax2.set_xlabel("Grandezza applicata $x$ [u.a.]")
660
651
  fig3.tight_layout()
661
- fig3.savefig(save_folder / "example_3_linear_fit.pdf", dpi=300, bbox_inches="tight")
662
652
 
663
653
  # ──────────────────────────────────────────────────────────────────────────────
664
654
  # ESEMPIO 4: Picco Gaussiano con Fondo
@@ -710,7 +700,6 @@ if __name__ == "__main__":
710
700
  ax2.set_ylabel("Pulls [$\\sigma$]")
711
701
  ax2.set_xlabel("Canale energetico $x$ [keV]")
712
702
  fig4.tight_layout()
713
- fig4.savefig(save_folder / "example_4_gussian_fit.pdf", dpi=300, bbox_inches="tight")
714
703
 
715
704
  # ──────────────────────────────────────────────────────────────────────────────
716
705
  # ESEMPIO 5: Stress-Test e recupero automatico da p0 sballati
@@ -758,7 +747,6 @@ if __name__ == "__main__":
758
747
  ax.set_ylabel("y")
759
748
  ax.legend()
760
749
  fig5.tight_layout()
761
- fig5.savefig(save_folder / "example_5_global_guess_parameters_recovery.pdf", dpi=300, bbox_inches="tight")
762
750
 
763
751
  print("\nTutti gli esempi sono stati eseguiti e salvati correttamente.")
764
752
  plt.show()
@@ -7,8 +7,6 @@ tacche 'inout' e griglie calibrate.
7
7
 
8
8
  from __future__ import annotations
9
9
  import math
10
- from pathlib import Path
11
- from typing import Optional, Union, Sequence
12
10
  import numpy as np
13
11
  import matplotlib.pyplot as plt
14
12
  import matplotlib.ticker as ticker
@@ -219,9 +217,6 @@ def disable_minor_ticks(ax: plt.Axes) -> None:
219
217
 
220
218
  if __name__ == "__main__":
221
219
  setup_academic_style()
222
-
223
- save_folder = Path(__file__).resolve().parent / "examples"
224
- save_folder.mkdir(parents=True, exist_ok=True)
225
220
 
226
221
  # Modello comune per Esempio 1 ed Esempio 2
227
222
  A_true = 4.5e4
@@ -265,9 +260,6 @@ if __name__ == "__main__":
265
260
 
266
261
  ax.legend(loc="upper right", frameon=True, fancybox=False, facecolor="white", edgecolor="black", framealpha=1.0, borderpad=0.4, handlelength=1.4)
267
262
  fig.tight_layout(pad=0.3)
268
- fig.savefig(save_folder / "example_1_gaussian_scatter.pdf", dpi=300, bbox_inches="tight", pad_inches=0.08)
269
- print("Grafico 1 salvato.")
270
-
271
263
 
272
264
  # ──────────────────────────────────────────────────────────────────────────────
273
265
  # ESEMPIO 7: Gaussiana + Pannello Residui
@@ -318,9 +310,6 @@ if __name__ == "__main__":
318
310
 
319
311
  ax_main.legend(loc="upper right", frameon=True, fancybox=False, facecolor="white", edgecolor="black", framealpha=1.0, borderpad=0.4, handlelength=1.4)
320
312
  fig.tight_layout(pad=0.25)
321
- fig.savefig(save_folder / "example_2_gaussian_residuals.pdf", dpi=300, bbox_inches="tight", pad_inches=0.08)
322
- print("Grafico 2 salvato.")
323
-
324
313
 
325
314
  # ──────────────────────────────────────────────────────────────────────────────
326
315
  # ESEMPIO 8: Diagramma di Bode Modulo + Residui (Semilogaritmico)
@@ -371,9 +360,6 @@ if __name__ == "__main__":
371
360
 
372
361
  ax_main.legend(loc="lower left", frameon=True, fancybox=False, facecolor="white", edgecolor="black", framealpha=1.0, borderpad=0.4, handlelength=1.4)
373
362
  fig.tight_layout(pad=0.25)
374
- fig.savefig(save_folder / "example_3_log_residuals.pdf", dpi=300, bbox_inches="tight", pad_inches=0.08)
375
- print("Grafico 3 salvato.")
376
-
377
363
 
378
364
  # ──────────────────────────────────────────────────────────────────────────────
379
365
  # ESEMPIO 9: Grafico Log-Log Puro
@@ -405,7 +391,5 @@ if __name__ == "__main__":
405
391
 
406
392
  ax.legend(loc="upper right", frameon=True, fancybox=False, facecolor="white", edgecolor="black", framealpha=1.0, borderpad=0.4, handlelength=1.4)
407
393
  fig.tight_layout(pad=0.3)
408
- fig.savefig(save_folder / "example_4_scatter_log_both_axes.pdf", dpi=300, bbox_inches="tight", pad_inches=0.08)
409
- print("Grafico 4 salvato.")
410
394
 
411
395
  plt.show()