2026-04-01 09:32:16 +02:00
import pandas as pd
import matplotlib.pyplot as plt
2026-05-14 09:46:13 +02:00
from pathlib import Path
2026-04-01 09:32:16 +02:00
2026-05-14 09:46:13 +02:00
ROOT = Path ( __file__ ) . parent . parent
df = pd . read_csv ( ROOT / "data.csv" )
2026-04-01 09:32:16 +02:00
df [ "time_s" ] = df [ "time since start [ms]" ] / 1000.0
2026-05-14 09:46:13 +02:00
T0 = 105.0 # inizio finestra [s]
T_END = 133.7 # fine finestra [s] — ultimo campione nel dataset
df = df [( df [ "time_s" ] >= T0 ) & ( df [ "time_s" ] <= T_END )]
2026-04-01 09:32:16 +02:00
fig , ax = plt . subplots ( figsize = ( 12 , 5 ))
ax . plot ( df [ "time_s" ], df [ "temp_amb IR [C]" ], label = "Temperatura ambiente" , linewidth = 1 )
2026-05-20 11:48:05 +02:00
ax . plot ( df [ "time_s" ], df [ "temp_obj IR [C]" ], label = "Temperatura scatola" , linewidth = 1 , marker = 'o' , markersize = 1 , markerfacecolor = "orange" , markeredgecolor = "blue" )
2026-04-01 09:32:16 +02:00
ax . set_xlabel ( "Tempo [s]" )
ax . set_ylabel ( "Temperatura [°C]" )
ax . set_title ( "Profilo termico scatola in forno" )
ax . legend ()
ax . grid ( True , alpha = 0.3 )
plt . tight_layout ()
2026-05-14 09:46:13 +02:00
plt . savefig ( Path ( __file__ ) . parent / "plot_temperatura.png" , dpi = 150 , bbox_inches = "tight" )
2026-04-01 09:32:16 +02:00
plt . show ()