Parameterize Python plotting utilities in utils/python

This commit is contained in:
Carles Fernandez
2026-06-23 15:49:25 +02:00
parent e3847b4312
commit e438d08c6e
17 changed files with 1827 additions and 716 deletions
+8 -6
View File
@@ -32,9 +32,8 @@ import os
def plotKalman(channelNr, trackResults, settings):
# ---------- CHANGE HERE (or pass 'fig_path' in settings):
fig_path = settings.get('fig_path',
'../../../PLOTS/PlotKalman')
fig_path = settings.get('fig_path', 'plots/kalman')
output_format = settings.get('output_format', 'png')
if not os.path.exists(fig_path):
os.makedirs(fig_path)
@@ -140,6 +139,9 @@ def plotKalman(channelNr, trackResults, settings):
plt.savefig(os.path.join(fig_path,
f'kalman_ch{channelNr}_PRN_'
f'{trackResults[channelNr - 1]["PRN"][-1]}'
f'.png'))
if settings.get('show', True):
plt.show()
f'.{output_format}'))
# Close unless it will be shown; the caller triggers a single
# plt.show() at the end. Avoids repeated show()/close() cycles, which
# can crash interactive matplotlib backends (e.g. macOS) on close.
if not settings.get('show', True):
plt.close()