def test_shift_heatmap():
    """Test the routine which shift the heatmap."""

    # Load the data with only a single serie
    currdir = os.path.dirname(os.path.abspath(__file__))
    path_data = os.path.join(currdir, 'data', 'dce')
    # Create an object to handle the data
    dce_mod = DCEModality()

    # Read the data
    dce_mod.read_data_from_path(path_data)

    # Load the GT data
    path_gt = [os.path.join(currdir, 'data', 'gt_folders', 'prostate')]
    label_gt = ['prostate']
    gt_mod = GTModality()
    gt_mod.read_data_from_path(label_gt, path_gt)

    # Build a heatmap from the dce data
    # Reduce the number of bins to enforce low memory consumption
    nb_bins = [100] * dce_mod.n_serie_
    heatmap, bins_heatmap = dce_mod.build_heatmap(gt_mod.extract_gt_data(
        label_gt[0]), nb_bins=nb_bins)

    # Create a list of shift which do not have the same number of entries
    # than the heatmap - There is 4 series, let's create only 2
    shift_arr = np.array([10] * 4)

    heatmap_shifted = StandardTimeNormalization._shift_heatmap(heatmap,
                                                               shift_arr)

    data = np.load(os.path.join(currdir, 'data', 'heatmap_shifted.npy'))
    assert_array_equal(heatmap_shifted, data)