Skip to content

Commit 6863054

Browse files
author
Jennings Zhang
committed
Fix output if inputdir is subject dir
1 parent a7eeed5 commit 6863054

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

surfigures/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
__version__ = '1.1.0'
2+
__version__ = '1.1.1'
33

44
DISPLAY_TITLE = r"""
55
_ __ _

surfigures/inputs/find.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ def map(self, data_file_suffix: str, output_template: str
3636
for maybe_inputs, sub_output in self._map_sided_and_everything_folders(data_file_suffix):
3737
try:
3838
inputs = maybe_inputs.unwrap()
39-
output_file = sub_output.with_name(output_template.replace('{}', inputs.title))
39+
output_file = self._name_output_file(inputs.title, sub_output, output_template)
4040
yield (inputs, output_file), None
4141
except InputError as e:
4242
yield None, e
4343

44+
def _name_output_file(self, title: str, sub_output: Path, output_template: str) -> Path:
45+
if sub_output == self.output_dir:
46+
# handle in case inputdir is a subjects folder containing left and right hemis
47+
return self.output_dir / output_template.replace('{}', title)
48+
return sub_output.with_name(output_template.replace('{}', title))
49+
4450
def _map_sided_and_everything_folders(self, data_file_suffix: str) -> Iterator[tuple[InputMonad[SubjectSet], Path]]:
4551
inputs_builder = _SubjectSetFinder(data_file_suffix)
4652
for maybe_pair, sub_output in self._sided_folders_mapper():

0 commit comments

Comments
 (0)