Skip to content

Commit

Permalink
change colour of the negative and saturated hits
Browse files Browse the repository at this point in the history
  • Loading branch information
Yifan Chen committed Oct 24, 2024
1 parent c00ef22 commit 13b4689
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
16 changes: 15 additions & 1 deletion event_display/interactive_event_display/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
dcc.Store(id="data-length", data=0),
dcc.Store(id="minerva-data-length", data=0),
dcc.Store(id="event-time", data=0),
dcc.Store(id="unix-time", data=0),
dcc.Store(id="sim-version", data=0),
# Header
html.Div(
Expand Down Expand Up @@ -107,6 +108,7 @@
[
html.Div(id="evid-div", style={"textAlign": "center", "display": "inline-block", "margin-right": "10px"}),
html.Div(children="", id="event-time-div", style={"display": "inline-block", "margin-right": "10px"}),
html.Div(children="", id="unix-time-div", style={"display": "inline-block", "margin-right": "10px"}),
html.Div(children="", id="event-nhits-div", style={"display": "inline-block"}),
]
),
Expand Down Expand Up @@ -345,7 +347,16 @@ def update_div(evid, max_value):
)
def update_time(_, time):
"""Update the time display"""
return f"Event time: {time}"
return f"Event time (UTC): {time}"

@app.callback(
Output("unix-time-div", "children"),
Input("3d-graph", "figure"),
State("unix-time", "data"),
)
def update_unix_time(_, unix_time):
"""Update the time display"""
return f"unix time: {unix_time}"

@app.callback(
Output("event-nhits-div", "children"),
Expand All @@ -362,6 +373,7 @@ def update_nhits(_, nhits):
Output("3d-graph", "figure"),
Output("sim-version", "data"),
Output("event-time", "data"),
Output("unix-time", "data"),
Output("event-nhits", "data"),
Input("filename", "data"),
Input("minerva-filename", "data"),
Expand All @@ -380,13 +392,15 @@ def update_graph(filename, minerva_filename, evid):
event_datetime = datetime.utcfromtimestamp(
data["charge/events", evid]["unix_ts"][0]
).strftime("%Y-%m-%d %H:%M:%S")
event_unix_time = data["charge/events", evid]["unix_ts"][0]
n_hits = data["charge/events",evid]["nhit"][0]
else:
raise PreventUpdate
return (
graph,
sim_version,
event_datetime,
event_unix_time,
n_hits
) # TODO: move to utils

Expand Down
26 changes: 14 additions & 12 deletions event_display/interactive_event_display/display_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def create_3d_figure(minerva_data, data, filename, evid):
marker={
"size": 1.75,
"symbol": 'x',
"color": '#19D3F3',
"color": '17becf', #'#19D3F3',
},
mode="markers",
name="saturated hits",
Expand All @@ -381,7 +381,7 @@ def create_3d_figure(minerva_data, data, filename, evid):
marker={
"size": 1.75,
"symbol": 'x',
"color": '#d62728',
"color": '#2ca02c', #'#d62728',
},
mode="markers",
name="negative charge hits",
Expand Down Expand Up @@ -1210,10 +1210,11 @@ def plot_2d_charge(data, evid):
y=y,
legendgroup= "saturated_2d",
name="saturated hits",
showlegend=True,
marker={
"size": 4.,
"symbol": 'x',
"color": '#19D3F3',
"color": '#17becf', #'#19D3F3',
},
mode="markers",
)
Expand All @@ -1222,11 +1223,11 @@ def plot_2d_charge(data, evid):
x=z,
y=x,
legendgroup= "saturated_2d",
showlegend=False,
showlegend=True,
marker={
"size": 4.,
"symbol": 'x',
"color": '#19D3F3',
"color": '#17becf', #'#19D3F3',
},
mode="markers",
)
Expand All @@ -1235,11 +1236,11 @@ def plot_2d_charge(data, evid):
x=z,
y=y,
legendgroup= "saturated_2d",
showlegend=False,
showlegend=True,
marker={
"size": 4.,
"symbol": 'x',
"color": '#19D3F3',
"color": '#17becf', #'#19D3F3',
},
mode="markers",
)
Expand All @@ -1259,10 +1260,11 @@ def plot_2d_charge(data, evid):
y=y,
legendgroup= "negative_2d",
name="negative hits",
showlegend=True,
marker={
"size": 4.,
"symbol": 'x',
"color": '#d62728',
"color": '#2ca02c', #'#d62728',
},
mode="markers",
)
Expand All @@ -1271,11 +1273,11 @@ def plot_2d_charge(data, evid):
x=z,
y=x,
legendgroup= "negative_2d",
showlegend=False,
showlegend=True,
marker={
"size": 4.,
"symbol": 'x',
"color": '#d62728',
"color": '#2ca02c',# '#d62728',
},
mode="markers",
)
Expand All @@ -1284,11 +1286,11 @@ def plot_2d_charge(data, evid):
x=z,
y=y,
legendgroup= "negative_2d",
showlegend=False,
showlegend=True,
marker={
"size": 4.,
"symbol": 'x',
"color": '#d62728',
"color": '#2ca02c', #'#d62728',
},
mode="markers",
)
Expand Down

0 comments on commit 13b4689

Please sign in to comment.