induttori: T_INF letto da start/report.md invece di hardcoded
Aggiunge _leggi_t_inf() in app1/2/3.py che legge T∞ dal report generato da calcola_t_amb.py. Solleva errore esplicito se il file non esiste o il valore non è trovato. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a30a9410c7
commit
6a38284e1d
3 files changed
+36
-3
No files matched your search
+12
-1
@@ -1,3 +1,4 @@
|
||||
import re
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
@@ -9,7 +10,17 @@ ROOT = Path(__file__).parent.parent
|
||||
df = pd.read_csv(ROOT / "data.csv")
|
||||
df["time_s"] = df["time since start [ms]"] / 1000.0
|
||||
|
||||
T_INF = 22.99 # temperatura ambiente [°C]
|
||||
def _leggi_t_inf() -> float:
|
||||
report = ROOT / "start" / "report.md"
|
||||
if not report.exists():
|
||||
raise FileNotFoundError("start/report.md non trovato. Esegui prima 'Calcola T ambiente'.")
|
||||
m = re.search(r"media ponderata\*\*\s*\|\s*\*\*([0-9.]+)\s*°C",
|
||||
report.read_text(encoding="utf-8"))
|
||||
if not m:
|
||||
raise ValueError("T∞ non trovata in start/report.md.")
|
||||
return float(m.group(1))
|
||||
|
||||
T_INF = _leggi_t_inf() # temperatura ambiente [°C], letta da start/report.md
|
||||
T0 = 110.81 # inizio intervallo [s]
|
||||
T_END = 111.56 # fine intervallo [s]
|
||||
|
||||
|
||||
+12
-1
@@ -1,3 +1,4 @@
|
||||
import re
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
@@ -9,7 +10,17 @@ ROOT = Path(__file__).parent.parent
|
||||
df = pd.read_csv(ROOT / "data.csv")
|
||||
df["time_s"] = df["time since start [ms]"] / 1000.0
|
||||
|
||||
T_INF = 22.99 # temperatura ambiente [°C]
|
||||
def _leggi_t_inf() -> float:
|
||||
report = ROOT / "start" / "report.md"
|
||||
if not report.exists():
|
||||
raise FileNotFoundError("start/report.md non trovato. Esegui prima 'Calcola T ambiente'.")
|
||||
m = re.search(r"media ponderata\*\*\s*\|\s*\*\*([0-9.]+)\s*°C",
|
||||
report.read_text(encoding="utf-8"))
|
||||
if not m:
|
||||
raise ValueError("T∞ non trovata in start/report.md.")
|
||||
return float(m.group(1))
|
||||
|
||||
T_INF = _leggi_t_inf() # temperatura ambiente [°C], letta da start/report.md
|
||||
T0 = 112.02 # inizio intervallo [s]
|
||||
T_END = 113.95 # fine intervallo [s]
|
||||
|
||||
|
||||
+12
-1
@@ -1,3 +1,4 @@
|
||||
import re
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
@@ -9,7 +10,17 @@ ROOT = Path(__file__).parent.parent
|
||||
df = pd.read_csv(ROOT / "data.csv")
|
||||
df["time_s"] = df["time since start [ms]"] / 1000.0
|
||||
|
||||
T_INF = 22.99 # temperatura ambiente [°C]
|
||||
def _leggi_t_inf() -> float:
|
||||
report = ROOT / "start" / "report.md"
|
||||
if not report.exists():
|
||||
raise FileNotFoundError("start/report.md non trovato. Esegui prima 'Calcola T ambiente'.")
|
||||
m = re.search(r"media ponderata\*\*\s*\|\s*\*\*([0-9.]+)\s*°C",
|
||||
report.read_text(encoding="utf-8"))
|
||||
if not m:
|
||||
raise ValueError("T∞ non trovata in start/report.md.")
|
||||
return float(m.group(1))
|
||||
|
||||
T_INF = _leggi_t_inf() # temperatura ambiente [°C], letta da start/report.md
|
||||
T0 = 115.0 # inizio intervallo [s]
|
||||
T_END = 133.7 # fine intervallo [s] — ultimo campione nel dataset
|
||||
W0_START = 115.9 # inizio zona esclusa [s] (None = nessuna esclusione)
|
||||
|
||||
Reference in new issue
Block a user