Skip to content

Commit 2a46909

Browse files
committed
Added docstrings
1 parent 71924b2 commit 2a46909

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

WrapImage/nifti_wrapper.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ def loop_over_first_n_minus_1_dimensions(arr):
2525
yield idx, flat_view
2626

2727
def generate_data(data, bvals, b0_indices, groups, total_iteration):
28+
"""
29+
Generates data samples for a multiprocess fitting
30+
31+
Args:
32+
data: The raw data to be sampled
33+
bvals: The bvalues
34+
b0_indices: The b0 indices in the data
35+
groups: The group indices in the data
36+
total_iterations: The total number of iterations to generate
37+
38+
Yields:
39+
A tuple containing matching: data, bvalues, and b0_indices
40+
"""
2841
num_directions = groups.shape[1]
2942
data = data.reshape(total_iteration, -1)
3043
for idx in range(total_iteration):
@@ -33,6 +46,16 @@ def generate_data(data, bvals, b0_indices, groups, total_iteration):
3346
yield (data[idx, groups[:, dir]].flatten(), bvals[:, groups[:, dir]].ravel(), b0_indices[:, groups[:, dir]].ravel())
3447

3548
def osipi_fit(fitfunc, data_bvals):
49+
"""
50+
Fit the data using the provided fit function
51+
52+
Args:
53+
fitfunc: The fit function
54+
data_bvals: The tuple of data, bvals, and b0_indices
55+
56+
Returns:
57+
The fitted values
58+
"""
3659
data, bvals, b0_indices = data_bvals
3760
data = normalize_series(data, b0_indices)
3861
# print(f'data.shape {data.shape} data {data} bvals {bvals}')

0 commit comments

Comments
 (0)