Skip to content

Commit

Permalink
clarify sort option
Browse files Browse the repository at this point in the history
  • Loading branch information
tdent authored Oct 30, 2023
1 parent fedbf78 commit d20ba72
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bin/all_sky_search/pycbc_plot_kde_vals
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ parser.add_argument('--log-axis', nargs='+', choices=['True', 'False'], required
help='For each parameter, specify True for a log axis and False '
'for a linear axis')
parser.add_argument('--plot-type', choices=['kde_vs_param', 'param_vs_param'])
parser.add_argument('--sort-type', choices=['file', 'increasing', 'decreasing'], default='file',
help='Choose how to sort the values: "file" or "increasing" or "decreasing"')
parser.add_argument('--plot-order', choices=['file', 'increasing', 'decreasing'],
default='file',
help='Choose the order to plot KDE values in: "file", "increasing" or
"decreasing"')
parser.add_argument('--which-kde', choices=['signal_kde', 'template_kde', 'ratio_kde'])
parser.add_argument('--plot-dir', required=True)
parser.add_argument('--verbose', action='count')
Expand Down Expand Up @@ -44,13 +46,13 @@ kde_values = {
'ratio_kde': signal_kde / template_kde,
}[args.which_kde]

if args.sort_type == 'increasing':
# Sort each of the parameter arrays
if args.plot_order == 'increasing':
idx = numpy.argsort(kde_values)
elif args.sort_type == 'decreasing':
elif args.plot_order == 'decreasing':
idx = numpy.argsort(kde_values)[::-1]
else:
idx = numpy.arange(len(kde_values))
# Sort each of the parameter arrays
param_arrays = [param[idx] for param in param_arrays]
param0 = param_arrays[0]
param1 = param_arrays[1] if len(param_arrays) > 1 else None
Expand Down

0 comments on commit d20ba72

Please sign in to comment.