-
Notifications
You must be signed in to change notification settings - Fork 1
/
jwst-sources.html
249 lines (207 loc) · 10.5 KB
/
jwst-sources.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
<html>
<head>
<meta charset="utf-8"/>
<meta content="text/html;charset=UTF-8" http-equiv="Content-type"/>
<style>
body {font-family: sans-serif;}
table.dataTable {width: auto !important; margin: 0 !important;}
.dataTables_filter, .dataTables_paginate {float: left !important; margin-left:1em}
td {font-size: 10pt;}
</style>
<link href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js">
</script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js">
</script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js"></script>
</head>
<body>
<script>
var astropy_sort_num = function(a, b) {
var a_num = parseFloat(a);
var b_num = parseFloat(b);
if (isNaN(a_num) && isNaN(b_num))
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
else if (!isNaN(a_num) && !isNaN(b_num))
return ((a_num < b_num) ? -1 : ((a_num > b_num) ? 1 : 0));
else
return isNaN(a_num) ? -1 : 1;
}
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"optionalnum-asc": astropy_sort_num,
"optionalnum-desc": function (a,b) { return -astropy_sort_num(a, b); }
});
//// Parser
// https://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js @ Reza Baradaran
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
return decodeURI(results[1]) || 0;
}
}
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var min_count = parseFloat( $('#count_min').val()) || -1e30;
var max_count = parseFloat( $('#count_max').val()) || 1e30;
var data_count = parseFloat( data[1] ) || 0;
var min_ra = parseFloat( $('#ra_min').val()) || -1e30;
var max_ra = parseFloat( $('#ra_max').val()) || 1e30;
var data_ra = parseFloat( data[4] ) || 0;
var min_dec = parseFloat( $('#dec_min').val()) || -1e30;
var max_dec = parseFloat( $('#dec_max').val()) || 1e30;
var data_dec = parseFloat( data[5] ) || 0;
var min_zphot = parseFloat( $('#zphot_min').val()) || -1e30;
var max_zphot = parseFloat( $('#zphot_max').val()) || 1e30;
var data_zphot = parseFloat( data[7] ) || 0;
var min_zspec = parseFloat( $('#zspec_min').val()) || -1e30;
var max_zspec = parseFloat( $('#zspec_max').val()) || 1e30;
var data_zspec = parseFloat( data[8] ) || 0;
if ( ( ( isNaN( min_count ) && isNaN( max_count ) ) || ( isNaN( min_count ) && data_count <= max_count ) || ( min_count <= data_count && isNaN( max_count ) ) || ( min_count <= data_count && data_count <= max_count ) )
&& ( ( isNaN( min_ra ) && isNaN( max_ra ) ) || ( isNaN( min_ra ) && data_ra <= max_ra ) || ( min_ra <= data_ra && isNaN( max_ra ) ) || ( min_ra <= data_ra && data_ra <= max_ra ) )
&& ( ( isNaN( min_dec ) && isNaN( max_dec ) ) || ( isNaN( min_dec ) && data_dec <= max_dec ) || ( min_dec <= data_dec && isNaN( max_dec ) ) || ( min_dec <= data_dec && data_dec <= max_dec ) )
&& ( ( isNaN( min_zphot ) && isNaN( max_zphot ) ) || ( isNaN( min_zphot ) && data_zphot <= max_zphot ) || ( min_zphot <= data_zphot && isNaN( max_zphot ) ) || ( min_zphot <= data_zphot && data_zphot <= max_zphot ) )
&& ( ( isNaN( min_zspec ) && isNaN( max_zspec ) ) || ( isNaN( min_zspec ) && data_zspec <= max_zspec ) || ( min_zspec <= data_zspec && isNaN( max_zspec ) ) || ( min_zspec <= data_zspec && data_zspec <= max_zspec ) ) )
{
return true;
}
return false;
}
);
//// Update URL with filter parameters
var filter_params = ['count', 'ra', 'dec', 'zphot', 'zspec'];
$.UpdateFilterURL = function () {
var i;
var filter_url = "";
for (i = 0; i < filter_params.length; i++) {
if ($('#'+filter_params[i]+'_min').val() != "") {
filter_url += '&'+filter_params[i]+'_min='+
$('#'+filter_params[i]+'_min').val();
}
if ($('#'+filter_params[i]+'_max').val() != "") {
filter_url += '&'+filter_params[i]+'_max='+
$('#'+filter_params[i]+'_max').val();
}
}
if (filter_url != "") {
var filtered_url = window.location.href.split('?')[0] + '?' + filter_url;
window.history.pushState('', '', filtered_url);
}
}
$(document).ready(function() {
$('#zspec_min').val($.urlParam('zspec_min'));
$('#zspec_max').val($.urlParam('zspec_max'));
$('#zphot_min').val($.urlParam('zphot_min'));
$('#zphot_max').val($.urlParam('zphot_max'));
$('#dec_min').val($.urlParam('dec_min'));
$('#dec_max').val($.urlParam('dec_max'));
$('#ra_min').val($.urlParam('ra_min'));
$('#ra_max').val($.urlParam('ra_max'));
$('#count_min').val($.urlParam('count_min'));
$('#count_max').val($.urlParam('count_max'));
var table = $('#table4344739488').DataTable({
order: [],
pageLength: 50,
"ajax": "jwst-sources.json",
"deferRender": true,
dom: 'Blfrtip',
buttons: ['csv'],
lengthMenu: [[10, 25, 50, 100, 500, 1000, -1], [10, 25, 50, 100, 500, 1000, 'All']],
pagingType: "full_numbers",
columnDefs: [{targets: [1, 4, 5, 7, 8], type: "optionalnum"}]
});
// Event listener to the two range filtering inputs to redraw on input
$('#count_min, #count_max, #ra_min, #ra_max, #dec_min, #dec_max, #zphot_min, #zphot_max, #zspec_min, #zspec_max').keyup( function() {
table.draw();
$.UpdateFilterURL();
} );
$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
} ); </script>
<div style="border:1px solid black; padding:10px; margin:10px">
<b>Toggle column:</b></br> <a class="toggle-vis" data-column="0"> <tt>jname</tt> </a> <b>/</b> <a class="toggle-vis" data-column="1"> <tt>count</tt> </a> <b>/</b> <a class="toggle-vis" data-column="2"> <tt>F200W</tt> </a> <b>/</b> <a class="toggle-vis" data-column="3"> <tt>F444W</tt> </a> <b>/</b> <a class="toggle-vis" data-column="4"> <tt>ra</tt> </a> <b>/</b> <a class="toggle-vis" data-column="5"> <tt>dec</tt> </a> <b>/</b> <a class="toggle-vis" data-column="6"> <tt>id</tt> </a> <b>/</b> <a class="toggle-vis" data-column="7"> <tt>zphot</tt> </a> <b>/</b> <a class="toggle-vis" data-column="8"> <tt>zspec</tt> </a> <b>/</b> <a class="toggle-vis" data-column="9"> <tt>arxiv</tt> </a> <b>/</b> <a class="toggle-vis" data-column="10"> <tt>author</tt> </a>
</div>
<div style="border:1px solid black; padding:10px; margin:10px">
<b> Filter: </b>
<table>
<tr>
<td style="width:100px">
<input type="text" id="count_min" name="count_min"
style="width:60px;display:inline"> <
</td>
<td style="width:100px"> count </td>
<td> < <input type="text" id="count_max" name="count_max"
style="width:60px;display:inline">
<span style="display:inline-block; width:10;"></span> Number of references
<tr>
<td style="width:100px">
<input type="text" id="ra_min" name="ra_min"
style="width:60px;display:inline"> <
</td>
<td style="width:100px"> ra </td>
<td> < <input type="text" id="ra_max" name="ra_max"
style="width:60px;display:inline">
<span style="display:inline-block; width:10;"></span> Right Ascension, deg
<tr>
<td style="width:100px">
<input type="text" id="dec_min" name="dec_min"
style="width:60px;display:inline"> <
</td>
<td style="width:100px"> dec </td>
<td> < <input type="text" id="dec_max" name="dec_max"
style="width:60px;display:inline">
<span style="display:inline-block; width:10;"></span> Declination, deg
<tr>
<td style="width:100px">
<input type="text" id="zphot_min" name="zphot_min"
style="width:60px;display:inline"> <
</td>
<td style="width:100px"> zphot </td>
<td> < <input type="text" id="zphot_max" name="zphot_max"
style="width:60px;display:inline">
<span style="display:inline-block; width:10;"></span> Photometric redshift
<tr>
<td style="width:100px">
<input type="text" id="zspec_min" name="zspec_min"
style="width:60px;display:inline"> <
</td>
<td style="width:100px"> zspec </td>
<td> < <input type="text" id="zspec_max" name="zspec_max"
style="width:60px;display:inline">
<span style="display:inline-block; width:10;"></span> Spectroscopic redshift
</table>
</div>
<table class="display compact" id="table4344739488">
<thead>
<tr>
<th>jname</th>
<th>count</th>
<th>F200W</th>
<th>F444W</th>
<th>ra</th>
<th>dec</th>
<th>id</th>
<th>zphot</th>
<th>zspec</th>
<th>arxiv</th>
<th>author</th>
</tr>
</thead>
</table>
<span style="font-size:x-small;"> Created: Sat Oct 26 12:34:17 2024 </span>
</body>
</html>