@@ -57,19 +57,17 @@ def _parse_header(self):
5757
5858 self .smrx_file = sonpy .lib .SonFile (sName = str (self .filename ), bReadOnly = True )
5959 smrx = self .smrx_file
60-
60+
6161 self ._time_base = smrx .GetTimeBase ()
6262
6363 channel_infos = []
6464 signal_channels = []
6565 spike_channels = []
6666 self ._all_spike_ticks = {}
67-
67+
6868 for chan_ind in range (smrx .MaxChannels ()):
6969 chan_type = smrx .ChannelType (chan_ind )
7070 chan_id = str (chan_ind )
71- #~ print(chan_type)
72- #~ continue
7371 if chan_type == sonpy .lib .DataType .Adc :
7472 physical_chan = smrx .PhysicalChannel (chan_ind )
7573 divide = smrx .ChannelDivide (chan_ind )
@@ -86,7 +84,7 @@ def _parse_header(self):
8684 offset = smrx .GetChannelOffset (chan_ind )
8785 units = smrx .GetChannelUnits (chan_ind )
8886 ch_name = smrx .GetChannelTitle (chan_ind )
89-
87+
9088 dtype = 'int16'
9189 # set later after grouping
9290 stream_id = '0'
@@ -101,12 +99,12 @@ def _parse_header(self):
10199 divide = smrx .ChannelDivide (chan_ind )
102100 # here we don't use filter (sonpy.lib.MarkerFilter()) so we get all marker
103101 wave_marks = smrx .ReadWaveMarks (chan_ind , int (max_time / divide ), 0 , max_time )
104-
105- # here we load in memory all spike once for all because the access is really slow
102+
103+ # here we load in memory all spike once because the access is really slow
106104 # with the ReadWaveMarks
107105 spike_ticks = np .array ([t .Tick for t in wave_marks ])
108106 spike_codes = np .array ([t .Code1 for t in wave_marks ])
109-
107+
110108 unit_ids = np .unique (spike_codes )
111109 for unit_id in unit_ids :
112110 name = f'{ ch_name } #{ unit_id } '
@@ -115,8 +113,7 @@ def _parse_header(self):
115113 mask = spike_codes == unit_id
116114 self ._all_spike_ticks [spike_chan_id ] = spike_ticks [mask ]
117115
118- signal_channels = np .array (signal_channels , dtype = _signal_channel_dtype )
119-
116+ signal_channels = np .array (signal_channels , dtype = _signal_channel_dtype )
120117
121118 # channels are grouped into stream if they have a common start, stop, size, divide and sampling_rate
122119 channel_infos = np .array (channel_infos ,
@@ -145,11 +142,9 @@ def _parse_header(self):
145142 self ._seg_t_stop = - np .inf
146143 for info in self .stream_info :
147144 self ._seg_t_start = min (self ._seg_t_start ,
148- #~ info['first_time'] / info['sampling_rate'])
149145 info ['first_time' ] * self ._time_base )
150-
146+
151147 self ._seg_t_stop = max (self ._seg_t_stop ,
152- #~ info['max_time'] / info['sampling_rate'])
153148 info ['max_time' ] * self ._time_base )
154149
155150 self .header = {}
@@ -174,7 +169,6 @@ def _get_signal_size(self, block_index, seg_index, stream_index):
174169
175170 def _get_signal_t_start (self , block_index , seg_index , stream_index ):
176171 info = self .stream_info [stream_index ]
177- #~ t_start = info['first_time'] / info['sampling_rate']
178172 t_start = info ['first_time' ] * self ._time_base
179173 return t_start
180174
@@ -209,12 +203,11 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
209203 sigs [:, i ] = sig
210204
211205 return sigs
212-
206+
213207 def _spike_count (self , block_index , seg_index , unit_index ):
214208 unit_id = self .header ['spike_channels' ][unit_index ]['id' ]
215209 spike_ticks = self ._all_spike_ticks [unit_id ]
216210 return spike_ticks .size
217-
218211
219212 def _get_spike_timestamps (self , block_index , seg_index , unit_index , t_start , t_stop ):
220213 unit_id = self .header ['spike_channels' ][unit_index ]['id' ]
@@ -232,3 +225,6 @@ def _rescale_spike_timestamp(self, spike_timestamps, dtype):
232225 spike_times *= self ._time_base
233226 return spike_times
234227
228+ def _get_spike_raw_waveforms (self , block_index , seg_index ,
229+ spike_channel_index , t_start , t_stop ):
230+ return None
0 commit comments