@@ -446,10 +446,7 @@ def make(self, key):
446
446
ks_dir = root_dir / (ClusteringTask & key ).fetch1 ('clustering_output_dir' )
447
447
ks = kilosort .Kilosort (ks_dir )
448
448
449
- acq_software = (EphysRecording & key ).fetch1 ('acq_software' )
450
-
451
- npx_meta_fp = root_dir / (EphysRecording .EphysFile & key & 'file_path LIKE "%.ap.meta"' ).fetch1 ('file_path' )
452
- neuropixels_dir = npx_meta_fp .parent
449
+ acq_software , probe_sn = (EphysRecording * ProbeInsertion & key ).fetch1 ('acq_software' , 'probe' )
453
450
454
451
# -- Get channel and electrode-site mapping
455
452
rec_key = (EphysRecording & key ).fetch1 ('KEY' )
@@ -467,10 +464,19 @@ def make(self, key):
467
464
if chn2electrodes [chn ]['electrode' ] == units [unit_no ]['electrode' ]:
468
465
unit_peak_waveforms .append ({** units [unit_no ], 'peak_chn_waveform_mean' : chn_wf })
469
466
else :
470
- spikeglx_recording = spikeglx .SpikeGLX (neuropixels_dir )
467
+ if acq_software == 'SpikeGLX' :
468
+ npx_meta_fp = root_dir / (EphysRecording .EphysFile & key
469
+ & 'file_path LIKE "%.ap.meta"' ).fetch1 ('file_path' )
470
+ neuropixels_dir = npx_meta_fp .parent
471
+ npx_recording = spikeglx .SpikeGLX (neuropixels_dir )
472
+ elif acq_software == 'OpenEphys' :
473
+ sess_dir = pathlib .Path (get_session_directory (key ))
474
+ loaded_oe = openephys .OpenEphys (sess_dir )
475
+ npx_recording = loaded_oe .probes [probe_sn ]
476
+
471
477
for unit_no , unit_dict in units .items ():
472
478
spks = (Clustering .Unit & unit_dict ).fetch1 ('unit_spike_times' )
473
- wfs = spikeglx_recording .extract_spike_waveforms (spks , ks .data ['channel_map' ]) # (sample x channel x spike)
479
+ wfs = npx_recording .extract_spike_waveforms (spks , ks .data ['channel_map' ]) # (sample x channel x spike)
474
480
wfs = wfs .transpose ((1 , 2 , 0 )) # (channel x spike x sample)
475
481
for chn , chn_wf in zip (ks .data ['channel_map' ], wfs ):
476
482
unit_waveforms .append ({** unit_dict , ** chn2electrodes [chn ],
0 commit comments