diff --git a/neo/core/channelindex.py b/neo/core/channelindex.py index d40f575da..65d80ce1c 100644 --- a/neo/core/channelindex.py +++ b/neo/core/channelindex.py @@ -152,7 +152,7 @@ class ChannelIndex(Container): _data_child_objects = ('AnalogSignal', 'IrregularlySampledSignal') _single_parent_objects = ('Block',) _necessary_attrs = (('index', np.ndarray, 1, np.dtype('i')),) - _recommended_attrs = ((('channel_names', np.ndarray, 1, np.dtype('S')), + _recommended_attrs = ((('channel_names', np.ndarray, 1, np.dtype('U')), ('channel_ids', np.ndarray, 1, np.dtype('i')), ('coordinates', pq.Quantity, 2)) + Container._recommended_attrs) @@ -173,7 +173,7 @@ def __init__(self, index, channel_names=None, channel_ids=None, # Defaults if channel_names is None: - channel_names = np.array([], dtype='S') + channel_names = np.array([], dtype='U') if channel_ids is None: channel_ids = np.array([], dtype='i') diff --git a/neo/io/basefromrawio.py b/neo/io/basefromrawio.py index 40ef81fb8..8c27fad63 100644 --- a/neo/io/basefromrawio.py +++ b/neo/io/basefromrawio.py @@ -139,7 +139,7 @@ def read_block(self, block_index=0, lazy=False, signal_group_mode=None, chidx_annotations.pop('name') chidx_annotations = check_annotations(chidx_annotations) # this should be done with array_annotation soon: - ch_names = all_channels[ind_abs]['name'].astype('S') + ch_names = all_channels[ind_abs]['name'].astype('U') neo_channel_index = ChannelIndex(index=ind_within, channel_names=ch_names, channel_ids=all_channels[ind_abs]['id'], diff --git a/neo/io/brainwaredamio.py b/neo/io/brainwaredamio.py index f7454d807..89bb52a30 100644 --- a/neo/io/brainwaredamio.py +++ b/neo/io/brainwaredamio.py @@ -138,7 +138,7 @@ def read_block(self, lazy=False, **kargs): chx = ChannelIndex(file_origin=self._filename, channel_ids=np.array([1]), index=np.array([0]), - channel_names=np.array(['Chan1'], dtype='S')) + channel_names=np.array(['Chan1'], dtype='U')) # load objects into their containers block.channel_indexes.append(chx) diff --git a/neo/io/brainwaresrcio.py b/neo/io/brainwaresrcio.py index f41cf772d..93bf94370 100755 --- a/neo/io/brainwaresrcio.py +++ b/neo/io/brainwaresrcio.py @@ -951,7 +951,7 @@ def __read_segment_list(self): # create a channel_index for the numchannels self._chx.index = np.arange(numchannels) self._chx.channel_names = np.array(['Chan{}'.format(i) - for i in range(numchannels)], dtype='S') + for i in range(numchannels)], dtype='U') # store what side of the head we are dealing with for segment in segments: diff --git a/neo/test/coretest/test_channelindex.py b/neo/test/coretest/test_channelindex.py index 64ca1e160..7a4b06fe5 100644 --- a/neo/test/coretest/test_channelindex.py +++ b/neo/test/coretest/test_channelindex.py @@ -36,7 +36,7 @@ def setUp(self): # channel_indexes = get_fake_value('channel_indexes', np.ndarray, seed=0, # dim=1, dtype='i') # channel_names = get_fake_value('channel_names', np.ndarray, seed=1, - # dim=1, dtype=np.dtype('S')) + # dim=1, dtype=np.dtype('U')) # name = get_fake_value('name', str, seed=3, obj=ChannelIndex) # description = get_fake_value('description', str, seed=4, # obj='ChannelIndex') @@ -148,7 +148,7 @@ def test__channelindex__init_defaults(self): self.assertEqual(chx.name, None) self.assertEqual(chx.file_origin, None) self.assertEqual(chx.analogsignals, []) - assert_arrays_equal(chx.channel_names, np.array([], dtype='S')) + assert_arrays_equal(chx.channel_names, np.array([], dtype='U')) assert_arrays_equal(chx.index, np.array([1])) def test_channelindex__init(self): @@ -158,7 +158,7 @@ def test_channelindex__init(self): self.assertEqual(chx.file_origin, 'temp.dat') self.assertEqual(chx.name, None) self.assertEqual(chx.analogsignals, []) - assert_arrays_equal(chx.channel_names, np.array([], dtype='S')) + assert_arrays_equal(chx.channel_names, np.array([], dtype='U')) assert_arrays_equal(chx.index, np.array([1])) def check_creation(self, chx): diff --git a/neo/test/iotest/test_brainwaredamio.py b/neo/test/iotest/test_brainwaredamio.py index 0449fc2d4..f1170820f 100644 --- a/neo/test/iotest/test_brainwaredamio.py +++ b/neo/test/iotest/test_brainwaredamio.py @@ -51,7 +51,7 @@ def proc_dam(filename): chx = ChannelIndex(file_origin=filename, index=np.array([0]), channel_ids=np.array([1]), - channel_names=np.array(['Chan1'], dtype='S')) + channel_names=np.array(['Chan1'], dtype='U')) block.channel_indexes.append(chx) diff --git a/neo/test/iotest/test_brainwaref32io.py b/neo/test/iotest/test_brainwaref32io.py index e4189a9ed..ddc326013 100644 --- a/neo/test/iotest/test_brainwaref32io.py +++ b/neo/test/iotest/test_brainwaref32io.py @@ -43,7 +43,7 @@ def proc_f32(filename): block = Block(file_origin=filenameorig) chx = ChannelIndex(file_origin=filenameorig, index=np.array([], dtype=np.int), - channel_names=np.array([], dtype='S')) + channel_names=np.array([], dtype='U')) unit = Unit(file_origin=filenameorig) # load objects into their containers diff --git a/neo/test/iotest/test_brainwaresrcio.py b/neo/test/iotest/test_brainwaresrcio.py index 8a3b9fd96..073dc947b 100644 --- a/neo/test/iotest/test_brainwaresrcio.py +++ b/neo/test/iotest/test_brainwaresrcio.py @@ -78,7 +78,7 @@ def proc_src(filename): chan_nums = np.arange(NChannels, dtype='int') chan_names = ['Chan{}'.format(i) for i in range(NChannels)] chx.index = chan_nums - chx.channel_names = np.array(chan_names, dtype='string_') + chx.channel_names = np.array(chan_names, dtype='U') block.channel_indexes.append(chx) for rep in srcfile['sets'][0, 0].flatten(): diff --git a/neo/test/iotest/test_neuralynxio.py b/neo/test/iotest/test_neuralynxio.py index 927ae6b3e..6a9bcd1e5 100644 --- a/neo/test/iotest/test_neuralynxio.py +++ b/neo/test/iotest/test_neuralynxio.py @@ -256,7 +256,7 @@ def test_ncs(self): chid = anasig.channel_index.channel_ids[anasig_id] # need to decode, unless keyerror - chname = anasig.channel_index.channel_names[anasig_id].decode('UTF-8') + chname = anasig.channel_index.channel_names[anasig_id] chuid = (chname, chid) filename = nio.ncs_filenames[chuid][:-3] + 'txt' filename = filename.replace('original_data', 'plain_data')