Skip to content

Commit

Permalink
Add nthreads to build list calls in interactive parser (#44)
Browse files Browse the repository at this point in the history
* add nthreads to build list calls in interactive util

* add nthreads to build data list functions and plot argparser

---------

Co-authored-by: Cleveland <[email protected]>
  • Loading branch information
clevelam and Cleveland authored Feb 5, 2024
1 parent 2dcee0d commit cacaf79
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions opppy/interactive_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 = []
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit cacaf79

Please sign in to comment.