From 343ce903210945ca9f6e52f821c6b20a2d1bcb41 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 2 Apr 2025 14:56:05 +0200 Subject: [PATCH] peus-plot: optionally give x-range as 2nd argument Change-Id: I445ef00487fc34343f5a0333643f61753a1c4948 --- bin/peus-plot | 5 ++++- frappy_psi/iqplot.py | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/peus-plot b/bin/peus-plot index 22044a4..ace24b2 100755 --- a/bin/peus-plot +++ b/bin/peus-plot @@ -25,13 +25,16 @@ t_rois = get_modules('roi%d') i_rois = get_modules('roi%di') q_rois = get_modules('roi%dq') +maxx = None if len(sys.argv) > 1: maxy = float(sys.argv[1]) + if len(sys.argv) > 2: + maxx = float(sys.argv[2]) else: maxy = 0.02 -iqplot = Plot(maxy) +iqplot = Plot(maxy, maxx) for i in range(99): pass diff --git a/frappy_psi/iqplot.py b/frappy_psi/iqplot.py index 1ce4773..772aa18 100644 --- a/frappy_psi/iqplot.py +++ b/frappy_psi/iqplot.py @@ -70,9 +70,10 @@ def rects(intervals, y12): class Plot: - def __init__(self, maxy): + def __init__(self, maxy, maxx=None): self.lines = {} self.yaxis = ((-2 * maxy, maxy), (-maxy, 2 * maxy)) + self.maxx = maxx self.first = True self.fig = None @@ -124,7 +125,7 @@ class Plot: self.fig, axleft = plt.subplots(figsize=(15,7)) self.pause = Pause(self.fig) plt.title("I/Q", fontsize=14) - axleft.set_xlim(0, curves[0][-1]) + axleft.set_xlim(0, self.maxx or curves[0][-1]) self.ax = [axleft, axleft.twinx()] self.ax[0].axhline(y=0, color='#cccccc') # show x-axis line self.ax[1].axhline(y=0, color='#cccccc')