Skip to content

Commit

Permalink
max z problem
Browse files Browse the repository at this point in the history
  • Loading branch information
GarethCabournDavies committed Nov 27, 2023
1 parent 9dbed91 commit a2ab781
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
30 changes: 23 additions & 7 deletions bin/plotting/pycbc_plot_singles_vs_params
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,29 @@ if opts.max_y is not None:
x = x[mask]
y = y[mask]

title = '%s of %s triggers over %s and %s' % (opts.z_var.title(),
opts.detector, opts.x_var.title(), opts.y_var.title())
fig_caption = ("This plot shows the %s of single detector triggers for the %s "
"detector. %s is shown on the colorbar axis against %s and %s "
"on the x- and y-axes." % (opts.z_var, opts.detector,
opts.z_var.title(), opts.x_var, opts.y_var))

if not any(mask):
# All triggers removed - make a blank plot which says so:
fig = pl.figure()
ax = fig.gca()
pl.text(0.5, 0.5, 'no triggers in the range')

pycbc.results.save_fig_with_metadata(
fig,
opts.output_file,
title=title,
caption=fig_caption,
cmd=' '.join(sys.argv),
fig_kwds={'dpi': 200}
)
sys.exit()

hexbin_style = {
'gridsize': opts.grid_size,
'linewidths': 0.03
Expand All @@ -161,7 +184,6 @@ logging.info('Plotting')
fig = pl.figure()
ax = fig.gca()


if opts.z_var == 'density':
hb = ax.hexbin(x, y, **hexbin_style)
fig.colorbar(hb, ticks=LogLocator(subs=range(10)))
Expand All @@ -182,12 +204,6 @@ else:
ax.set_xlabel(opts.x_var)
ax.set_ylabel(opts.y_var)
ax.set_title(opts.z_var.title() + ' of %s triggers ' % (opts.detector))
title = '%s of %s triggers over %s and %s' % (opts.z_var.title(),
opts.detector, opts.x_var.title(), opts.y_var.title())
fig_caption = ("This plot shows the %s of single detector triggers for the %s "
"detector. %s is shown on the colorbar axis against %s and %s "
"on the x- and y-axes." % (opts.z_var, opts.detector,
opts.z_var.title(), opts.x_var, opts.y_var))
pycbc.results.save_fig_with_metadata(fig, opts.output_file, title=title,
caption=fig_caption, cmd=' '.join(sys.argv),
fig_kwds={'dpi': 200})
Expand Down
4 changes: 2 additions & 2 deletions examples/search/plotting.ini
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ gradient-far =
missed-on-top =

[plot_singles]
min-snr = 6
min-snr = 5.5

[plot_singles-mtotal_eta_newsnr]
x-var = mtotal
log-x =
y-var = eta
z-var = "newsnr_sgveto"
min-z = 6
min-z = 5.5

[plot_range]

Expand Down

0 comments on commit a2ab781

Please sign in to comment.