Skip to content

Commit

Permalink
Add quality query to display dl1 tool
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Dec 19, 2022
1 parent a633e0f commit 8f2906b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ctapipe/tools/display_dl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from matplotlib.backends.backend_pdf import PdfPages

from ..calib import CameraCalibrator
from ..core import Component, Tool
from ..core import Component, QualityQuery, Tool
from ..core.traits import Bool, Int, Path, classes_with_traits, flag
from ..image.extractor import ImageExtractor
from ..io import EventSource
Expand Down Expand Up @@ -164,6 +164,8 @@ def __init__(self, **kwargs):

def setup(self):
self.eventsource = EventSource.from_config(parent=self)
self.quality_query = QualityQuery(parent=self)

compatible_datalevels = [DataLevel.R1, DataLevel.DL0, DataLevel.DL1_IMAGES]

if not self.eventsource.has_any_datalevel(compatible_datalevels):
Expand All @@ -189,7 +191,8 @@ def start(self):
tel_list = [self.telescope]

for tel_id in tel_list:
self.plotter.plot(event, tel_id)
if all(self.quality_query(dl1=event.dl1.tel[tel_id])):
self.plotter.plot(event, tel_id)

def finish(self):
self.plotter.finish()
Expand Down

0 comments on commit 8f2906b

Please sign in to comment.