Skip to content
Snippets Groups Projects
Commit ba5750c9 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Show connecting lines in trigger plot

parent 26b80895
No related branches found
No related tags found
No related merge requests found
...@@ -47,8 +47,8 @@ km3pipe.style.use('km3pipe') ...@@ -47,8 +47,8 @@ km3pipe.style.use('km3pipe')
class TriggerRate(kp.Module): class TriggerRate(kp.Module):
def configure(self): def configure(self):
self.plots_path = self.require('plots_path') self.plots_path = self.require('plots_path')
self.interval = self.get( self.interval = self.get("interval",
"interval", default=self.trigger_rate_sampling_period()) default=self.trigger_rate_sampling_period())
self.filename = self.get("filename", default="trigger_rates") self.filename = self.get("filename", default="trigger_rates")
self.with_minor_ticks = self.get("with_minor_ticks", default=False) self.with_minor_ticks = self.get("with_minor_ticks", default=False)
print("Update interval: {}s".format(self.interval)) print("Update interval: {}s".format(self.interval))
...@@ -56,22 +56,12 @@ class TriggerRate(kp.Module): ...@@ -56,22 +56,12 @@ class TriggerRate(kp.Module):
self.trigger_rates = OrderedDict() self.trigger_rates = OrderedDict()
self.styles = { self.styles = {
"xfmt": "xfmt": md.DateFormatter('%Y-%m-%d %H:%M'),
md.DateFormatter('%Y-%m-%d %H:%M'), "general": dict(markersize=6, linestyle=':', linewidth=1),
"general": "Overall": dict(marker='D', color='tomato', markeredgewidth=1),
dict(markersize=6, linestyle='None'), "3DMuon": dict(marker='X', color='dodgerblue'),
"Overall": "MXShower": dict(marker='v', color='orange'),
dict( "3DShower": dict(marker='^', color='olivedrab'),
marker='D',
markerfacecolor='None',
markeredgecolor='tomato',
markeredgewidth=1),
"3DMuon":
dict(marker='X', markerfacecolor='dodgerblue'),
"MXShower":
dict(marker='v', markerfacecolor='orange'),
"3DShower":
dict(marker='^', markerfacecolor='olivedrab'),
} }
queue_len = int(60 * 24 / (self.interval / 60)) queue_len = int(60 * 24 / (self.interval / 60))
...@@ -155,12 +145,11 @@ class TriggerRate(kp.Module): ...@@ -155,12 +145,11 @@ class TriggerRate(kp.Module):
self.log.warning("Empty rates, skipping...") self.log.warning("Empty rates, skipping...")
continue continue
timestamps, trigger_rates = zip(*rates) timestamps, trigger_rates = zip(*rates)
ax.plot( ax.plot(timestamps,
timestamps, trigger_rates,
trigger_rates, **self.styles[trigger],
**self.styles[trigger], **self.styles['general'],
**self.styles['general'], label=trigger)
label=trigger)
run_changes_to_plot = self._get_run_changes_to_plot() run_changes_to_plot = self._get_run_changes_to_plot()
self.print("Recorded run changes: {}".format(run_changes_to_plot)) self.print("Recorded run changes: {}".format(run_changes_to_plot))
...@@ -171,15 +160,14 @@ class TriggerRate(kp.Module): ...@@ -171,15 +160,14 @@ class TriggerRate(kp.Module):
min_trigger_rate = min(all_rates) min_trigger_rate = min(all_rates)
max_trigger_rate = max(all_rates) max_trigger_rate = max(all_rates)
for run_start, run in run_changes_to_plot: for run_start, run in run_changes_to_plot:
plt.text( plt.text(run_start, (min_trigger_rate + max_trigger_rate) / 2,
run_start, (min_trigger_rate + max_trigger_rate) / 2, "\nRUN %s " % run,
"\nRUN %s " % run, rotation=60,
rotation=60, verticalalignment='top',
verticalalignment='top', fontsize=8,
fontsize=8, color='gray')
color='gray') ax.axvline(run_start, color='#ff0f5b', linestyle='--',
ax.axvline( alpha=0.8) # added
run_start, color='#ff0f5b', linestyle='--', alpha=0.8) # added
ax.set_title("Trigger Rates for DetID-{0}\n{1} UTC".format( ax.set_title("Trigger Rates for DetID-{0}\n{1} UTC".format(
self.det_id, self.det_id,
...@@ -234,13 +222,12 @@ def main(): ...@@ -234,13 +222,12 @@ def main():
ligier_port = int(args['-p']) ligier_port = int(args['-p'])
pipe = kp.Pipeline() pipe = kp.Pipeline()
pipe.attach( pipe.attach(kp.io.ch.CHPump,
kp.io.ch.CHPump, host=ligier_ip,
host=ligier_ip, port=ligier_port,
port=ligier_port, tags='IO_EVT',
tags='IO_EVT', timeout=60 * 60 * 24 * 7,
timeout=60 * 60 * 24 * 7, max_queue=200000)
max_queue=200000)
pipe.attach(TriggerRate, interval=300, plots_path=plots_path) pipe.attach(TriggerRate, interval=300, plots_path=plots_path)
pipe.drain() pipe.drain()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment