Skip to content

Commit dc54ad7

Browse files
committed
moved packages out of src and set up auto version
1 parent 9985b1a commit dc54ad7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+629
-211
lines changed

pydra/tasks/fsl/__init__.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
This is a basic doctest demonstrating that the package and pydra can both be successfully
3+
imported.
4+
5+
>>> import pydra.engine
6+
>>> import pydra.tasks.fsl
7+
"""
8+
9+
from warnings import warn
10+
from pathlib import Path
11+
12+
pkg_path = Path(__file__).parent.parent
13+
14+
try:
15+
from ._version import __version__
16+
except ImportError:
17+
raise RuntimeError(
18+
"pydra-fsl has not been properly installed, please run "
19+
f"`pip install -e {str(pkg_path)}` to install a development version"
20+
)
21+
if "nipype" not in __version__:
22+
try:
23+
from .auto._version import nipype_version, nipype2pydra_version
24+
except ImportError:
25+
warn(
26+
"Nipype interfaces haven't been automatically converted from their specs in "
27+
f"`nipype-auto-conv`. Please run `{str(pkg_path / 'nipype-auto-conv' / 'generate')}` "
28+
"to generated the converted Nipype interfaces in pydra.tasks.fsl.auto"
29+
)
30+
else:
31+
n_ver = nipype_version.replace(".", "_")
32+
n2p_ver = nipype2pydra_version.replace(".", "_")
33+
__version__ += (
34+
"_" if "+" in __version__ else "+"
35+
) + f"nipype{n_ver}_nipype2pydra{n2p_ver}"
36+
37+
38+
__all__ = ["__version__"]

pydra/tasks/fsl/latest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PACKAGE_VERSION = "v6_0"
2+
3+
from .v6_0 import * # noqa
File renamed without changes.

src/pydra/tasks/fsl/bet/bet.py renamed to pydra/tasks/fsl/v6_0/bet/bet.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ class BETSpec(pydra.specs.ShellSpec):
4141
metadata={"help_string": "save brain surface outline", "argstr": "-o"}
4242
)
4343

44-
save_brain_mask: bool = attrs.field(metadata={"help_string": "save binary brain mask", "argstr": "-m"})
44+
save_brain_mask: bool = attrs.field(
45+
metadata={"help_string": "save binary brain mask", "argstr": "-m"}
46+
)
4547

46-
save_skull_image: bool = attrs.field(metadata={"help_string": "save approximate skull image", "argstr": "-s"})
48+
save_skull_image: bool = attrs.field(
49+
metadata={"help_string": "save approximate skull image", "argstr": "-s"}
50+
)
4751

4852
save_brain_surface_mesh: bool = attrs.field(
4953
metadata={
@@ -74,7 +78,8 @@ class BETSpec(pydra.specs.ShellSpec):
7478

7579
head_radius: float = attrs.field(
7680
metadata={
77-
"help_string": "Head radius (in millimeters)." " Initial surface sphere is set to half of this value.",
81+
"help_string": "Head radius (in millimeters)."
82+
" Initial surface sphere is set to half of this value.",
7883
"argstr": "-r",
7984
}
8085
)

src/pydra/tasks/fsl/eddy/applytopup.py renamed to pydra/tasks/fsl/v6_0/eddy/applytopup.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def _to_input_index(field: Union[int, Sequence[int]]) -> str:
5858
return f"--inindex={','.join(str(index) for index in indexes)}"
5959

6060

61-
def _to_topup_basename(fieldmap_image: PathLike, field_coefficients_image: PathLike) -> str:
61+
def _to_topup_basename(
62+
fieldmap_image: PathLike, field_coefficients_image: PathLike
63+
) -> str:
6264
if field_coefficients_image:
6365
path = PurePath(field_coefficients_image)
6466
basename = path.parent / path.name.split("_fieldcoef", 1)[0]
@@ -123,7 +125,11 @@ class ApplyTopupSpec(ShellSpec):
123125
)
124126

125127
fieldmap_image: PathLike = field(
126-
metadata={"help_string": "fieldmap image", "mandatory": True, "xor": {"field_coefficients_image"}}
128+
metadata={
129+
"help_string": "fieldmap image",
130+
"mandatory": True,
131+
"xor": {"field_coefficients_image"},
132+
}
127133
)
128134

129135
field_coefficients_image: PathLike = field(
@@ -135,10 +141,16 @@ class ApplyTopupSpec(ShellSpec):
135141
}
136142
)
137143

138-
movement_parameters_file: PathLike = field(metadata={"help_string": "movement parameters file computed by topup"})
144+
movement_parameters_file: PathLike = field(
145+
metadata={"help_string": "movement parameters file computed by topup"}
146+
)
139147

140148
output_image: PathLike = field(
141-
metadata={"help_string": "output image", "argstr": "--out", "formatter": _to_output_image}
149+
metadata={
150+
"help_string": "output image",
151+
"argstr": "--out",
152+
"formatter": _to_output_image,
153+
}
142154
)
143155

144156
method: str = field(
@@ -168,7 +180,9 @@ class ApplyTopupSpec(ShellSpec):
168180
},
169181
)
170182

171-
verbose: bool = field(metadata={"help_string": "enable verbose logging", "argstr": "--verbose"})
183+
verbose: bool = field(
184+
metadata={"help_string": "enable verbose logging", "argstr": "--verbose"}
185+
)
172186

173187

174188
class ApplyTopup(ShellCommandTask):

src/pydra/tasks/fsl/eddy/eddy.py renamed to pydra/tasks/fsl/v6_0/eddy/eddy.py

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ class EddySpec(ShellSpec):
8484
}
8585
)
8686

87-
fieldmap_image: PathLike = field(metadata={"help_string": "fieldmap image", "argstr": "--field={fieldmap_image}"})
87+
fieldmap_image: PathLike = field(
88+
metadata={"help_string": "fieldmap image", "argstr": "--field={fieldmap_image}"}
89+
)
8890

8991
fieldmap_matrix: PathLike = field(
9092
metadata={
@@ -95,7 +97,10 @@ class EddySpec(ShellSpec):
9597
)
9698

9799
no_peas: bool = field(
98-
metadata={"help_string": "do not perform post-Eddy alignment of shells", "argstr": "--dont_peas"}
100+
metadata={
101+
"help_string": "do not perform post-Eddy alignment of shells",
102+
"argstr": "--dont_peas",
103+
}
99104
)
100105

101106
# Parameters specifying names of output-files.
@@ -142,7 +147,9 @@ class EddySpec(ShellSpec):
142147
},
143148
)
144149

145-
fill_empty_planes: bool = field(metadata={"help_string": "detect and fill empty planes", "argstr": "--fep"})
150+
fill_empty_planes: bool = field(
151+
metadata={"help_string": "detect and fill empty planes", "argstr": "--fep"}
152+
)
146153

147154
interpolation: str = field(
148155
default="spline",
@@ -179,7 +186,9 @@ class EddySpec(ShellSpec):
179186
)
180187

181188
# Parameters for outlier replacement (ol)
182-
replace_outliers: bool = field(metadata={"help_string": "replace outliers", "argstr": "--repol"})
189+
replace_outliers: bool = field(
190+
metadata={"help_string": "replace outliers", "argstr": "--repol"}
191+
)
183192

184193
outlier_num_stdevs: int = field(
185194
metadata={
@@ -206,7 +215,12 @@ class EddySpec(ShellSpec):
206215
}
207216
)
208217

209-
multiband_factor: int = field(metadata={"help_string": "multiband factor", "argstr": "--mb={multiband_factor}"})
218+
multiband_factor: int = field(
219+
metadata={
220+
"help_string": "multiband factor",
221+
"argstr": "--mb={multiband_factor}",
222+
}
223+
)
210224

211225
multiband_offset: int = field(
212226
metadata={
@@ -297,18 +311,33 @@ class EddySpec(ShellSpec):
297311

298312
# Miscellaneous parameters.
299313
data_is_shelled: bool = field(
300-
metadata={"help_string": "bypass checks for data shelling", "argstr": "--data_is_shelled"}
314+
metadata={
315+
"help_string": "bypass checks for data shelling",
316+
"argstr": "--data_is_shelled",
317+
}
301318
)
302319

303320
random_seed: int = field(
304-
metadata={"help_string": "random seed for voxel selection", "argstr": "--initrand={random_seed}"}
321+
metadata={
322+
"help_string": "random seed for voxel selection",
323+
"argstr": "--initrand={random_seed}",
324+
}
305325
)
306326

307-
save_cnr_maps: bool = field(metadata={"help_string": "save shell-wise CNR maps", "argstr": "--cnr_maps"})
327+
save_cnr_maps: bool = field(
328+
metadata={"help_string": "save shell-wise CNR maps", "argstr": "--cnr_maps"}
329+
)
308330

309-
save_residuals: bool = field(metadata={"help_string": "save residuals for all scans", "argstr": "--residuals"})
331+
save_residuals: bool = field(
332+
metadata={
333+
"help_string": "save residuals for all scans",
334+
"argstr": "--residuals",
335+
}
336+
)
310337

311-
verbose: bool = field(metadata={"help_string": "enable verbose logging", "argstr": "--verbose"})
338+
verbose: bool = field(
339+
metadata={"help_string": "enable verbose logging", "argstr": "--verbose"}
340+
)
312341

313342

314343
@define(slots=False, kw_only=True)

src/pydra/tasks/fsl/eddy/topup.py renamed to pydra/tasks/fsl/v6_0/eddy/topup.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ class TopupSpec(ShellSpec):
4848
"""Specifications for topup."""
4949

5050
input_image: PathLike = field(
51-
metadata={"help_string": "input image", "mandatory": True, "argstr": "--imain={input_image}"}
51+
metadata={
52+
"help_string": "input image",
53+
"mandatory": True,
54+
"argstr": "--imain={input_image}",
55+
}
5256
)
5357

5458
encoding_file: PathLike = field(
@@ -204,10 +208,16 @@ class TopupSpec(ShellSpec):
204208
)
205209

206210
num_threads: int = field(
207-
default=1, metadata={"help_string": "number of threads to use", "argstr": "--nthr={num_threads}"}
211+
default=1,
212+
metadata={
213+
"help_string": "number of threads to use",
214+
"argstr": "--nthr={num_threads}",
215+
},
208216
)
209217

210-
verbose: bool = field(metadata={"help_string": "enable verbose logging", "argstr": "--verbose"})
218+
verbose: bool = field(
219+
metadata={"help_string": "enable verbose logging", "argstr": "--verbose"}
220+
)
211221

212222

213223
@define(slots=False, kw_only=True)

0 commit comments

Comments
 (0)