Skip to content

Commit

Permalink
bug fix for if no triggers after cuts in single_trigger_fits, remove …
Browse files Browse the repository at this point in the history
…unused import and fix regex
  • Loading branch information
Gareth Davies committed Jul 30, 2020
1 parent 284e769 commit 912bf15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions bin/live/pycbc_live_combine_single_fits
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@ for f in files:
- datetime.date(2000, 1, 1)).days
analysis_dates += [n_since_epoch]
else:
# This is the regex string to match a date in format YYYY_MM_DD,
# This is the regex string to match a date in format YYYY_MM_DD,
# or if MM or DD only have one character
# FutureWarning: this will become obsolete in the year 3000
re_string = '([12]\d{3}_(0?[1-9]|1[0-2])_(0?[1-9]|[12]\d|3[01]))'
m = re.search(re_string, f)
date_array = m.group(0).split('_')
analysis_year = int(date_array[0])
analysis_month = int(date_array[1])
analysis_day = int(date_array[2])
analysis_year = int(m.group(1))
analysis_month = int(m.group(2))
analysis_day = int(m.group(3))
n_since_epoch = (datetime.date(analysis_year, analysis_month,
analysis_day)
- datetime.date(2000,1,1)).days
Expand Down
6 changes: 3 additions & 3 deletions bin/live/pycbc_live_single_trigger_fits
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ from pycbc.events import triggers, trigger_fits as trstats
from pycbc.io import DictArray
from pycbc.events import ranking
import argparse, logging, operator, os, sys, re, h5py
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot as plt

def inequality_string_to_function(inequ):
if inequ == "==":
Expand Down Expand Up @@ -100,6 +97,8 @@ args = parser.parse_args()

pycbc.init_logging(args.verbose)

logging.info("Finding files")

files = [f for f in os.listdir(os.path.join(args.top_directory, args.analysis_date))
if args.file_identifier in f]

Expand Down Expand Up @@ -264,6 +263,7 @@ if cutting_newsnr:
events[ifo] = events[ifo].select(idx_keep)
else:
logging.info("Too many cuts on the data - removed everything from " + ifo)
events[ifo] = events[ifo].select(idx_keep)

logging.info("Number of events which meet all criteria:")
for ifo in args.ifos:
Expand Down

0 comments on commit 912bf15

Please sign in to comment.