fix matplotlib

This commit is contained in:
awe
2026-02-03 19:06:26 +03:00
parent 3a072f0298
commit 6f5dfafbfb

View File

@ -67,6 +67,10 @@ def run_matplotlib(args):
ref_in_file = getattr(args, 'ref_in', None)
ref_out_saved = False # Флаг, что медиана уже сохранена
# DEBUG: Проверяем что параметр установлен
if ref_out_file:
print(f"[ref-out] Автосохранение включено, файл: {ref_out_file}")
# Автоматическая загрузка медианы при старте
if ref_in_file:
try:
@ -593,12 +597,17 @@ def run_matplotlib(args):
# Автоматическое сохранение медианы при накоплении 1000+ свипов
if ref_out_file and not ref_out_saved and ring is not None:
filled_count = np.count_nonzero(~np.isnan(ring[:, 0]))
# DEBUG: Выводим прогресс каждые 100 свипов
if filled_count % 100 == 0 and filled_count > 0:
print(f"[ref-out] Прогресс: {filled_count}/1000 свипов накоплено")
if filled_count >= 1000:
print(f"[ref-out] Достигнуто 1000 свипов, начинаем сохранение...")
try:
# Получаем последние 1000 свипов
ordered = ring if head == 0 else np.roll(ring, -head, axis=0)
recent_sweeps = ordered[-1000:, :]
median_sweep = np.nanmedian(recent_sweeps, axis=0)
print(f"[ref-out] Медиана вычислена, размер: {len(median_sweep)}")
# Сохраняем в файл
with open(ref_out_file, 'w', newline='') as f: