Skip to content

Commit 4afc0f1

Browse files
author
Thinh Nguyen
committed
bugfix
1 parent f3d98b3 commit 4afc0f1

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

elements_ephys/ephys.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def make(self, key):
228228
spikeglx_rec_dir = (root_dir / spikeglx_meta_fp).parent
229229
spikeglx_recording = spikeglx.SpikeGLX(spikeglx_rec_dir)
230230

231-
lfp_chn_ind = spikeglx_recording.lfmeta.recording_channels[-1::-self.skip_chn_counts]
231+
lfp_chn_ind = spikeglx_recording.lfmeta.recording_channels[-1::-self._skip_chn_counts]
232232

233233
# Extract LFP data at specified channels and convert to uV
234234
lfp = spikeglx_recording.lf_timeseries[:, lfp_chn_ind] # (sample x channel)
@@ -258,10 +258,10 @@ def make(self, key):
258258
loaded_oe = openephys.OpenEphys(sess_dir)
259259
oe_probe = loaded_oe.probes[probe_sn]
260260

261-
lfp_chn_ind = np.arange(len(oe_probe.lfp_meta['channels_ids']))[-1::-self.skip_chn_counts]
261+
lfp_chn_ind = np.arange(len(oe_probe.lfp_meta['channels_ids']))[-1::-self._skip_chn_counts]
262262

263263
lfp = oe_probe.lfp_timeseries[:, lfp_chn_ind] # (sample x channel)
264-
lfp = (lfp * oe_probe.lfp_meta['channels_gains'][lfp_chn_ind]).T # (channel x sample)
264+
lfp = (lfp * np.array(oe_probe.lfp_meta['channels_gains'])[lfp_chn_ind]).T # (channel x sample)
265265
lfp_timestamps = oe_probe.lfp_timestamps
266266

267267
self.insert1(dict(key,
@@ -271,7 +271,7 @@ def make(self, key):
271271

272272
q_electrodes = probe.ProbeType.Electrode * probe.ElectrodeConfig.Electrode * EphysRecording & key
273273
electrodes = []
274-
for chn_idx in oe_probe.lfp_meta['channels_ids'][lfp_chn_ind]:
274+
for chn_idx in np.array(oe_probe.lfp_meta['channels_ids'])[lfp_chn_ind]:
275275
electrodes.append((q_electrodes & {'electrode': chn_idx}).fetch1('KEY'))
276276

277277
chn_lfp = list(zip(electrodes, lfp))

elements_ephys/readers/spikeglx.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, root_dir):
4141
meta_filepath = next(pathlib.Path(root_dir).glob('*.ap.meta'))
4242
except StopIteration:
4343
raise FileNotFoundError(f'No SpikeGLX file (.ap.meta) found at: {root_dir}')
44-
44+
4545
self.root_name = meta_filepath.name.replace('.ap.meta', '')
4646

4747
@property
@@ -187,8 +187,7 @@ def __init__(self, meta_filepath):
187187
self.imroTbl = self._parse_imrotbl(self.meta['~imroTbl']) if '~imroTbl' in self.meta else None
188188

189189
# Channels being recorded, exclude Sync channels - basically a 1-1 mapping to shankmap
190-
self.recording_channels = [int(v[0]) for k, v in self.chanmap.items()
191-
if k != 'shape' and not k.startswith('SY')]
190+
self.recording_channels = np.arange(len(self.imroTbl['data']))[self.get_recording_channels_indices(exclude_sync=True)]
192191

193192
@staticmethod
194193
def _parse_chanmap(raw):

0 commit comments

Comments
 (0)