@@ -103,7 +103,7 @@ def write_probeinterface(file: Union[str, Path], probe_or_probegroup: Union[Prob
103
103
tsv_label_map_to_probeinterface = {v : k for k , v in tsv_label_map_to_BIDS .items ()}
104
104
105
105
106
- def read_BIDS_probe (folder : Union [str , Path ], prefix : bool = None ) -> ProbeGroup :
106
+ def read_BIDS_probe (folder : Union [str , Path ], prefix : Optional [ str ] = None ) -> ProbeGroup :
107
107
"""
108
108
Read to BIDS probe format.
109
109
@@ -114,7 +114,7 @@ def read_BIDS_probe(folder: Union[str, Path], prefix: bool = None) -> ProbeGroup
114
114
----------
115
115
folder: Path or str
116
116
The folder to scan for probes and contacts files
117
- prefix : None or str
117
+ prefix : str
118
118
Prefix of the probes and contacts files
119
119
120
120
Returns
@@ -140,8 +140,8 @@ def read_BIDS_probe(folder: Union[str, Path], prefix: bool = None) -> ProbeGroup
140
140
probes_file = probes_files [0 ]
141
141
contacts_file = contacts_files [0 ]
142
142
else :
143
- probes_file = folder / prefix + " _probes.tsv"
144
- contacts_file = folder / prefix + " _contacts.tsv"
143
+ probes_file = folder / f" { prefix } _probes.tsv"
144
+ contacts_file = folder / f" { prefix } _contacts.tsv"
145
145
for file in [probes_file , contacts_file ]:
146
146
if not file .exists ():
147
147
raise ValueError (f"Source file does not exist ({ file } )" )
@@ -955,7 +955,7 @@ def read_imro(file_path: Union[str, Path]) -> Probe:
955
955
return _read_imro_string (imro_str )
956
956
957
957
958
- def _read_imro_string (imro_str : str , imDatPrb_pn : str = None ) -> Probe :
958
+ def _read_imro_string (imro_str : str , imDatPrb_pn : Optional [ str ] = None ) -> Probe :
959
959
"""
960
960
Parse the IMRO table when presented as a string and create a Probe object.
961
961
@@ -986,7 +986,7 @@ def _read_imro_string(imro_str: str, imDatPrb_pn: str = None) -> Probe:
986
986
elif len (imro_table_header ) == 2 :
987
987
imDatPrb_type , num_contact = imro_table_header
988
988
else :
989
- raise RuntimeError (f'read_imro error, the header has a strange length: { imro_table_header } ' )
989
+ raise ValueError (f'read_imro error, the header has a strange length: { imro_table_header } ' )
990
990
991
991
992
992
if imDatPrb_type in [0 , None ]:
0 commit comments