[BUG]: subject ID truncated incorrectly in condor submit dag file #322
3 changed files with 19 additions and 4 deletions
1
docs/changes/newsfragments/322.bugfix
Normal file
1
docs/changes/newsfragments/322.bugfix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Force ``str`` dtype when parsing elements from file by `Synchon Mandal`_
|
||||||
|
|
@ -114,14 +114,13 @@ def _parse_elements_file(filepath: Path) -> List[Tuple[str, ...]]:
|
||||||
filepath,
|
filepath,
|
||||||
header=None, # no header # type: ignore
|
header=None, # no header # type: ignore
|
||||||
index_col=False, # no index column
|
index_col=False, # no index column
|
||||||
|
dtype=str,
|
||||||
skipinitialspace=True, # no leading space after delimiter
|
skipinitialspace=True, # no leading space after delimiter
|
||||||
)
|
)
|
||||||
# Remove trailing whitespace in cell entries
|
# Remove trailing whitespace in cell entries
|
||||||
csv_df_trimmed = csv_df.apply(
|
csv_df_trimmed = csv_df.apply(lambda x: x.str.strip())
|
||||||
lambda x: x.str.strip() if x.dtype == "object" else x
|
|
||||||
)
|
|
||||||
# Convert to list of tuple of str
|
# Convert to list of tuple of str
|
||||||
return list(map(tuple, csv_df_trimmed.to_numpy().astype(str)))
|
return list(map(tuple, csv_df_trimmed.to_numpy()))
|
||||||
|
|
||||||
|
|
||||||
def _validate_verbose(
|
def _validate_verbose(
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,21 @@ def test_run_using_element_file(tmp_path: Path, elements: str) -> None:
|
||||||
" sub-01 , ses-01 \n sub-02, ses-01 ",
|
" sub-01 , ses-01 \n sub-02, ses-01 ",
|
||||||
[("sub-01", "ses-01"), ("sub-02", "ses-01")],
|
[("sub-01", "ses-01"), ("sub-02", "ses-01")],
|
||||||
),
|
),
|
||||||
|
("001,01", [("001", "01")]),
|
||||||
|
(
|
||||||
|
"001,01\n002,02",
|
||||||
|
[("001", "01"), ("002", "02")],
|
||||||
|
),
|
||||||
|
("001, 01", [("001", "01")]),
|
||||||
|
(
|
||||||
|
"001, 01\n002, 02",
|
||||||
|
[("001", "01"), ("002", "02")],
|
||||||
|
),
|
||||||
|
(" 001 , 01 ", [("001", "01")]),
|
||||||
|
(
|
||||||
|
" 001 , 01 \n 002, 02 ",
|
||||||
|
[("001", "01"), ("002", "02")],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_multi_element_access(
|
def test_multi_element_access(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue