Exemple #1
0
def test_BaseModel():

    BM = BaseModel(data_path + 'small_dwi.nii.gz', data_path + 'dwi.bvecs',
                   data_path + 'dwi.bvals')

    npt.assert_equal(BM.r_squared, np.ones(BM.signal.shape[:3]))
    npt.assert_equal(BM.R_squared, np.ones(BM.signal.shape[:3]))
    npt.assert_equal(BM.coeff_of_determination, np.ones(BM.signal.shape[:3]))
    npt.assert_equal(BM.RMSE, np.zeros(BM.signal.shape[:3]))

    # Test without numexpr: XXX Doesn't seem to do that for now
    has_numexpr = ozm.has_numexpr
    if has_numexpr:
        ozm.has_numexpr = False
        BM_wo_numexpr = BaseModel(data_path + 'small_dwi.nii.gz',
                                  data_path + 'dwi.bvecs',
                                  data_path + 'dwi.bvals')

        npt.assert_equal(BM.r_squared, np.ones(BM.signal.shape[:3]))
        npt.assert_equal(BM.R_squared, np.ones(BM.signal.shape[:3]))
        npt.assert_equal(BM.coeff_of_determination,
                         np.ones(BM.signal.shape[:3]))
        npt.assert_equal(BM.RMSE, np.zeros(BM.signal.shape[:3]))

        # Set it back:
        ozm.has_numexpr = True