@@ -81,8 +81,13 @@ def _parse_header(self):
8181 new_channels = []
8282 for chan_info in d ['channels' ]:
8383 chan_id = chan_info ['channel_name' ]
84+ if chan_info ["units" ] == "" :
85+ # in some cases for some OE version the unit is "", but the gain is to "uV"
86+ units = "uV"
87+ else :
88+ units = chan_info ["units" ]
8489 new_channels .append ((chan_info ['channel_name' ],
85- chan_id , float (d ['sample_rate' ]), d ['dtype' ], chan_info [ ' units' ] ,
90+ chan_id , float (d ['sample_rate' ]), d ['dtype' ], units ,
8691 chan_info ['bit_volts' ], 0. , stream_id ))
8792 signal_channels .extend (new_channels )
8893 signal_channels = np .array (signal_channels , dtype = _signal_channel_dtype )
@@ -136,6 +141,9 @@ def _parse_header(self):
136141 elif 'channels' in d :
137142 # ttl case use channels
138143 d ['labels' ] = d ['channels' ].astype ('U' )
144+ elif 'states' in d :
145+ # ttl case use states
146+ d ['labels' ] = d ['states' ].astype ('U' )
139147 else :
140148 raise ValueError (f'There is no possible labels for this event: { stream_name } ' )
141149
@@ -295,8 +303,8 @@ def _rescale_epoch_duration(self, raw_duration, dtype):
295303 pass
296304
297305
298- _possible_event_stream_names = ('timestamps' , 'channels' , 'text' ,
299- 'full_word' , 'channel_states' , 'data_array' , 'metadata' )
306+ _possible_event_stream_names = ('timestamps' , 'channels' , 'text' , 'states' ,
307+ 'full_word' , 'channel_states' , 'data_array' , 'metadata' )
300308
301309
302310def explore_folder (dirname ):
0 commit comments