Skip to content

Commit

Permalink
Disable chunks with useEEGBrowserVisualizationComponents (#1220)
Browse files Browse the repository at this point in the history
  • Loading branch information
laemtl authored Jan 8, 2025
1 parent f01ecbe commit 3f684f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions python/lib/eeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@ def register_data(self, derivatives=False, detect=True):
files_to_archive, archive_rel_name, eeg_file_id
)

# create data chunks for React visualization in
# data_dir/bids_import/bids_dataset_name_BIDSVersion_chunks directory
physiological.create_chunks_for_visualization(eeg_file_id, self.data_dir)
# create data chunks for React visualization
eeg_viz_enabled = self.config_db_obj.get_config("useEEGBrowserVisualizationComponents")
if eeg_viz_enabled == 'true' or eeg_viz_enabled == '1':
physiological.create_chunks_for_visualization(eeg_file_id, self.data_dir)

def fetch_and_insert_eeg_files(self, derivatives=False, detect=True):
"""
Expand Down
7 changes: 3 additions & 4 deletions python/lib/physiological.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,8 @@ def create_chunks_for_visualization(self, physio_file_id, data_dir):
script = None
file_path = self.grep_file_path_from_file_id(physio_file_id)

chunk_root_dir = self.config_db_obj.get_config("EEGChunksPath")
chunk_root_dir_config = self.config_db_obj.get_config("EEGChunksPath")
chunk_root_dir = chunk_root_dir_config
if not chunk_root_dir:
# the bids_rel_dir is the first two directories in file_path (
# bids_imports/BIDS_dataset_name_BIDSVersion)
Expand Down Expand Up @@ -1262,12 +1263,10 @@ def create_chunks_for_visualization(self, physio_file_id, data_dir):
print('ERROR: ' + script + ' not found')
sys.exit(lib.exitcode.CHUNK_CREATION_FAILURE)

# the final chunk path will be /data/%PROJECT%/data/bids_imports
# /BIDS_dataset_name_BIDSVersion_chunks/EEG_FILENAME.chunks
chunk_path = chunk_root_dir + os.path.splitext(os.path.basename(file_path))[0] + '.chunks'
if os.path.isdir(chunk_path):
self.insert_physio_parameter_file(
physiological_file_id = physio_file_id,
parameter_name = 'electrophysiology_chunked_dataset_path',
value = chunk_path.replace(data_dir, '')
value = chunk_path.replace(chunk_root_dir_config, '') if chunk_root_dir_config else chunk_path.replace(data_dir, '')
)

0 comments on commit 3f684f5

Please sign in to comment.