Clustering Gravity Spy Events¶
Introduction¶
Cluster a Table Of Events¶
stuff
In [1]: from gravityspy.table import Events
In [2]: virgo_images = Events.fetch('gravityspy', 'updated_similarity_index WHERE ifo = \'V1\'')
In [3]: virgo_glitch_info = Events.fetch('gravityspy', 'glitches WHERE ifo = \'V1\'')
In [4]: virgo_clusters = virgo_images.cluster(60)
In [5]: print(virgo_clusters.to_pandas().clusters.value_counts())
36 3364
18 2162
0 2148
42 1360
22 1322
21 1212
30 1120
41 1090
3 1038
52 1029
37 999
57 966
16 955
9 926
45 913
47 896
4 809
34 721
7 715
40 700
19 699
26 689
23 688
1 687
38 673
5 668
43 603
48 580
32 577
49 549
59 540
24 528
39 525
6 504
13 490
46 468
55 452
53 438
10 432
51 378
50 357
15 343
25 320
31 319
44 272
56 263
14 262
12 233
27 224
8 183
35 183
33 183
29 159
20 157
2 155
54 150
58 134
17 106
11 73
28 58
Name: clusters, dtype: int64
In [6]: allinfo = Events.from_pandas(virgo_clusters.to_pandas().drop_duplicates(['links_subjects']).merge(virgo_glitch_info.to_pandas(),on=['uniqueID', 'ifo', 'links_subjects']))
In [7]: allinfo['Label'] = allinfo['clusters']
In [8]: allinfo['Label'] = allinfo['Label'].astype(str)