Exemple #1
0
def inter_train_correlation(train, arr):

    tmp = np.zeros([arr.shape[0], arr.shape[1], arr.shape[-1]])

    for t2 in range(arr.shape[-1]):

        a = norm_difference(arr[:, :, :, train], arr[:, :, :, t2], plot=False)
        tmp[:, :, t2] = a.mean(axis=-1)

    return tmp
Exemple #2
0
def intra_train_correlation(train, arr, method=norm_difference):

    tmp = np.zeros([arr.shape[0], arr.shape[1], arr.shape[-2], arr.shape[-2]])

    for p1 in range(arr.shape[-2]):
        for p2 in range(arr.shape[-2]):

            tmp[:, :, p1, p2] = norm_difference(arr[:, :, p1, train],
                                                arr[:, :, p2, train],
                                                plot=False)

    return tmp.mean(axis=-1).mean(axis=-1)
Exemple #3
0
def positional_pulse_correlation(position, arr):

    tmp = np.zeros([arr.shape[0], arr.shape[1], arr.shape[-1], arr.shape[-1]])

    for t1 in range(arr.shape[-1]):

        for t2 in range(arr.shape[-1]):

            tmp[:, :, t1, t2] = norm_difference(arr[:, :, position, t1],
                                                arr[:, :, position, t2],
                                                plot=False)

    return tmp.mean(axis=-1)
Exemple #4
0
def sequential_pulse_correlation(position, arr):

    tmp = np.zeros([arr.shape[0], arr.shape[1], arr.shape[2], arr.shape[-1]])

    for t in range(arr.shape[-1]):

        for p in range(arr.shape[-2]):
            tmp[:, :, p, t] = norm_difference(arr[:, :, position, t],
                                              arr[:, :, p, t],
                                              plot=False)

    tmp = tmp.mean(axis=-1)

    return tmp
Exemple #5
0
def correlation(arr1, arr2):
    corr = 1 - norm_difference(arr1, arr2, plot=False).mean()
    return corr