@@ -125,7 +125,11 @@ def extract_spike_waveforms(self, spikes, channel, n_wf=500, wf_win=(-32, 32), b
125125class SpikeGLXMeta :
126126
127127 def __init__ (self , meta_filepath ):
128- # a good processing reference: https://github.com/jenniferColonell/Neuropixels_evaluation_tools/blob/master/SGLXMetaToCoords.m
128+ """
129+ Some good processing references:
130+ https://billkarsh.github.io/SpikeGLX/Support/SpikeGLX_Datafile_Tools.zip
131+ https://github.com/jenniferColonell/Neuropixels_evaluation_tools/blob/master/SGLXMetaToCoords.m
132+ """
129133
130134 self .fname = meta_filepath
131135 self .meta = _read_meta (meta_filepath )
@@ -159,9 +163,7 @@ def __init__(self, meta_filepath):
159163 self .shankmap = self ._parse_shankmap (self .meta ['~snsShankMap' ]) if '~snsShankMap' in self .meta else None
160164 self .imroTbl = self ._parse_imrotbl (self .meta ['~imroTbl' ]) if '~imroTbl' in self .meta else None
161165
162- self .recording_channels = [c [0 ] for c in self .imroTbl ['data' ]] if self .imroTbl else None
163-
164- self ._chan_gains = None
166+ self ._recording_channels = None
165167
166168 @staticmethod
167169 def _parse_chanmap (raw ):
@@ -241,6 +243,28 @@ def _parse_imrotbl(raw):
241243
242244 return res
243245
246+ @property
247+ def recording_channels (self ):
248+ if self ._recording_channels is None :
249+ if self .meta ['snsSaveChanSubset' ] == 'all' :
250+ # output = int32, 0 to nSavedChans - 1
251+ self ._recording_channels = np .arange (0 , int (self .meta ['nSavedChans' ]))
252+ else :
253+ # parse the snsSaveChanSubset string
254+ # split at commas
255+ chStrList = self .meta ['snsSaveChanSubset' ].split (sep = ',' )
256+ self ._recording_channels = np .arange (0 , 0 ) # creates an empty array of int32
257+ for sL in chStrList :
258+ currList = sL .split (sep = ':' )
259+ if len (currList ) > 1 :
260+ # each set of contiguous channels specified by
261+ # chan1:chan2 inclusive
262+ newChans = np .arange (int (currList [0 ]), int (currList [1 ]) + 1 )
263+ else :
264+ newChans = np .arange (int (currList [0 ]), int (currList [0 ]) + 1 )
265+ self ._recording_channels = np .append (self ._recording_channels , newChans )
266+ return self ._recording_channels
267+
244268
245269# ============= HELPER FUNCTIONS =============
246270
0 commit comments