Skip to content

Commit 2b8ae70

Browse files
Update Super_IVIM_DC.py
1 parent 4787fde commit 2b8ae70

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/standardized/Super_IVIM_DC.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,18 @@ def ivim_fit(self, signals, bvalues, **kwargs):
106106
bvalues=self.bvalues,
107107
model_path=f"{self.working_dir}/{self.super_ivim_dc_filename}.pt",
108108
)
109-
110-
Dp = float(np.atleast_1d(Dp).ravel()[0])
111-
Dt = float(np.atleast_1d(Dt).ravel()[0])
112-
f = float(np.atleast_1d(f).ravel()[0])
109+
# fallback for empty arrays
110+
if Dp.size == 0:
111+
Dp = 0.0
112+
if Dt.size == 0:
113+
Dt = 0.0
114+
if f.size == 0:
115+
f = 0.0
113116

114117
results = {}
115-
results["D"] = safe_scalar(float(np.array(Dt).item()))
116-
results["f"] = safe_scalar(float(np.array(f).item()))
117-
results["Dp"] = safe_scalar(float(np.array(Dp).item()))
118+
results["D"] = Dt
119+
results["f"] = f
120+
results["Dp"] = Dp
118121

119122
return results
120123

0 commit comments

Comments
 (0)