From cacaf79b08f236f00e10aa4e300028858ba07329 Mon Sep 17 00:00:00 2001 From: Mathew Cleveland Date: Mon, 5 Feb 2024 07:45:34 -0700 Subject: [PATCH] Add nthreads to build list calls in interactive parser (#44) * add nthreads to build list calls in interactive util * add nthreads to build data list functions and plot argparser --------- Co-authored-by: Cleveland --- opppy/interactive_utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/opppy/interactive_utils.py b/opppy/interactive_utils.py index 942c28d..005faba 100644 --- a/opppy/interactive_utils.py +++ b/opppy/interactive_utils.py @@ -196,7 +196,8 @@ def plot_dictionary(self, args): dictionaries = [] file_names = [] if args.output_files is not None: - dictionaries, file_names = build_output_dictionary_list(args.output_files, self.opppy_parser) + dictionaries, file_names = build_output_dictionary_list(args.output_files, + self.opppy_parser, nthreads=args.nthreads) else: # get the dictionaries from the pickle files file_names = args.pickle_files @@ -249,6 +250,7 @@ def get_interactive_plot_parser(self): parser.add_argument('-p','--plot', dest='plot', help='re-open plot', nargs='?', type=bool, const=True, default=False) parser.add_argument('-l','--labels', dest='legend_labels', help='specify the legend labels [line1_label, line2_label,...]', type=str, nargs='+') parser.add_argument('-rs','--resize', dest='plot_size', help='specify the plot size [x_size, y_size]', type=float, nargs=2) + parser.add_argument('-nt','--nthreads', dest='nthreads', help='Number of threads to use during parsing', nargs='?', type=int, default=0) add_plot_options(parser) return parser @@ -266,7 +268,9 @@ def plot_output(self, args): dictionary_data=[] dictionary_names=[] if args.output_files is not None: - dictionary_data, dictionary_names = build_output_dictionary_list(args.output_files, self.opppy_parser) + dictionary_data, dictionary_names = build_output_dictionary_list(args.output_files, + self.opppy_parser, + nthreads=args.nthreads) else: # We no longer flatten this data #file_list = [] @@ -974,7 +978,8 @@ def plot_tally(self, args): raw_dictionary_data=[] raw_dictionary_names=[] if args.tally_files is not None: - raw_dictionary_data, raw_dictionary_names = build_tally_dictionary_list(args.tally_files, self.opppy_parser) + raw_dictionary_data, raw_dictionary_names = build_tally_dictionary_list(args.tally_files, + self.opppy_parser, nthreads=args.nthreads) else: for pickle_file_name in args.pickle_files: raw_dictionary_names.append(pickle_file_name.split('/')[-1].split('.p')[0]) @@ -1066,7 +1071,8 @@ def plot_interactive_tally(self, args): raw_dictionary_data=[] raw_dictionary_names=[] if args.tally_files is not None: - raw_dictionary_data, raw_dictionary_names = build_tally_dictionary_list(args.tally_files, self.opppy_parser) + raw_dictionary_data, raw_dictionary_names = build_tally_dictionary_list(args.tally_files, + self.opppy_parser, nthreads=args.nthreads) else: for pickle_file_name in args.pickle_files: raw_dictionary_names.append(pickle_file_name.split('/')[-1].split('.p')[0])