Skip to content

Commit 52ecdca

Browse files
fix suggestions from PR
move swapping of D and D* to general wrapper stretch exclusion criteria
1 parent 7cc8061 commit 52ecdca

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/standardized/TCML_TechnionIIT_lsqlm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ def ivim_fit(self, signals, bvalues, **kwargs):
7878
results["f"] = fit_results[2]
7979
results["Dp"] = fit_results[1]
8080

81-
return self.D_and_Ds_swap(results)
81+
return results

src/wrappers/OsipiBase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def osipi_fit(self, data, bvalues=None, **kwargs):
106106

107107
for ijk in tqdm(np.ndindex(data.shape[:-1]), total=np.prod(data.shape[:-1])):
108108
args = [data[ijk], use_bvalues]
109-
fit = self.ivim_fit(*args, **kwargs) # For single voxel fits, we assume this is a dict with a float value per key.
109+
fit = self.D_and_Ds_swap(self.ivim_fit(*args, **kwargs)) # For single voxel fits, we assume this is a dict with a float value per key.
110110
for key in list(fit.keys()):
111111
results[key][ijk] = fit[key]
112112

@@ -282,7 +282,7 @@ def osipi_simple_bias_and_RMSE_test(self, SNR, bvalues, f, Dstar, D, noise_reali
282282
noised_signal = np.array([norm.rvs(signal, sigma) for signal in signals])
283283

284284
# Perform fit with the noised signal
285-
f_estimates[i], Dstar_estimates[i], D_estimates[i] = self.ivim_fit(noised_signal, bvalues)
285+
f_estimates[i], Dstar_estimates[i], D_estimates[i] = self.D_and_Ds_swap(self.ivim_fit(noised_signal, bvalues))
286286

287287
# Calculate bias
288288
f_bias = np.mean(f_estimates) - f

tests/IVIMmodels/unit_tests/test_ivim_fit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def to_list_if_needed(value):
6363
"atol": tolerances["atol"]
6464
}
6565
record_property('test_data', test_result)
66-
if (data['f'] == 1 or data['f'] == 0) and not fit.use_bounds: #in these cases there are multiple solutions (D can become D*, f will be 0 and D* can be anything. This will be a good description of the data, so technically not a fail
66+
if (data['f'] > 0.99 or data['f'] < 0.01) and not fit.use_bounds: #in these cases there are multiple solutions (D can become D*, f will be 0 and D* can be anything. This will be a good description of the data, so technically not a fail
6767
return
6868
npt.assert_allclose(fit_result['f'],data['f'], rtol=tolerances["rtol"]["f"], atol=tolerances["atol"]["f"])
6969
if data['f']<0.80: # we need some signal for D to be detected

0 commit comments

Comments
 (0)