-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
61 lines (51 loc) · 2.05 KB
/
app.py
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
import dash_html_components as html
import dash
from NuRadioReco.detector.detector_browser import detector_map
from NuRadioReco.detector.detector_browser import station_info
from NuRadioReco.detector.detector_browser import channel_info
from NuRadioReco.detector.detector_browser import hardware_response
import NuRadioReco.detector.detector_browser.detector_provider
from flask import send_file, send_from_directory
from NuRadioReco.detector.detector_browser.app import app
import json
import os
app.title = 'Radio Neutrino Observatory in Greenland'
server = app.server
detector_provider = NuRadioReco.detector.detector_browser.detector_provider.DetectorProvider()
detector_provider.set_generic_detector('detector_description/RNO_detector.json', 101, 3, False, False)
detector_json = json.load(open('detector_description/RNO_detector.json', 'r'))
app.layout = html.Div([
html.Div('', id='output-dummy', style={'display': 'inline'}),
html.Div('', id='load-dummy', style={'display': 'none'}),
html.Div([
html.Div(
[
html.A(
[
html.Button('Download JSON', className='btn btn-primary')
],
href='/dash/rno-station',
download='true'
),
station_info.layout,
channel_info.layout
],
style={'flex': '1'}
),
html.Div([
detector_map.layout,
hardware_response.layout
], style={'flex': '2'})
], style={'display': 'flex'})
])
@app.server.route('/dash/rno-station')
def download_json():
return send_from_directory(
os.path.dirname(os.path.abspath(__file__)),
filename='detector_description/RNO_detector.json'
)
if __name__ == '__main__':
if int(dash.__version__.split('.')[0]) <= 1:
if int(dash.__version__.split('.')[1]) < 0:
print('WARNING: Dash version 0.39.0 or newer is required, you are running version {}. Please update.'.format(dash.__version__))
app.run_server()