def add_roi(self, name='', left=0, right=0, bgr_width=3,
                counts=None, sort=True):
        """add an ROI"""
        name = name.strip()
        roi = ROI(name=name, left=left, right=right,
                  bgr_width=bgr_width, counts=counts)

        rnames = [r.name.lower() for r in self.rois]
        if name.lower() in rnames:
            iroi = rnames.index(name.lower())
            self.rois[iroi] = roi
        else:
            self.rois.append(roi)
        if sort:
            self.rois.sort()
dataset/ETHPy150Open xraypy/xraylarch/plugins/xrf/mca.py/MCA.add_roi/original