-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_opflash3d.py
More file actions
112 lines (88 loc) · 2.88 KB
/
test_opflash3d.py
File metadata and controls
112 lines (88 loc) · 2.88 KB
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
from __future__ import print_function
import os,sys,argparse
parser = argparse.ArgumentParser("test_3d lardly viewer")
parser.add_argument("-ll","--larlite",required=True,type=str,help="larlite file with dltagger_allreco tracks")
parser.add_argument("-e","--entry",required=True,type=int,help="Entry to load")
parser.add_argument("-ns","--no-timeshift",action="store_true",default=False,help="Do not apply time-shift")
args = parser.parse_args(sys.argv[1:])
import os
import json
import dash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
from larlite import larlite
from larcv import larcv
import lardly
input_larlite = args.larlite
ientry = args.entry
# LARLITE
io_ll = larlite.storage_manager(larlite.storage_manager.kREAD)
io_ll.add_in_filename( input_larlite )
io_ll.open()
# Detector outline
detdata = lardly.DetectorOutline()
crtdet = lardly.CRTOutline()
def load_event( io_ll, ientry ):
entry_data = { "flash":[] }
# Load entry
io_ll.go_to(ientry)
# opflash
evopflash_beam = io_ll.get_data(larlite.data.kOpFlash,"simpleFlashBeam")
evopflash_cosmic = io_ll.get_data(larlite.data.kOpFlash,"simpleFlashCosmic")
entry_data["flash"] += lardly.data.visualize_larlite_opflash_3d( evopflash_beam.at(0) )
return entry_data
entry_data = load_event(io_ll,0)
#print(entry_data["flash"])
app = dash.Dash(
__name__,
meta_tags=[{"name": "viewport", "content": "width=device-width, initial-scale=1"}],
)
server = app.server
axis_template = {
"showbackground": True,
"backgroundcolor": "#141414",
"gridcolor": "rgb(255, 255, 255)",
"zerolinecolor": "rgb(255, 255, 255)",
}
plot_layout = {
"title": "",
"height":800,
"margin": {"t": 0, "b": 0, "l": 0, "r": 0},
"font": {"size": 12, "color": "white"},
"showlegend": False,
"plot_bgcolor": "#141414",
"paper_bgcolor": "#141414",
"scene": {
"xaxis": axis_template,
"yaxis": axis_template,
"zaxis": axis_template,
"aspectratio": {"x": 1, "y": 1, "z": 1},
"camera": {"eye": {"x": 1, "y": 1, "z": 1},
"up":dict(x=0, y=1, z=0)},
"annotations": [],
},
}
testline = {
"type":"scattergl",
"x":[200,400,400,800],
"y":[3200,3400,3800,4400],
"mode":"markers",
#"line":{"color":"rgb(255,255,255)","width":4},
"marker":dict(size=10, symbol="triangle-up",color="rgb(255,255,255)"),
}
app.layout = html.Div( [
html.Div( [
dcc.Graph(
id="det3d",
figure={
"data": detdata.getlines()+crtdet.getlines()+entry_data["flash"],
"layout": plot_layout,
},
config={"editable": True, "scrollZoom": False},
)],
className="graph__container"),
] )
if __name__ == "__main__":
app.run_server(debug=True)