Skip to content

Commit a8bdf9e

Browse files
committed
Additional checks
1 parent d58af9e commit a8bdf9e

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

erdetect/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
from erdetect._erdetect import process
66
__all__ = ['process', '__version__']
77

8+
if sys.version_info < (3, 8, 0):
9+
sys.exit("Python 3.8 or later is required.")
10+
811
#
912
# logging
1013
#

erdetect/_erdetect.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from math import isnan, ceil
44
import numpy as np
55
import scipy.io as sio
6+
from os.path import exists
67

78
from erdetect.core.config import write_config, get as cfg, get_config_dict, OUTPUT_IMAGE_SIZE, LOGGING_CAPTION_INDENT_LENGTH
89
from erdetect.core.detection import ieeg_detect_er
@@ -21,10 +22,22 @@ def process(bids_subset_data_path, output_dir, preproc_prioritize_speed=False):
2122
bids_subset_data_path (str): The path to the data of a subset (e.g. /BIDS/sub-01/ses-ieeg01/ieeg/sub-01_task-ccep.mefd)
2223
Paths other required files such as the _channels.tsv and _events.tsv file
2324
will be derived from the data path.
25+
output_dir (str): The path to store the output files in. A subdirectory will be created for each subset.
2426
preproc_prioritize_speed (bool): Set the pre-processing priority to either memory (default, False) or speed (True).
2527
2628
"""
2729

30+
# check the input arguments
31+
if not bids_subset_data_path:
32+
logging.error('Empty or invalid input data path, exiting...')
33+
return
34+
if not exists(bids_subset_data_path):
35+
logging.error('Input data path (\'' + bids_subset_data_path +'\') could not be found, exiting...')
36+
return
37+
if not output_dir:
38+
logging.error('Empty or invalid output directory, exiting...')
39+
return
40+
2841
# derive the bids subset root from the full path
2942
bids_subset_root = bids_subset_data_path[:bids_subset_data_path.rindex('_')]
3043

0 commit comments

Comments
 (0)