From 2d7ba5c60c14478b7c9359b3ae64de622f15a13c Mon Sep 17 00:00:00 2001 From: ianchb Date: Mon, 9 Feb 2026 09:31:55 +0000 Subject: [PATCH] [2/2] Implement multiprocessing-based parallel plotting --- plot_xiaoqu.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plot_xiaoqu.py b/plot_xiaoqu.py index 7969a4f..6e843d0 100755 --- a/plot_xiaoqu.py +++ b/plot_xiaoqu.py @@ -17,6 +17,7 @@ import os ## operating system utilities import plot_binary_data import AMSS_NCKU_Input as input_data +from parallel_plot_helper import run_plot_tasks_parallel # plt.rcParams['text.usetex'] = True ## enable LaTeX fonts in plots @@ -52,10 +53,13 @@ def generate_binary_data_plot( binary_outdir, figure_outdir ): file_list.append(x) print(x) - ## Plot each file in the list + ## Plot each file in the list (in parallel) + plot_tasks = [] for filename in file_list: print(filename) - plot_binary_data.plot_binary_data(filename, binary_outdir, figure_outdir) + plot_tasks.append( ( plot_binary_data.plot_binary_data, (filename, binary_outdir, figure_outdir) ) ) + + run_plot_tasks_parallel(plot_tasks) print( ) print( " Binary Data Plot Has been Finished " )