diff --git a/bin/plotting/pycbc_plot_singles_vs_params b/bin/plotting/pycbc_plot_singles_vs_params index c7569ae2671..e3ab1ca3852 100644 --- a/bin/plotting/pycbc_plot_singles_vs_params +++ b/bin/plotting/pycbc_plot_singles_vs_params @@ -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 @@ -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))) @@ -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}) diff --git a/examples/search/plotting.ini b/examples/search/plotting.ini index 4ecf6cd01c2..696dcd5806a 100644 --- a/examples/search/plotting.ini +++ b/examples/search/plotting.ini @@ -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]