Skip to content

Commit a557b17

Browse files
kabilarCBroz1
authored andcommitted
Rebase, squashed. See Details
Add element_data_loader for multiple root dirs Update author Fix import Fix OpenEphys session path Update directory path Add print statement Fix for missing `fileTimeSecs` Update error message Suggested adds re upstream components Directing to workflow for upstream `SkullReference` and utility functions
1 parent 63b545d commit a557b17

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

element_array_ephys/ephys.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def activate(ephys_schema_name, probe_schema_name=None, *, create_schema=True,
5757

5858
def get_ephys_root_data_dir() -> list:
5959
"""
60-
All data paths, directories in DataJoint Elements are recommended to be
61-
stored as relative paths, with respect to some user-configured "root"
62-
directory, which varies from machine to machine (e.g. different mounted
60+
All data paths, directories in DataJoint Elements are recommended to be
61+
stored as relative paths, with respect to some user-configured "root"
62+
directory, which varies from machine to machine (e.g. different mounted
6363
drive locations)
6464
6565
get_ephys_root_data_dir() -> list
@@ -142,7 +142,7 @@ class EphysFile(dj.Part):
142142

143143
def make(self, key):
144144

145-
session_dir = find_full_path(get_ephys_root_data_dir(),
145+
session_dir = find_full_path(get_ephys_root_data_dir(),
146146
get_session_directory(key))
147147

148148
inserted_probe_serial_number = (ProbeInsertion * probe.Probe & key).fetch1('probe')
@@ -191,7 +191,7 @@ def make(self, key):
191191
'acq_software': acq_software,
192192
'sampling_rate': spikeglx_meta.meta['imSampRate']})
193193

194-
root_dir = find_root_directory(get_ephys_root_data_dir(),
194+
root_dir = find_root_directory(get_ephys_root_data_dir(),
195195
meta_filepath)
196196
self.EphysFile.insert1({
197197
**key,
@@ -294,8 +294,8 @@ def make(self, key):
294294
shank, shank_col, shank_row, _ = spikeglx_recording.apmeta.shankmap['data'][recorded_site]
295295
electrode_keys.append(probe_electrodes[(shank, shank_col, shank_row)])
296296
elif acq_software == 'Open Ephys':
297-
298-
session_dir = find_full_path(get_ephys_root_data_dir(),
297+
298+
session_dir = find_full_path(get_ephys_root_data_dir(),
299299
get_session_directory(key))
300300

301301
loaded_oe = openephys.OpenEphys(session_dir)
@@ -457,8 +457,14 @@ class Curation(dj.Manual):
457457

458458
def create1_from_clustering_task(self, key, curation_note=''):
459459
"""
460-
A function to create a new corresponding "Curation" for a particular
460+
<<<<<<< HEAD
461+
A function to create a new corresponding "Curation" for a particular
461462
"ClusteringTask"
463+
=======
464+
A function to create a new corresponding "Curation" for a particular
465+
"ClusteringTask", which assumes that no curation was performed on the
466+
dataset
467+
>>>>>>> dee1c29 (Rebase, squashed. See Details)
462468
"""
463469
if key not in Clustering():
464470
raise ValueError(f'No corresponding entry in Clustering available'
@@ -472,9 +478,9 @@ def create1_from_clustering_task(self, key, curation_note=''):
472478
# Synthesize curation_id
473479
curation_id = dj.U().aggr(self & key, n='ifnull(max(curation_id)+1,1)').fetch1('n')
474480
self.insert1({**key, 'curation_id': curation_id,
475-
'curation_time': creation_time,
481+
'curation_time': creation_time,
476482
'curation_output_dir': output_dir,
477-
'quality_control': is_qc,
483+
'quality_control': is_qc,
478484
'manual_curation': is_curated,
479485
'curation_note': curation_note})
480486

@@ -622,7 +628,7 @@ def yield_unit_waveforms():
622628
spikeglx_meta_filepath = get_spikeglx_meta_filepath(key)
623629
neuropixels_recording = spikeglx.SpikeGLX(spikeglx_meta_filepath.parent)
624630
elif acq_software == 'Open Ephys':
625-
session_dir = find_full_path(get_ephys_root_data_dir(),
631+
session_dir = find_full_path(get_ephys_root_data_dir(),
626632
get_session_directory(key))
627633
openephys_dataset = openephys.OpenEphys(session_dir)
628634
neuropixels_recording = openephys_dataset.probes[probe_serial_number]
@@ -669,7 +675,7 @@ def get_spikeglx_meta_filepath(ephys_recording_key):
669675
except FileNotFoundError:
670676
# if not found, search in session_dir again
671677
if not spikeglx_meta_filepath.exists():
672-
session_dir = find_full_path(get_ephys_root_data_dir(),
678+
session_dir = find_full_path(get_ephys_root_data_dir(),
673679
get_session_directory(
674680
ephys_recording_key))
675681
inserted_probe_serial_number = (ProbeInsertion * probe.Probe
@@ -708,7 +714,7 @@ def get_neuropixels_channel2electrode_map(ephys_recording_key, acq_software):
708714
for recorded_site, (shank, shank_col, shank_row, _) in enumerate(
709715
spikeglx_meta.shankmap['data'])}
710716
elif acq_software == 'Open Ephys':
711-
session_dir = find_full_path(get_ephys_root_data_dir(),
717+
session_dir = find_full_path(get_ephys_root_data_dir(),
712718
get_session_directory(ephys_recording_key))
713719
openephys_dataset = openephys.OpenEphys(session_dir)
714720
probe_serial_number = (ProbeInsertion & ephys_recording_key).fetch1('probe')

0 commit comments

Comments
 (0)