Skip to content

Commit 10d12a6

Browse files
author
Thinh Nguyen
committed
specify lfp filepath as input
1 parent 34e59cc commit 10d12a6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

element_array_ephys/readers/kilosort_triggering.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,18 @@ def generate_modules_input_json(self):
375375

376376
continuous_file = self._get_raw_data_filepaths()
377377

378+
lf_dir = self._npx_input_dir.as_posix()
379+
try:
380+
# old probe folder convention with 100.0, 100.1, 100.2, 100.3, etc.
381+
name, num = re.search(r"(.+\.)(\d)+$", lf_dir).groups()
382+
except AttributeError:
383+
# new probe folder convention with -AP or -LFP
384+
assert lf_dir.endswith("AP")
385+
lf_dir = re.sub("-AP$", "-LFP", lf_dir)
386+
else:
387+
lf_dir = f"{name}{int(num) + 1}"
388+
lf_file = pathlib.Path(lf_dir) / 'continuous.dat'
389+
378390
params = {}
379391
for k, v in self._params.items():
380392
value = str(v) if isinstance(v, list) else v
@@ -389,6 +401,7 @@ def generate_modules_input_json(self):
389401
npx_directory=self._npx_input_dir.as_posix(),
390402
spikeGLX_data=False,
391403
continuous_file=continuous_file.as_posix(),
404+
lf_file=lf_file.as_posix(),
392405
extracted_data_directory=self._ks_output_dir.as_posix(),
393406
kilosort_output_directory=self._ks_output_dir.as_posix(),
394407
kilosort_output_tmp=self._ks_output_dir.as_posix(),
@@ -444,13 +457,14 @@ def run_modules(self):
444457
self._update_total_duration()
445458

446459
def _get_raw_data_filepaths(self):
460+
raw_ap_fp = self._npx_input_dir / 'continuous.dat'
461+
447462
if 'median_subtraction' not in self._modules:
448-
return self._npx_input_dir / 'continuous.dat'
463+
return raw_ap_fp
449464

450465
# median subtraction step will overwrite original continuous.dat file with the corrected version
451466
# to preserve the original raw data - make a copy here and work on the copied version
452467
assert 'depth_estimation' in self._modules
453-
raw_ap_fp = self._npx_input_dir / 'continuous.dat'
454468
continuous_file = self._ks_output_dir / 'continuous.dat'
455469
if continuous_file.exists():
456470
if raw_ap_fp.stat().st_mtime < continuous_file.stat().st_mtime:

0 commit comments

Comments
 (0)