early exit
This commit is contained in:
@@ -221,18 +221,19 @@ def _calc_streakfinder_analysis(results, snr, mask):
|
|||||||
|
|
||||||
|
|
||||||
def _get_concentric_only_mask(x_center, y_center, crop_roi, streak_lines, threshold=0.33):
|
def _get_concentric_only_mask(x_center, y_center, crop_roi, streak_lines, threshold=0.33):
|
||||||
if x_center is not None and y_center is not None:
|
if x_center is None or y_center is None:
|
||||||
if crop_roi is not None:
|
return None
|
||||||
x_center -= crop_roi[0]
|
if crop_roi is not None:
|
||||||
y_center -= crop_roi[2]
|
x_center -= crop_roi[0]
|
||||||
centers = np.mean(streak_lines.reshape(-1, 2, 2), axis=1)
|
y_center -= crop_roi[2]
|
||||||
norm = np.stack([streak_lines[:, 3] - streak_lines[:, 1],
|
centers = np.mean(streak_lines.reshape(-1, 2, 2), axis=1)
|
||||||
streak_lines[:, 0] - streak_lines[:, 2]], axis=-1)
|
norm = np.stack([streak_lines[:, 3] - streak_lines[:, 1],
|
||||||
r = centers - np.asarray([x_center, y_center])
|
streak_lines[:, 0] - streak_lines[:, 2]], axis=-1)
|
||||||
prod = np.sum(norm * r, axis=-1)[..., None]
|
r = centers - np.asarray([x_center, y_center])
|
||||||
proj = r - prod * norm / np.sum(norm ** 2, axis=-1)[..., None]
|
prod = np.sum(norm * r, axis=-1)[..., None]
|
||||||
streaks_mask = np.sqrt(np.sum(proj ** 2, axis=-1)) / np.sqrt(np.sum(r ** 2, axis=-1)) < threshold
|
proj = r - prod * norm / np.sum(norm ** 2, axis=-1)[..., None]
|
||||||
return streaks_mask
|
streaks_mask = np.sqrt(np.sum(proj ** 2, axis=-1)) / np.sqrt(np.sum(r ** 2, axis=-1)) < threshold
|
||||||
|
return streaks_mask
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user