Skip to content

Commit d97fe0c

Browse files
authored
More optimal bug fix
1 parent a0291d5 commit d97fe0c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

neo/rawio/maxwellrawio.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,10 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
183183
if np.array(channel_indexes).size > 1 and np.any(np.diff(channel_indexes) < 0):
184184
# get around h5py constraint that it does not allow datasets
185185
# to be indexed out of order
186-
sorted_channel_indexes = np.sort(channel_indexes)
187-
resorted_indexes = np.array(
188-
[list(sorted_channel_indexes).index(ch) for ch in channel_indexes])
186+
order_f = np.argsort(channel_indexes)
187+
sorted_channel_indexes = channel_indexes[order_f]
188+
# use argsort again on order_f to obtain resorted_indexes
189+
resorted_indexes = np.argsort(order_f)
189190

190191
try:
191192
if resorted_indexes is None:

0 commit comments

Comments
 (0)