Generating data

def generate_data(shp=[16, 20, 24]):
    """ Generating data """

    x = np.ones(shp)
    # inserting box
    x[4:-4, 6:-2, 1:-6] = -1
    x_noisy = x + np.random.normal(0, 0.6, size=x.shape)
    return x_noisy