Ejemplo n.º 1
0
 def guess(xs, ys):
     center = np.average(xs, weights=ys / ys.sum())
     height_at = np.abs(xs - center).argmin()
     apex = ys[height_at]
     sigma = np.abs(center - xs[[search.nearest_left(ys, apex / 2, height_at),
                                 search.nearest_right(ys, apex / 2, height_at + 1)]]).sum()
     return center, apex, sigma, sigma
Ejemplo n.º 2
0
 def guess(xs, ys):
     center = np.average(xs, weights=ys / ys.sum())
     height_at = np.abs(xs - center).argmin()
     apex = ys[height_at]
     sigma = np.abs(center - xs[[
         search.nearest_left(ys, apex / 2, height_at),
         search.nearest_right(ys, apex / 2, height_at + 1)
     ]]).sum()
     return center, apex, sigma
Ejemplo n.º 3
0
 def guess(xs, ys):
     weights = np.clip(ys, 0, np.infty)
     center = np.average(xs, weights=weights / weights.sum())
     if np.isnan(center):
         center = xs.mean()
     height_at = np.abs(xs - center).argmin()
     apex = ys[height_at]
     max_ix = ys.argmax()
     if apex < ys[max_ix] * 0.1:
         apex = ys[max_ix]
         height_at = max_ix
     sigma = np.abs(center - xs[[
         search.nearest_left(ys, apex / 2, height_at),
         search.nearest_right(ys, apex / 2, height_at + 1)
     ]]).sum()
     return center, apex, sigma