diff --git a/backend/scripts/ztplot.py b/backend/scripts/ztplot.py index 503738f390f700b959bda6690646f44caaf2c4d0..4c59982332541ea8acbae98ef0da3579489e798b 100755 --- a/backend/scripts/ztplot.py +++ b/backend/scripts/ztplot.py @@ -203,12 +203,18 @@ class ZTPlot(kp.Module): if trig_check(int(trigger_mask)) ]) + try: + dt = datetime.utcfromtimestamp(utc_timestamp) + except OverflowError: + self.log.critical("OverflowError encountered when converting '%s' to " + "a datetime object." % utc_timestamp) + dt = "invalid date" + title = "z-t-Plot for DetID-{0} Run {1}, " \ "FrameIndex {2}, TriggerCounter {3}, Overlays {4}, " \ "Trigger: {5}\n{6} UTC".format( det_id, run_id, frame_index, trigger_counter, - overlays, trigger_params, - datetime.utcfromtimestamp(utc_timestamp)) + overlays, trigger_params, dt) filename = 'ztplot' f = os.path.join(self.plots_path, filename + '.png')