@@ -206,8 +206,8 @@ def __init__(
206206 if stream_id is None and stream_name is None :
207207 if stream_channels .size > 1 :
208208 raise ValueError (
209- f"This reader have several streams: \n Names: { stream_names } \n IDs: { stream_ids } . "
210- f"Specify it with the 'stream_name' or 'stream_id' arguments"
209+ f"This reader have several streams: \n Names: { stream_names } \n IDs: { stream_ids } . \n "
210+ f"Specify it from the options above with the 'stream_name' or 'stream_id' arguments"
211211 )
212212 else :
213213 stream_id = stream_ids [0 ]
@@ -276,7 +276,7 @@ def __init__(
276276
277277 self .set_property ("gain_to_uV" , final_gains )
278278 self .set_property ("offset_to_uV" , final_offsets )
279- if not use_names_as_ids and not all_annotations :
279+ if not use_names_as_ids :
280280 self .set_property ("channel_names" , signal_channels ["name" ])
281281
282282 if all_annotations :
@@ -287,13 +287,26 @@ def __init__(
287287 seg_ann = block_ann ["segments" ][0 ]
288288 sig_ann = seg_ann ["signals" ][self .stream_index ]
289289
290- # scalar annotations
291- for k , v in sig_ann .items ():
292- if not k .startswith ("__" ):
293- self .set_annotation (k , v )
290+ scalar_annotations = {name : value for name , value in sig_ann .items () if not name .startswith ("__" )}
291+
292+ # name in neo corresponds to stream name
293+ # We don't propagate the name as an annotation because that has a differnt meaning on spikeinterface
294+ stream_name = scalar_annotations .pop ("name" , None )
295+ if stream_name :
296+ self .set_annotation (annotation_key = "stream_name" , value = stream_name )
297+ for annotation_key , value in scalar_annotations .items ():
298+ self .set_annotation (annotation_key = annotation_key , value = value )
299+
300+ array_annotations = sig_ann ["__array_annotations__" ]
301+ # We do not add this because is confusing for the user to have this repeated
302+ array_annotations .pop ("channel_ids" , None )
303+ # This is duplicated when using channel_names as ids
304+ if use_names_as_ids :
305+ array_annotations .pop ("channel_names" , None )
306+
294307 # vector array_annotations are channel properties
295- for k , values in sig_ann [ "__array_annotations__" ] .items ():
296- self .set_property (k , values )
308+ for key , values in array_annotations .items ():
309+ self .set_property (key = key , values = values )
297310
298311 nseg = self .neo_reader .segment_count (block_index = self .block_index )
299312 for segment_index in range (nseg ):
0 commit comments