I am having trouble calculating the coherence (measured by the Kuramoto order parameter, R) for a network of N neurons. Currently I start with two arrays, a '1x# of data points' array that holds time of each data point and an 'Nx# of data points' array that holds the membrane potentials of the N neurons at each data point. I then calculate the spike times and periods of each neuron and store this data in 'Nx# of spikes' sized matrices (where row i (i=1 through N) holds the spike times for neuron i or the periods at each spike time for neuron i respectively). At this point I choose one neuron as the reference neuron, calculate the phase of each other neuron relative to the reference neuron's spikes and then use these phases to calculate the network's coherence (R) at each spike time of the reference neuron. This method of calculating R seems not very robust; at the start of the simulation when the neurons are not well synchronized they do not always spike the same number of times so it is difficult to choose which spike time of neuron i (i=1 through N-1 because reference neuron is not included) to compare to a given spike of the reference neuron.
I'd be really excited if anyone might be able to suggest a better way of calculating coherence in the form of Kuramoto's R from time & membrane potential data. I could post my current code if that would help illustrate things a bit.
Thanks so much!