Skip to content

Commit bd7ffd7

Browse files
committed
STYLE: Use the GradientTable class for type hinting
Use the `dipy.core.gradientsGradientTable` class for type hinting instead of `dipy.core.gradients.gradient_table`: the latter is a function name and hence does not provide type information. Fixes: ``` src/nifreeze/testing/simulations.py:151: error: Function "dipy.core.gradients.gradient_table" is not valid as a type [valid-type] src/nifreeze/testing/simulations.py:151: note: Perhaps you need "Callable[...]" or a callback protocol? src/nifreeze/testing/simulations.py:185: error: Function "dipy.core.gradients.gradient_table" is not valid as a type [valid-type] src/nifreeze/testing/simulations.py:185: note: Perhaps you need "Callable[...]" or a callback protocol? src/nifreeze/testing/simulations.py:207: error: gradient_table? has no attribute "b0s_mask" [attr-defined] src/nifreeze/testing/simulations.py:208: error: gradient_table? has no attribute "bvecs" [attr-defined] ```
1 parent a5c2bf8 commit bd7ffd7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/nifreeze/testing/simulations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import nibabel as nb
2828
import numpy as np
2929
from dipy.core.geometry import sphere2cart
30-
from dipy.core.gradients import gradient_table
30+
from dipy.core.gradients import GradientTable, gradient_table
3131
from dipy.core.sphere import HemiSphere, Sphere, disperse_charges
3232
from dipy.sims.voxel import all_tensor_evecs, multi_tensor, single_tensor
3333

@@ -148,7 +148,7 @@ def create_diffusion_encoding_gradient_dirs(
148148

149149
def create_single_shell_gradient_table(
150150
hsph_dirs: int, bval_shell: float, iterations: int = 5000
151-
) -> gradient_table:
151+
) -> GradientTable:
152152
"""
153153
Create a single-shell gradient table.
154154
@@ -163,7 +163,7 @@ def create_single_shell_gradient_table(
163163
164164
Returns
165165
-------
166-
:obj:`~dipy.core.gradients.gradient_table`
166+
:obj:`~dipy.core.gradients.GradientTable`
167167
The gradient table for the single-shell.
168168
169169
"""
@@ -182,7 +182,7 @@ def create_single_shell_gradient_table(
182182

183183

184184
def get_query_vectors(
185-
gtab: gradient_table, train_mask: np.ndarray
185+
gtab: GradientTable, train_mask: np.ndarray
186186
) -> tuple[np.ndarray, np.ndarray]:
187187
"""
188188
Get the diffusion-encoding gradient vectors for estimation from the gradient table.
@@ -193,7 +193,7 @@ def get_query_vectors(
193193
194194
Parameters
195195
----------
196-
gtab : :obj:`~dipy.core.gradients.gradient_table`
196+
gtab : :obj:`~dipy.core.gradients.GradientTable`
197197
Gradient table.
198198
train_mask : :obj:`~numpy.ndarray`
199199
Mask for selecting training vectors.

0 commit comments

Comments
 (0)