Skip to content

Commit 9abe7a9

Browse files
authored
Merge branch 'main' into enh/normalize-gradients-unit-sphere
2 parents 3883853 + 3bca8be commit 9abe7a9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/nifreeze/data/base.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
AFFINE_NDIM_ERROR_MSG = "BaseDataset 'affine' must be a 2D array"
6363
"""Affine dimensionality error message."""
6464

65-
AFFINE_SHAPE_ERROR_MSG = "BaseDataset 'affine' must be a 2-D numpy array (4 x 4)"
65+
AFFINE_SHAPE_ERROR_MSG = "BaseDataset 'affine' must be a 2D numpy array (4 x 4)"
6666
"""BaseDataset initialization affine shape error message."""
6767

6868
BRAINMASK_SHAPE_MISMATCH_ERROR_MSG = "BaseDataset 'brainmask' shape ({brainmask_shape}) does not match dataset volumes ({data_shape})."
@@ -177,10 +177,10 @@ def _cmp(lh: Any, rh: Any) -> bool:
177177
return lh == rh
178178

179179

180-
def _dataobj_validator(inst: BaseDataset, attr: attrs.Attribute, value: Any) -> None:
180+
def validate_dataobj(inst: BaseDataset, attr: attrs.Attribute, value: Any) -> None:
181181
"""Strict validator for data objects.
182182
183-
It enforces that ``value`` is present and is a NumPy array with exactly 4
183+
Enforces that ``value`` is present and is a NumPy array with exactly 4
184184
dimensions (``ndim == 4``).
185185
186186
This function is intended for use as an attrs-style validator.
@@ -189,7 +189,7 @@ def _dataobj_validator(inst: BaseDataset, attr: attrs.Attribute, value: Any) ->
189189
----------
190190
inst : :obj:`~nifreeze.data.base.BaseDataset`
191191
The instance being validated (unused, present for validator signature).
192-
attr : :obj:`attrs.Attribute`
192+
attr : :obj:`~attrs.Attribute`
193193
The attribute being validated (unused, present for validator signature).
194194
value : :obj:`Any`
195195
The value to validate.
@@ -211,18 +211,18 @@ def _dataobj_validator(inst: BaseDataset, attr: attrs.Attribute, value: Any) ->
211211
raise ValueError(DATAOBJ_NDIM_ERROR_MSG)
212212

213213

214-
def _affine_validator(inst: BaseDataset, attr: attrs.Attribute, value: Any) -> None:
214+
def validate_affine(inst: BaseDataset, attr: attrs.Attribute, value: Any) -> None:
215215
"""Strict validator for affine matrices.
216216
217-
It enforces that ``value`` is present and is a 4x4 NumPy array.
217+
Enforces that ``value`` is present and is a 4x4 NumPy array.
218218
219219
This function is intended for use as an attrs-style validator.
220220
221221
Parameters
222222
----------
223223
inst : :obj:`~nifreeze.data.base.BaseDataset`
224224
The instance being validated (unused, present for validator signature).
225-
attr : :obj:`attrs.Attribute`
225+
attr : :obj:`~attrs.Attribute`
226226
The attribute being validated (unused, present for validator signature).
227227
value : :obj:`Any`
228228
The value to validate.
@@ -265,11 +265,11 @@ class BaseDataset(Generic[Unpack[Ts]]):
265265
"""
266266

267267
dataobj: np.ndarray = attrs.field(
268-
default=None, repr=_data_repr, eq=attrs.cmp_using(eq=_cmp), validator=_dataobj_validator
268+
default=None, repr=_data_repr, eq=attrs.cmp_using(eq=_cmp), validator=validate_dataobj
269269
)
270270
"""A :obj:`~numpy.ndarray` object for the data array."""
271271
affine: np.ndarray = attrs.field(
272-
default=None, repr=_data_repr, eq=attrs.cmp_using(eq=_cmp), validator=_affine_validator
272+
default=None, repr=_data_repr, eq=attrs.cmp_using(eq=_cmp), validator=validate_affine
273273
)
274274
"""Best affine for RAS-to-voxel conversion of coordinates (NIfTI header)."""
275275
brainmask: np.ndarray | None = attrs.field(

0 commit comments

Comments
 (0)