Skip to content

Commit

Permalink
Handle copying for behavior.pkl files
Browse files Browse the repository at this point in the history
  • Loading branch information
bjhardcastle authored Jan 7, 2025
1 parent fd9b279 commit be3b5c5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/np_workflows/shared/base_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ def rename_split_ephys_folders(self) -> None:
renamed_folders.append(renamed)
logger.info('Renamed split ephys folders %r', split_folders)
np_services.OpenEphys.data_files = renamed_folders

@staticmethod
def contains_uuid(text: str) -> bool:
hexchars = '[0-9a-fA-F]'
pattern = rf"{hexchars}{{8}}-{hexchars}{{4}}-{hexchars}{{4}}-{hexchars}{{4}}-{hexchars}{{12}}"
return re.search(pattern, text) is not None

def copy_data_files(self) -> None:
"""Copy data files from raw data storage to session folder for all services."""
Expand All @@ -405,6 +411,8 @@ def copy_data_files(self) -> None:
for _ in ('opto', 'main', 'mapping', 'behavior'):
if _ in file.name:
renamed = f'{self.session.folder}.{"stim" if _ == "main" else _}.pkl'
elif self.contains_uuid(file.name):
renamed = f'{self.session.folder}.behavior.pkl'
elif file.suffix in ('.json', '.mp4') and (cam_label := re.match('Behavior|Eye|Face',file.name)):
renamed = f'{self.session.folder}.{cam_label.group().lower()}{file.suffix}'
elif file.suffix in ('.json', '.mp4') and (cam_label := re.match('BEH|EYE|FACE',file.name)):
Expand Down

0 comments on commit be3b5c5

Please sign in to comment.