Skip to content

Commit

Permalink
swap xi
Browse files Browse the repository at this point in the history
  • Loading branch information
j-bac committed Mar 30, 2024
1 parent 8686e9c commit e1aa47a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions stream2/tools/_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,25 @@ def xicorr(x, y, n):


@nb.njit(parallel=True)
def xicorr_ps(X, y):
def xicorr_ps(x, Y):
"""Fast xi correlation coefficient
X: 2d np.array
y: 0d np.array
x: 0d np.array
Y: 2d np.array
"""
n = len(X)
corrs = np.zeros(X.shape[1])
pvals = np.zeros(X.shape[1])
for i in nb.prange(X.shape[1]):
corrs[i], pvals[i] = xicorr(X[:, i], y, n)
n = len(Y)
corrs = np.zeros(Y.shape[1])
pvals = np.zeros(Y.shape[1])
for i in nb.prange(Y.shape[1]):
corrs[i], pvals[i] = xicorr(x,Y[:, i], n)
return corrs, pvals


def spearman_ps(y, X):
def spearman_ps(x, Y):
"""Fast spearman correlation coefficient
X: 2d np.array
y: 0d np.array
"""
return pearson_corr(rankdata(y[None]), rankdata(X.T))
return pearson_corr(rankdata(x[None]), rankdata(Y.T))


def pearson_corr(arr1, arr2):
Expand Down

0 comments on commit e1aa47a

Please sign in to comment.