File tree Expand file tree Collapse file tree
tests/IVIMmodels/unit_tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,12 +126,13 @@ def test_bounds(bound_input, eng):
126126 if fit .use_bounds ["f" ] or fit .use_bounds ["D" ] or fit .use_bounds ["Dp" ]:
127127 signal = signal_helper (data ["data" ])
128128 fit_result = fit .osipi_fit (signal , bvals )
129+ eps = 1e-10 # without this margin it can cause floating point failures on mac systems
129130 if fit .use_bounds ["D" ]:
130- assert bounds ["D" ][0 ] <= fit_result ['D' ] <= bounds ["D" ][1 ], f"Result { fit_result ['D' ]} out of bounds for data: { name } "
131+ assert bounds ["D" ][0 ]- eps <= fit_result ['D' ] <= bounds ["D" ][1 ]+ eps , f"Result { fit_result ['D' ]} out of bounds for data: { name } "
131132 if fit .use_bounds ["f" ]:
132- assert bounds ["f" ][0 ] <= fit_result ['f' ] <= bounds ["f" ][1 ], f"Result { fit_result ['f' ]} out of bounds for data: { name } "
133+ assert bounds ["f" ][0 ]- eps <= fit_result ['f' ] <= bounds ["f" ][1 ]+ eps , f"Result { fit_result ['f' ]} out of bounds for data: { name } "
133134 if fit .use_bounds ["Dp" ]:
134- assert bounds ["Dp" ][0 ] <= fit_result ['Dp' ] <= bounds ["Dp" ][1 ], f"Result { fit_result ['Dp' ]} out of bounds for data: { name } "
135+ assert bounds ["Dp" ][0 ]- eps <= fit_result ['Dp' ] <= bounds ["Dp" ][1 ]+ eps , f"Result { fit_result ['Dp' ]} out of bounds for data: { name } "
135136 # S0 is not returned as argument...
136137 #assert bounds[0][3] <= fit_result['S0'] <= bounds[1][3], f"Result {fit_result['S0']} out of bounds for data: {name}"
137138 '''if fit.use_initial_guess:
You can’t perform that action at this time.
0 commit comments