def test_prepare_fcma_data():
images = io.load_images_from_dir(data_dir, suffix=suffix)
mask = io.load_boolean_mask(mask_file)
conditions = io.load_labels(epoch_file)
raw_data, _, labels = prepare_fcma_data(images, conditions, mask)
expected_raw_data = np.load(expected_dir / 'expected_raw_data.npy')
assert len(raw_data) == len(expected_raw_data), \
'numbers of epochs do not match in test_prepare_fcma_data'
for idx in range(len(raw_data)):
assert np.allclose(raw_data[idx], expected_raw_data[idx]), \
'raw data do not match in test_prepare_fcma_data'
assert np.array_equal(labels, expected_labels), \
'the labels do not match in test_prepare_fcma_data'
from brainiak.fcma.preprocessing import RandomType
images = io.load_images_from_dir(data_dir, suffix=suffix)
random_raw_data, _, _ = prepare_fcma_data(images, conditions, mask,
random=RandomType.REPRODUCIBLE)
assert len(random_raw_data) == len(expected_raw_data), \
'numbers of epochs do not match in test_prepare_fcma_data'
images = io.load_images_from_dir(data_dir, suffix=suffix)
random_raw_data, _, _ = prepare_fcma_data(images, conditions, mask,
random=RandomType.UNREPRODUCIBLE)
assert len(random_raw_data) == len(expected_raw_data), \
'numbers of epochs do not match in test_prepare_fcma_data'
评论列表
文章目录