Skip to content

Commit bed5ccf

Browse files
Thinh Nguyendimitri-yatsenko
andauthored
Apply suggestions from code review
Co-authored-by: Dimitri Yatsenko <[email protected]>
1 parent 8cde4d0 commit bed5ccf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

element_electrode_localization/electrode_localization.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,19 @@ def make(self, key):
131131

132132
chn_loc_data = {'origin': chn_loc_raw['origin']}
133133

134-
if len(chn_loc_data['origin'].keys()) > 1:
134+
if len(chn_loc_data['origin']) > 1:
135135
log.error('More than one origin region found ({}). skipping.'.format(
136136
chn_loc_data['origin']))
137137
raise ValueError('More than one origin region found '
138138
+ f'({chn_loc_data["origin"]})')
139139

140140
# ensuring channel data is sorted;
141141
chn_loc_keymap = {int(k.split('_')[1]): k for k
142-
in chn_loc_raw.keys() if 'channel_' in k}
142+
in chn_loc_raw if 'channel_' in k}
143143

144144
chn_loc_data['channels'] = np.array(
145145
[tuple(chn_loc_raw[chn_loc_keymap[k]].values()) for k in sorted(
146-
chn_loc_keymap.keys())],
146+
chn_loc_keymap)],
147147
dtype=[
148148
('x', float), ('y', float), ('z', float),
149149
('axial', float), ('lateral', float),
@@ -153,8 +153,7 @@ def make(self, key):
153153
pos_xyz_raw = np.array([chn_loc_data['channels'][i]
154154
for i in ('x', 'y', 'z')]).T
155155

156-
pos_origin = chn_loc_data['origin'][
157-
list(chn_loc_data['origin'].keys())[0]]
156+
pos_origin = next(iter(chn_loc_data['origin'].values()))
158157

159158
pos_xyz = np.copy(pos_xyz_raw)
160159

0 commit comments

Comments
 (0)