-
Notifications
You must be signed in to change notification settings - Fork 2
/
repeaters.html
415 lines (329 loc) · 13.8 KB
/
repeaters.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Repeaters | FRBSTATS</title>
<link rel="shortcut icon" href="favicon.ico" />
<!-- Fonts-->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<script src="script.js"></script>
<link
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel="stylesheet">
<!-- Styles-->
<link href="css/style_overview.min.css" rel="stylesheet">
<style>
.node {
cursor: pointer;
}
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 2px;
}
.node text {
font: 10px sans-serif;
}
.link {
fill: none;
stroke: #ccc;
stroke-width: 1px;
}
</style>
</head>
<body id="page-top">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script>
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center justify-content-center" href=".">
<div class="sidebar-brand-icon rotate-n-0">
<i class="fas fa-database"></i>
</div>
<div style="font-size: 18px;" class="sidebar-brand-text mx-2">FRBSTATS</div>
</a>
<!-- Divider -->
<hr class="sidebar-divider my-0">
<!-- Nav Item -->
<li class="nav-item">
<a class="nav-link" href=".">
<i style="font-size:15px" class="fas fa-fw fa-info-circle"></i>
<span style="font-size:15px">Overview</span></a>
</li>
<!-- Divider -->
<hr class="sidebar-divider">
<!-- Nav Item -->
<li class="nav-item">
<a class="nav-link" href="catalogue">
<i style="font-size:15px" class="fas fa-fw fa-clipboard-list"></i>
<span style="font-size:15px">Catalogue</span></a>
</li>
<!-- Nav Item -->
<li class="nav-item active">
<a class="nav-link" href="repeaters">
<i style="font-size:15px" class="fas fa-fw fa-sync-alt"></i>
<span style="font-size:15px">Repeaters</span></a>
</li>
<!-- Nav Item -->
<li class="nav-item">
<a class="nav-link" href="plots">
<i style="font-size:15px" class="fas fa-fw fa-chart-line"></i>
<span style="font-size:15px">Plots</span></a>
</li>
<!-- Divider -->
<hr class="sidebar-divider my-0">
<!-- Nav Item -->
<li class="nav-item">
<a class="nav-link" href="api">
<i style="font-size:15px" class="fas fa-fw fa-cog"></i>
<span style="font-size:15px">API</span></a>
</li>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars" aria-hidden="true"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav">
<a style="font-size:28px;color:#4e73df">FRBSTATS:</a>
<a style="font-size:28px;color:#5a5c69;white-space: pre"> Repeaters</a>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h3 mb-2 text-gray-800">Repeating Events</h1>
<p class="mb-4">This page presents the distribution of <b>FRB repeaters</b> discovered to date.
The original events are linked to follow-up bursts that have been observed and associated with the same source in the sky, in a parent-child relationship.
Repeater(s) in <a style="color:red">red</a> correspond to candidates identified by the clustering algorithm that have not been previously reported.
Click on a repeater (parent node) to view the <b>time series</b> of the corresponding bursts.
</p>
<!-- Content Row -->
<div id="tree">
<script>
// Generate FRB repeater tree
var margin = {top: 0, right: 0, bottom: 0, left: 80},
width = 600 - margin.right - margin.left,
height = 2100 - margin.top - margin.bottom;
var i = 0,
duration = 1000,
root;
var tree = d3.layout.tree()
.size([height, width]);
var diagonal = d3.svg.diagonal()
.projection(function(d) { return [d.y, d.x]; });
var svg = d3.select("#tree").append("svg")
.attr("viewBox", "0 0 " + 600 + " " + 2100)
.attr("preserveAspectRatio", "xMidYMid meet")
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
root = treeData[0];
root.x0 = height / 2;
root.y0 = 0;
update(root);
d3.select(self.frameElement).style("height", "500px");
function update(source) {
// Compute the new tree layout.
var nodes = tree.nodes(root).reverse(),
links = tree.links(nodes);
// Normalize for fixed-depth.
nodes.forEach(function(d) { d.y = d.depth * 180; });
// Update the nodes…
var node = svg.selectAll("g.node")
.data(nodes, function(d) { return d.id || (d.id = ++i); });
// Enter any new nodes at the parent's previous position.
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
.on("click", click);
nodeEnter.append("circle")
.attr("r", 1e-6)
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
nodeEnter.append("text")
.attr("x", function(d) { return d.children || d._children ? -13 : 13; })
.attr("dy", ".35em")
.attr("onclick", "set_frb(this.textContent); updateFig()")
.attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; })
.text(function(d) { return d.name; })
.style("fill-opacity", 1e-6);
// Transition nodes to their new position.
var nodeUpdate = node.transition()
.duration(duration)
.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
nodeUpdate.select("circle")
.attr("r", 4)
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
nodeUpdate.select("text")
.style("fill-opacity", 1);
// Transition exiting nodes to the parent's new position.
var nodeExit = node.exit().transition()
.duration(duration)
.attr("transform", function(d) { return "translate(" + source.y + "," + source.x + ")"; })
.remove();
nodeExit.select("circle")
.attr("r", 1e-6);
nodeExit.select("text")
.style("fill-opacity", 1e-6);
// Update the links…
var link = svg.selectAll("path.link")
.data(links, function(d) { return d.target.id; });
// Enter any new links at the parent's previous position.
link.enter().insert("path", "g")
.attr("class", "link")
.attr("d", function(d) {
var o = {x: source.x0, y: source.y0};
return diagonal({source: o, target: o});
});
// Transition links to their new position.
link.transition()
.duration(duration)
.attr("d", diagonal);
// Transition exiting nodes to the parent's new position.
link.exit().transition()
.duration(duration)
.attr("d", function(d) {
var o = {x: source.x, y: source.y};
return diagonal({source: o, target: o});
})
.remove();
// Stash the old positions for transition.
nodes.forEach(function(d) {
d.x0 = d.x;
d.y0 = d.y;
});
}
// Toggle children on click.
function click(d) {
if (d.children) {
d._children = d.children;
d.children = null;
} else {
d.children = d._children;
d._children = null;
}
update(d);
}
// Color new repeater candidates in red
document.querySelector("#tree > svg > g > g:nth-child(251) > text").style.fill="#FF0000";
</script>
</div>
<div id="results" style="margin-top: -25%; visibility: hidden">
<hr>
<div class="card mb-4">
<div class="card-header py-3">
<h6 style="font-size:19px" class="font-weight-bold text-primary">Results</h6>
</div>
<div class="card-body">
<center>
<img class="img-fluid px-3 px-sm-4 mt-3 mb-4" src="figs/none_none.svg" name="fig">
</center>
<i class="fas fa-code fa-sm" aria-hidden="true" style="font-size: 110%; color:#4e73df; margin-left:12px;"></i>
<a id="sourceCode" target="_blank" href="https://github.com/HeRTA/FRBSTATS/blob/main/figs" style="font-size: 110%">View Source</a>
<i class="fas fa-table fa-sm" aria-hidden="true" style="font-size: 110%; color:#4e73df; margin-left:48px;"></i>
<a id="Table" target="_blank" href="#" style="font-size: 110%">Repeater Table</a>
<a id="savePdf" style="margin-right: 4px; margin-left: 4px; font-size: 100%; float:right" href="figs/none_none.pdf" download="" class="d-none d-sm-inline-block btn btn-sm btn-danger shadow-sm"><i class="fas fa-file-pdf fa-sm text-white-50" aria-hidden="true"></i> Save as <b>PDF</b></a>
<a id="saveSvg" style="margin-left: 4px; font-size: 100%; float:right" href="figs/none_none.svg" download="" class="d-none d-sm-inline-block btn btn-sm btn-info shadow-sm"><i class="fas fa-download fa-sm text-white-50" aria-hidden="true"></i> Save as <b>SVG</b></a>
<a id="savePng" style="font-size: 100%; float:right" href="figs/none_none.png" download="" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-file-image fa-sm text-white-50" aria-hidden="true"></i> Save as <b>PNG</b></a>
</div>
</div>
</div>
<br>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>© HeRTA 2021</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Repeater plots-->
<script type="text/javascript">
// Get status code
function status(filename) {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState === 4) {
response = request.status;
}
};
request.open("GET", filename, true);
request.send();
}
// Grab selected FRB name
frb = "none";
function set_frb(selected_frb) {
frb = selected_frb;
}
// Update Figure
function updateFig() {
// Convert to lowercase and parse space character to underscore
frb = frb.toLowerCase().replace(" ", "_");
// Prevent children plotting
status("figs/repeaters/" + frb + ".svg");
setTimeout(function() {
if (response == 200) {
document.fig.src = "figs/none_none.svg";
if (frb == "repeaters") {
document.getElementById("sourceCode").href = "https://github.com/HeRTA/FRBSTATS/blob/main/cluster.py";
document.getElementById("Table").href = "#";
} else {
document.getElementById("sourceCode").href = "https://github.com/HeRTA/FRBSTATS/blob/main/figs/repeaters/plot_repeaters.py";
document.getElementById("Table").href = "figs/repeaters/" + frb + "_table.pdf";
}
document.getElementById("savePng").href = "figs/repeaters/" + frb + ".png";
document.getElementById("saveSvg").href = "figs/repeaters/" + frb + ".svg";
document.getElementById("savePdf").href = "figs/repeaters/" + frb + ".pdf";
document.fig.src = "figs/repeaters/" + frb + ".svg";
document.getElementById("results").style.marginTop = "3%";
document.getElementById("results").style.visibility = "visible";
// Scroll to the bottom of the page
$('html,body').animate({
//var scrollBottom = $(window).scrollTop() + $(window).height();
scrollTop: $(".card").offset().top*0.998}, 'slow');
}
}, 300); // Await 300 ms
}
</script>
<!-- Bootstrap core JavaScript-->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="js/style.min.js"></script>
<!-- Load require.js for JSON parsing-->
<script src="vendor/require.js/require.js"></script>
</body>
</html>