CSVVisualizer.py aktualisiert
Open the CSV Find the first line where the first cell starts with "Cycle" Use that entire line as the plot title (Chat)
This commit is contained in:
parent
f06ccc2e6a
commit
a3bbfac3cf
@ -68,11 +68,13 @@ class CSVVisualizer:
|
||||
if not filepath:
|
||||
return
|
||||
|
||||
self.graph_title = "Battery Test Analysis" # Default title
|
||||
with open(filepath, 'r') as f:
|
||||
reader = csv.reader(f)
|
||||
headers = next(reader) # Zeile 0
|
||||
second_line = next(reader, []) # Zeile 1 (Titel)
|
||||
self.graph_title = second_line[0] if second_line else "Battery Test Analysis"
|
||||
for row in reader:
|
||||
if row and row[0].startswith("Cycle"):
|
||||
self.graph_title = ", ".join(row).strip()
|
||||
break
|
||||
|
||||
try:
|
||||
# First detect problematic lines
|
||||
@ -103,7 +105,7 @@ class CSVVisualizer:
|
||||
return
|
||||
|
||||
# Now read only valid lines
|
||||
self.status_var.set("Verarbeite gültige Zeilen…")
|
||||
self.status_var.set("Verarbeite gültige Zeile...")
|
||||
self.root.update_idletasks()
|
||||
self.df = pd.read_csv(
|
||||
filepath,
|
||||
@ -123,7 +125,7 @@ class CSVVisualizer:
|
||||
)
|
||||
|
||||
self.file_label.config(text=os.path.basename(filepath))
|
||||
self.status_var.set(f"Loaded: {len(self.df)} valid measurements")
|
||||
self.status_var.set(f"Working with: {len(self.df)} valid measurements...")
|
||||
self.root.update_idletasks()
|
||||
self.update_plot()
|
||||
|
||||
@ -148,7 +150,7 @@ class CSVVisualizer:
|
||||
# Spannung plotten
|
||||
self.ax.plot(df_clean["Relative_Time(s)"], df_clean["Voltage(V)"],
|
||||
label="Voltage (V)", color="black", linewidth=1.5)
|
||||
self.ax.margins(x=0)
|
||||
#self.ax.margins(x=0)
|
||||
|
||||
# Phasen als farbige Hintergründe
|
||||
start_idx = 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user