Skip to content

Commit 5d50894

Browse files
Apply suggestions from code review
Co-authored-by: Dimitri Yatsenko <dimitri@datajoint.com>
1 parent 35d2044 commit 5d50894

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

element_array_ephys/ephys_acute.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def auto_generate_entries(cls, session_key):
158158
get_ephys_root_data_dir(), get_session_directory(session_key)
159159
)
160160
# search session dir and determine acquisition software
161-
for ephys_pattern, ephys_acq_type in zip(
162-
["*.ap.meta", "*.oebin"], ["SpikeGLX", "Open Ephys"]
161+
for ephys_pattern, ephys_acq_type in (
162+
("*.ap.meta", "SpikeGLX"), ("*.oebin", "Open Ephys")
163163
):
164164
ephys_meta_filepaths = list(session_dir.rglob(ephys_pattern))
165165
if ephys_meta_filepaths:
@@ -271,8 +271,8 @@ def make(self, key):
271271
)
272272

273273
# search session dir and determine acquisition software
274-
for ephys_pattern, ephys_acq_type in zip(
275-
["*.ap.meta", "*.oebin"], ["SpikeGLX", "Open Ephys"]
274+
for ephys_pattern, ephys_acq_type in (
275+
("*.ap.meta", "SpikeGLX"), ("*.oebin", "Open Ephys")
276276
):
277277
ephys_meta_filepaths = list(session_dir.rglob(ephys_pattern))
278278
if ephys_meta_filepaths:

element_array_ephys/ephys_report.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ def make(self, key):
5151
ephys.CuratedClustering.Unit & key & "cluster_quality_label='good'"
5252
)
5353

54-
shanks: np.ndarray = np.unique(
55-
(probe.ProbeType.Electrode.proj("shank") & units).fetch("shank")
56-
)
54+
shanks = set((probe.ProbeType.Electrode & units).fetch("shank"))
5755

5856
for shank_no in shanks:
5957

element_array_ephys/plotting/unit_level.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,20 @@ def plot_depth_waveforms(
124124

125125
# Spacing between channels (in um)
126126
x_inc = np.abs(np.diff(coords[:, 0])).min()
127-
y_inc = np.unique((np.abs(np.diff(coords[:, 1])))).max()
127+
y_inc = (np.abs(np.diff(coords[:, 1]))).max()
128128

129-
time = np.arange(waveforms.shape[1]) * (1 / sampling_rate)
129+
time = np.arange(waveforms.shape[1]) / sampling_rate
130130

131-
x_scale_factor = x_inc / (time + (1 / sampling_rate))[-1]
131+
x_scale_factor = x_inc / (time[-1] + 1 / sampling_rate)
132132
time_scaled = time * x_scale_factor
133133

134134
wf_amps = waveforms.max(axis=1) - waveforms.min(axis=1)
135135
max_amp = wf_amps.max()
136136
y_scale_factor = y_inc / max_amp
137137

138138
unique_x_loc = np.sort(np.unique(coords[:, 0]))
139-
xtick_label = list(map(str, map(int, unique_x_loc)))
140-
xtick_loc = time_scaled[int(len(time_scaled) / 2) + 1] + unique_x_loc
139+
xtick_label = [str(int(x)) for x in unique_x_loc]
140+
xtick_loc = time_scaled[len(time_scaled) // 2 + 1] + unique_x_loc
141141

142142
# Plot figure
143143
fig = go.Figure()

0 commit comments

Comments
 (0)