Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx committed Nov 16, 2024
1 parent 00907f1 commit 581b2df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions straxen/plugins/peaks/peak_positions_cnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def calculate_theta_diff(theta_array, avg_theta):
theta_array : np.ndarray
A 2D numpy array where each row represents a set of angles in radians.
avg_theta : np.ndarray
A 1D numpy array representing the average angle in radians for each row in `theta_array`.
A 1D numpy array representing the average angle in radians for each
row in `theta_array`.
Returns:
theta_diff : np.ndarray
Expand Down Expand Up @@ -236,9 +237,9 @@ def compute(self, peaks):

theta_array = np.arctan2(contours[..., 1], contours[..., 0])

avg_theta = np.arctan2(peaks["y_cnf"], peaks["x_cnf"])
avg_theta = np.arctan2(result[f"y_{self.algorithm}"], result[f"x_{self.algorithm}"])

theta_diff = calculate_theta_diff(theta_array, avg_theta)
theta_diff = self.calculate_theta_diff(theta_array, avg_theta)

result[f"r_uncertainty_{self.algorithm}"][peak_mask] = (r_max - r_min) / 2
result[f"theta_uncertainty_{self.algorithm}"][peak_mask] = np.abs(theta_diff) / 2
Expand Down

0 comments on commit 581b2df

Please sign in to comment.