Skip to content

Commit 1126f42

Browse files
committed
Fix handling of empty nwb_hw_channel_order
Ensures nwb_hw_channel_order is set to an empty list if None, and checks for empty list before assigning default channel order. This improves robustness when nwb_hw_channel_order is not provided.
1 parent ba7bc49 commit 1126f42

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/trodes_to_nwb/convert_ephys.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import logging
66
from warnings import warn
77

8+
import numpy as np
89
from hdmf.backends.hdf5 import H5DataIO
910
from hdmf.data_utils import GenericDataChunkIterator
10-
import numpy as np
1111
from pynwb import NWBFile
1212
from pynwb.ecephys import ElectricalSeries
1313

@@ -146,7 +146,9 @@ def __init__(
146146
self.n_multiplexed_channel += len(self.neo_io[0].multiplexed_channel_xml)
147147

148148
# order that the hw channels are in within the nwb table
149-
if nwb_hw_channel_order is None: # TODO: raise error instead?
149+
if nwb_hw_channel_order is None:
150+
nwb_hw_channel_order = []
151+
if len(nwb_hw_channel_order) == 0: # TODO: raise error instead?
150152
self.nwb_hw_channel_order = np.arange(self.n_channel)
151153
else:
152154
self.nwb_hw_channel_order = nwb_hw_channel_order

0 commit comments

Comments
 (0)