Skip to content

Commit

Permalink
Add error message for single-led with wrong parameters (LorenFrankLab…
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelbray32 authored Nov 9, 2023
1 parent 3ce16f6 commit d3b5c93
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/spyglass/common/common_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ def calculate_position_info(
# Set points to NaN where the front and back LEDs are too separated
dist_between_LEDs = get_distance(back_LED, front_LED)
is_too_separated = dist_between_LEDs >= max_LED_separation
if np.all(is_too_separated):
raise ValueError(
"All points are too far apart. If this is single LED data,"
+ "please check that using a parameter set with large max_LED_seperation."
+ f"Current max_LED_separation: {max_LED_separation}"
)

back_LED[is_too_separated] = np.nan
front_LED[is_too_separated] = np.nan
Expand Down

0 comments on commit d3b5c93

Please sign in to comment.