Open asadisaghar opened 8 years ago
def average_correlation(d):
"d is a correlation dataset for one lc pair"
wids = np.unique(d['window_id'])
ws = [d[d['window_id'] == wid] for wid in wids]
minoffset = np.max([w['offset'].min() for w in ws])
maxoffset = np.min([w['offset'].max() for w in ws])
ws = [w[(w['offset'] >= minoffset) & (w['offset'] <= maxoffset)] for w in ws]
correlations = ws[0]['correlation']
for w in ws[1:]:
correlations += w['correlation']
offsets = ws[0]['offset']
return offsets, correlations
instead of finding a maximum for the correlation function in each window, we should try to average the correlation values for various time shifts across windows and find one value as our estimated maximum correlation/time delay for each pair