diff --git a/gstlal-inspiral/bin/gstlal_inspiral_calc_snr b/gstlal-inspiral/bin/gstlal_inspiral_calc_snr index 680a63fe20b0321020098f2e4bdc624ea191fbb1..09ed6cc46dd0dc02ce6af809cec5fecf536a1e67 100755 --- a/gstlal-inspiral/bin/gstlal_inspiral_calc_snr +++ b/gstlal-inspiral/bin/gstlal_inspiral_calc_snr @@ -147,8 +147,9 @@ def parse_command_line(): options, args = parser.parse_args() # Check SNR series output - if options.start >= options.end: - raise ValueError("--start must less than --end.") + if options.start and options.end: + if options.start >= options.end: + raise ValueError("--start must less than --end.") # Setting up GW data gw_data_source_info = datasource.GWDataSourceInfo(options) diff --git a/gstlal-inspiral/python/svd_bank_snr.py b/gstlal-inspiral/python/svd_bank_snr.py index 6f40d7573d3a7390f33252ba1db94a40d6833481..36432b44d608787699f371ed0336abf3f00e0e2c 100644 --- a/gstlal-inspiral/python/svd_bank_snr.py +++ b/gstlal-inspiral/python/svd_bank_snr.py @@ -122,22 +122,25 @@ class SNR_Pipeline(object): def get_snr_series(self, COMPLEX = False, row_number = None, start = None, end = None): gps_start = self.snr_info["epoch"].gpsSeconds + self.snr_info["epoch"].gpsNanoSeconds * 10.**-9 gps = gps_start + numpy.arange(len(self.snr_info["data"])) * self.snr_info["deltaT"] + if start and end: + if start >= end: + raise ValueError("Start time must be less than end time.") - if start >= end: - raise ValueError("Start time must be less than end time.") + if start - gps[0] >= 0 and start - gps[-1] <= 0: + s = abs(gps - start).argmin() + else: + raise ValueError("Invalid choice of start time %f." % start) - if start - gps[0] >= 0 and start - gps[-1] <= 0: - s = abs(gps - start).argmin() - else: - raise ValueError("Invalid choice of start time %f." % start) + if end - gps[0] >= 0 and end - gps[-1] <= 0: + e = abs(gps - end).argmin() + else: + raise ValueError("Invalid choice of end time %f." % end) - if end - gps[0] >= 0 and end - gps[-1] <= 0: - e = abs(gps - end).argmin() + self.snr_info["epoch"] = gps[s] + self.snr_info["data"] = self.snr_info["data"][s:e].T else: - raise ValueError("Invalid choice of end time %f." % end) - - self.snr_info["epoch"] = gps[s] - self.snr_info["data"] = self.snr_info["data"][s:e].T + self.snr_info["epoch"] = gps[0] + self.snr_info["data"] = self.snr_info["data"].T if row_number is None: temp = []