def get_peak_center(i, di): lp = plot.plots[di.name][0] xs = lp.index.get_data() ys = lp.value.get_data() result = None cx = None if len(xs) and len(ys): result = calculate_peak_center(xs, ys) if result is None or isinstance(result, str): self.warning('no peak center for {} {}'.format(di.name, di.isotope)) else: cx = result[0][1] return cx
def get_peak_center(di): try: lp = plot.plots[di][0] except KeyError: lp = plot.plots["*{}".format(di)][0] xs = lp.index.get_data() ys = lp.value.get_data() cx = None if len(xs) and len(ys): try: result = calculate_peak_center(xs, ys) cx = result[0][1] except PeakCenterError: self.warning("no peak center for {}".format(di)) return cx
def get_peak_center(di): try: lp = plot.plots[di][0] except KeyError: lp = plot.plots['*{}'.format(di)][0] xs = lp.index.get_data() ys = lp.value.get_data() cx = None if len(xs) and len(ys): try: result = calculate_peak_center(xs, ys) cx = result[0][1] except PeakCenterError: self.warning('no peak center for {}'.format(di)) return cx