Skip to content

Commit 140f8ff

Browse files
committed
STY: Use temporary variable to store DWI model predictions
Use temporary variable to store DWI model predictions from parallel job in `BaseDWIModel.fit_predict` method.
1 parent d52a1f3 commit 140f8ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/nifreeze/model/dmri.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def fit_predict(self, index: int | None = None, **kwargs):
200200
self._models[0], **(kwargs | {"gtab": gradient, "S0": self._S0})
201201
)
202202
else:
203-
predicted = [None] * n_models
203+
_predicted = [None] * n_models
204204
S0 = np.array_split(self._S0, n_models)
205205

206206
# Parallelize process with joblib
@@ -214,9 +214,9 @@ def fit_predict(self, index: int | None = None, **kwargs):
214214
for i, model in enumerate(self._models)
215215
)
216216
for subprediction, index in results:
217-
predicted[index] = subprediction
217+
_predicted[index] = subprediction
218218

219-
predicted = np.hstack(predicted)
219+
predicted = np.hstack(_predicted)
220220

221221
retval = np.zeros_like(self._data_mask, dtype=self._dataset.dataobj.dtype)
222222
retval[self._data_mask, ...] = predicted

0 commit comments

Comments
 (0)