Skip to content

Commit 065d1c0

Browse files
authored
small fixes (#59)
* skip check for events if before 2020 * load rates in sections if ext fra longer than 45 days
1 parent 25f3609 commit 065d1c0

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

fast_response/GWFollowup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def check_events_after(self):
163163

164164
t1 = Time(datetime.datetime.utcnow()).mjd
165165
if ((t1-self.stop)*86400.)>5000.:
166-
#if it's been long enough, only load 1000s
166+
#if it's been long enough, only load 2000s
167167
print('Loading 2000s of data after the time window')
168168
t1 = self.stop + 2000./86400.
169169
exp_long, livetime_long, grl_long = self.dset.livestream(
@@ -179,6 +179,9 @@ def check_events_after(self):
179179
if exp_long[mask].size > 0:
180180
check_passed = True
181181
print('Found {} events after end of time window'.format(exp_long[mask].size))
182+
# elif Time(datetime.datetime.utcnow()).mjd > (self.stop + 5000./86400.):
183+
# raise Exception('No events found 2000 seconds after GW event.')
184+
182185
return check_passed
183186

184187
def initialize_llh(self, skipped=None, scramble=False):
@@ -209,10 +212,14 @@ def initialize_llh(self, skipped=None, scramble=False):
209212
dset = Datasets[self.dataset]
210213
self.dset = dset
211214
check_passed = False
212-
print('Checking for events after time window')
215+
if self.stop < 59215:
216+
print('Old times: Skipping check for events after time window')
217+
check_passed = True
218+
else:
219+
print('Checking for events after time window')
220+
213221
while not check_passed:
214222
check_passed = self.check_events_after()
215-
216223
self.get_data()
217224

218225
if self._verbose:

fast_response/make_ontime_plots.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,24 @@ def make_rate_plots(time_window, run_table, query_events, dirname, season='neutr
165165
plt.locator_params(axis='x', nbins = 8)
166166
plt.grid(b = True, axis = 'y', alpha = 0.3)
167167
plt.savefig('{}/badness_plot.png'.format(dirname))
168-
168+
169169
try:
170-
rates = icecube.realtime_tools.live.get_rates(run_table[0]['start'], run_table[-1]['stop'])
170+
if (Time(run_table[-1]['stop'],format='iso',scale='utc').mjd \
171+
- Time(run_table[0]['start'],format='iso',scale='utc').mjd) > 45.:
172+
#load as two sections, otherwise this may time out
173+
midpt = Time(Time(run_table[0]['start'],format='iso',scale='utc').mjd + 35.,
174+
format='mjd').iso #first 35 days
175+
rates1 = icecube.realtime_tools.live.get_rates(run_table[0]['start'], midpt)
176+
rates2 = icecube.realtime_tools.live.get_rates(midpt, run_table[-1]['stop'])
177+
#avoid double counting last entry
178+
rates = np.concatenate([rates1, rates2])
179+
else:
180+
rates = icecube.realtime_tools.live.get_rates(run_table[0]['start'], run_table[-1]['stop'])
171181
except Exception as e:
172182
#rates=np.load('/data/user/jthwaites/FastResponseAnalysis/output/2022_2mo_followup_rates.npy')
173183
print(e)
174184
print("Failed to load rates. In case of timeout: save rate information and reload manually")
175-
print("Check lines 115-119 of make_ontime_plots.py")
185+
print("Check lines 169-179 of make_ontime_plots.py")
176186
return
177187

178188
########## MAKE RATES PLOTS ##########

0 commit comments

Comments
 (0)