Skip to content

Instantly share code, notes, and snippets.

@153957
Created March 19, 2014 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 153957/9638912 to your computer and use it in GitHub Desktop.
Save 153957/9638912 to your computer and use it in GitHub Desktop.
Check for coincidences between stations from different clusters.
import tables
data = tables.openFile('2013_8_1.h5', 'r')
c_index = data.root.coincidences.c_index
s_index = data.root.coincidences.s_index
clusters = [s_group.split('/')[2][8:] for s_group in s_index[:]]
stations = [s_group.split('/')[3][8:] for s_group in s_index[:]]
counter = 0
for c_id, c_idx in enumerate(c_index[:]):
clusters_in_c = []
for s_idx, e_idx in c_idx:
cluster = clusters[s_idx]
if not cluster in clusters_in_c:
clusters_in_c.append(cluster)
if len(clusters_in_c) > 1:
counter += 1
print ('coincidence_id: %d events: %d clusters: %s' %
(c_id, coincidences[c_id]['N'], clusters_in_c))
print ('Total coincidences: %d Coincidences spanning clusters: %d'
(c_index.nrows, counter)
data.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment