diff --git a/bin/minifollowups/pycbc_page_snglinfo b/bin/minifollowups/pycbc_page_snglinfo index e4e9edcd9e4..df9bb631beb 100644 --- a/bin/minifollowups/pycbc_page_snglinfo +++ b/bin/minifollowups/pycbc_page_snglinfo @@ -72,6 +72,7 @@ pycbc.init_logging(args.verbose) # Get the single-ifo triggers sngl_file = hdf.SingleDetTriggers( + args.single_trigger_file, args.instrument, bank_file=args.bank_file, veto_file=args.veto_file, diff --git a/bin/minifollowups/pycbc_plot_trigger_timeseries b/bin/minifollowups/pycbc_plot_trigger_timeseries index a5ce5a4895a..68cd473fa56 100644 --- a/bin/minifollowups/pycbc_plot_trigger_timeseries +++ b/bin/minifollowups/pycbc_plot_trigger_timeseries @@ -67,6 +67,8 @@ for ifo in args.single_trigger_files.keys(): group=ifo, indices_only=True ) + data_mask = np.zeros(data[ifo]['snr'].size, dtype=bool) + data_mask[idx] = True if not len(idx): # No triggers in this window, add to the legend and continue @@ -80,7 +82,7 @@ for ifo in args.single_trigger_files.keys(): trigs = SingleDetTriggers( args.single_trigger_files[ifo], ifo, - premask=idx + premask=data_mask ) any_data = True diff --git a/bin/plotting/pycbc_plot_hist b/bin/plotting/pycbc_plot_hist index 0f98a114ea8..b6602ab8bef 100644 --- a/bin/plotting/pycbc_plot_hist +++ b/bin/plotting/pycbc_plot_hist @@ -46,7 +46,7 @@ pycbc.init_logging(args.verbose) f = h5py.File(args.trigger_file, 'r') ifo = tuple(f.keys())[0] -# Apply presort if we can, if we cant, load everything but it may be +# Apply presort if we can; if we can't, load everything but it may be # inefficient xv = args.x_var if args.x_var in ranking.required_datasets else None xt = args.x_min if args.x_var in ranking.required_datasets else None diff --git a/bin/plotting/pycbc_plot_singles_vs_params b/bin/plotting/pycbc_plot_singles_vs_params index 59e22deddbf..be70e065a27 100644 --- a/bin/plotting/pycbc_plot_singles_vs_params +++ b/bin/plotting/pycbc_plot_singles_vs_params @@ -93,13 +93,14 @@ if opts.min_snr: idx = trig_file.select( lambda snr: snr >= opts.min_snr, 'snr', - group=opts.detector + group=opts.detector, + indices_only=True, ) logging.info('%d triggers after snr mask', idx.size) data_mask = np.zeros(n_triggers_orig, dtype=bool) data_mask[idx] = True else: - idx = None + data_mask = None if opts.z_var == 'density' or opts.min_z is None: filter_rank = None @@ -116,7 +117,7 @@ trigs = pycbc.io.SingleDetTriggers( veto_file=opts.veto_file, segment_name=opts.segment_name, premask=data_mask, - filter_func=opt.filter_string, + filter_func=opts.filter_string, filter_rank=filter_rank, filter_threshold=filter_thresh ) @@ -126,16 +127,16 @@ trigs = pycbc.io.SingleDetTriggers( x = getattr(trigs, opts.x_var) y = getattr(trigs, opts.y_var) -mask = np.ones(len(x), dtype=bool) -if opts.min_x is not None: - mask = np.logical_and(mask, x >= opts.min_x) -if opts.max_x is not None: - mask = np.logical_and(mask, x <= opts.max_x) -if opts.min_y is not None: - mask = np.logical_and(mask, y >= opts.min_y) -if opts.max_y is not None: - mask = np.logical_and(mask, y <= opts.max_y) -x = x[mask] +mask = np.ones(len(x), dtype=bool) +if opts.min_x is not None: + mask = np.logical_and(mask, x >= opts.min_x) +if opts.max_x is not None: + mask = np.logical_and(mask, x <= opts.max_x) +if opts.min_y is not None: + mask = np.logical_and(mask, y >= opts.min_y) +if opts.max_y is not None: + mask = np.logical_and(mask, y <= opts.max_y) +x = x[mask] y = y[mask] hexbin_style = { diff --git a/pycbc/io/hdf.py b/pycbc/io/hdf.py index 8042145651d..8d585c16361 100644 --- a/pycbc/io/hdf.py +++ b/pycbc/io/hdf.py @@ -519,7 +519,7 @@ def __init__(self, trig_file, detector, bank_file=None, veto_file=None, self.bank = {} # Apply some masks to start off with - here we should try and apply - # them in the order which cuts our the most things earliest. + # them in the order which cuts most things earliest. self.mask = premask if filter_rank: