Skip to content

Commit 2eb9540

Browse files
committed
new method for getting x, y spacing between sites
1 parent b48aaf0 commit 2eb9540

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

element_array_ephys/plotting/unit_level.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ def plot_depth_waveforms(
123123
y_min, y_max = np.min(coords[:, 1]), np.max(coords[:, 1])
124124

125125
# Spacing between recording sites (in um)
126-
x_inc = np.abs(np.diff(coords[coords[:, 1] == coords[0, 1]][:, 0])).mean() / 2
127-
y_inc = np.abs(np.diff(coords[coords[:, 0] == coords[0, 0]][:, 1])).mean() / 2
128-
126+
x_inc = np.diff(np.sort((coords[coords[:, 1] == coords[0, 1]][:, 0]))).mean() / 2
127+
y_inc = np.diff(np.sort((coords[coords[:, 0] == coords[0, 0]][:, 1]))).mean() / 2
129128
time = np.arange(waveforms.shape[1]) / sampling_rate
130129

131130
x_scale_factor = x_inc / (time[-1] + 1 / sampling_rate) # correspond to 1 ms

0 commit comments

Comments
 (0)