Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCHcoeff #111

Merged
merged 5 commits into from
Jul 28, 2017
Merged

CCHcoeff #111

merged 5 commits into from
Jul 28, 2017

Conversation

mvonpapen
Copy link
Contributor

added option in elephant.spike_train_correlation.cch named cross_corr_coeff that allows to normalize the CCH output to obtain a cross-correlation coefficient function according to Eggermont (2010) Pair-correlation in the time and frequency domain, Ch.5 in: Analysis of parallel spike trains, eds: S. Gruen, S. Rotter, Equation (5.10).

added a unit test in test_cross_correlation_histogram of test_spike_train_correlation.py that compares the output of CChcoef to the one of elephant.spike_train_correlation.corrcoeff for several displacements tau.

Joint work with @rgutzen

def _cross_corr_coef(cch_result, binned_st1, binned_st2):
# Normalizes the CCH to obtain the cross-correlation
# coefficient function ranging from -1 to 1
N = max(binned_st1.num_bins, binned_st2.num_bins)
Nx = len(binned_st1.spike_indices[0])
Ny = len(binned_st2.spike_indices[0])
spmat = [binned_st1.to_sparse_array(), binned_st2.to_sparse_array()]
bin_counts_unique = []
for s in spmat:
bin_counts_unique.append(s.data)
ii = np.dot(bin_counts_unique[0], bin_counts_unique[0])
jj = np.dot(bin_counts_unique[1], bin_counts_unique[1])
rho_xy = (cch_result - NxNy/N) / np.sqrt( (ii-Nx**2./N)(jj-Ny**2./N) )
return rho_xy

@coveralls
Copy link
Collaborator

coveralls commented Jul 20, 2017

Coverage Status

Coverage increased (+0.03%) to 90.922% when pulling 376dbf9 on INM-6:CCHcoeff into 9316970 on NeuralEnsemble:master.

@alperyeg
Copy link
Contributor

Looks good to me. Please add your names to the authors.rst for the kudos :)

@mvonpapen
Copy link
Contributor Author

ready, woohoo!

@mvonpapen mvonpapen closed this Jul 27, 2017
@coveralls
Copy link
Collaborator

coveralls commented Jul 27, 2017

Coverage Status

Coverage increased (+0.03%) to 90.922% when pulling e37c994 on INM-6:CCHcoeff into 9316970 on NeuralEnsemble:master.

@mvonpapen mvonpapen reopened this Jul 27, 2017
@coveralls
Copy link
Collaborator

coveralls commented Jul 27, 2017

Coverage Status

Coverage increased (+0.03%) to 90.922% when pulling e37c994 on INM-6:CCHcoeff into 9316970 on NeuralEnsemble:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants