@@ -162,22 +162,24 @@ def make(self, key):
162162 root_dir = pathlib .Path (get_ephys_root_data_dir ())
163163 sess_dir = pathlib .Path (get_session_directory (key ))
164164
165+ inserted_probe_serial_number = (ProbeInsertion * probe .Probe & key ).fetch1 ('probe' )
166+
165167 # search session dir and determine acquisition software
166168 for ephys_pattern , ephys_acq_type in zip (['*.ap.meta' , '*.oebin' ],
167169 ['SpikeGLX' , 'Open Ephys' ]):
168170 ephys_meta_filepaths = [fp for fp in sess_dir .rglob (ephys_pattern )]
169171 if ephys_meta_filepaths :
170172 acq_software = ephys_acq_type
171173 break
172- else :
173- raise FileNotFoundError (
174- f'Ephys recording data not found!'
175- f' Neither SpikeGLX nor Open Ephys recording files found' )
174+ else :
175+ raise FileNotFoundError (
176+ f'Ephys recording data not found!'
177+ f' Neither SpikeGLX nor Open Ephys recording files found' )
176178
177179 if acq_software == 'SpikeGLX' :
178180 for meta_filepath in ephys_meta_filepaths :
179181 spikeglx_meta = spikeglx .SpikeGLXMeta (meta_filepath )
180- if spikeglx_meta .probe_SN == key [ 'probe' ] :
182+ if str ( spikeglx_meta .probe_SN ) == inserted_probe_serial_number :
181183 break
182184 else :
183185 raise FileNotFoundError (
@@ -189,7 +191,7 @@ def make(self, key):
189191
190192 probe_electrodes = {
191193 (shank , shank_col , shank_row ): key
192- for key , shank , shank_col , shank_row in zip (electrode_query .fetch (
194+ for key , shank , shank_col , shank_row in zip (* electrode_query .fetch (
193195 'KEY' , 'shank' , 'shank_col' , 'shank_row' ))}
194196
195197 electrode_group_members = [
@@ -212,7 +214,7 @@ def make(self, key):
212214 elif acq_software == 'Open Ephys' :
213215 dataset = openephys .OpenEphys (sess_dir )
214216 for serial_number , probe_data in dataset .probes .items ():
215- if serial_number == key [ 'probe' ] :
217+ if str ( serial_number ) == inserted_probe_serial_number :
216218 break
217219 else :
218220 raise FileNotFoundError (
@@ -300,7 +302,7 @@ def make(self, key):
300302 * EphysRecording & key )
301303 probe_electrodes = {
302304 (shank , shank_col , shank_row ): key
303- for key , shank , shank_col , shank_row in zip (electrode_query .fetch (
305+ for key , shank , shank_col , shank_row in zip (* electrode_query .fetch (
304306 'KEY' , 'shank' , 'shank_col' , 'shank_row' ))}
305307
306308 for recorded_site in lfp_channel_ind :
@@ -676,7 +678,7 @@ def get_neuropixels_channel2electrode_map(ephys_recording_key, acq_software):
676678
677679 probe_electrodes = {
678680 (shank , shank_col , shank_row ): key
679- for key , shank , shank_col , shank_row in zip (electrode_query .fetch (
681+ for key , shank , shank_col , shank_row in zip (* electrode_query .fetch (
680682 'KEY' , 'shank' , 'shank_col' , 'shank_row' ))}
681683
682684 channel2electrode_map = {
0 commit comments