From 60e69d44d049f1aa250ad038db4cc01f37721a67 Mon Sep 17 00:00:00 2001 From: Robert Lupton the Good Date: Tue, 8 Dec 2020 16:52:46 -0500 Subject: [PATCH] Fix usePixels; support plt.legend() --- python/pfs/drp/stella/datamodel/pfsFiberArraySet.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/pfs/drp/stella/datamodel/pfsFiberArraySet.py b/python/pfs/drp/stella/datamodel/pfsFiberArraySet.py index dd003cd86..f7441b661 100644 --- a/python/pfs/drp/stella/datamodel/pfsFiberArraySet.py +++ b/python/pfs/drp/stella/datamodel/pfsFiberArraySet.py @@ -62,9 +62,10 @@ def plot(self, fiberId=None, usePixels=False, ignorePixelMask=0x0, show=True): colors = matplotlib.cm.rainbow(np.linspace(0, 1, len(fiberId))) for ff, cc in zip(fiberId, colors): - index = np.where(self.fiberId == ff)[0] - good = (self.mask[index] & ignorePixelMask) == 0 - axes.plot(wavelength[index][good], self.flux[index][good], ls="solid", color=cc) + index = np.where(self.fiberId == ff)[0][0] + good = ((self.mask[index] & ignorePixelMask) == 0) + lam = wavelength if usePixels else wavelength[index] + axes.plot(lam[good], self.flux[index][good], ls="solid", color=cc, label=str(ff)) axes.set_xlabel(xLabel) axes.set_ylabel("Flux")