def corrcoef(time, crossf, integration_window=<NUM_LIT:0.>):
N = len(crossf)<EOL>cc = np.zeros(np.shape(crossf)[:-<NUM_LIT:1>])<EOL>tbin = abs(time[<NUM_LIT:1>] - time[<NUM_LIT:0>])<EOL>lim = int(integration_window / tbin)<EOL>if len(time)%<NUM_LIT:2> == <NUM_LIT:0>:<EOL><INDENT>mid = len(time)/<NUM_LIT:2>-<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>mid = np.floor(len(time)/<NUM_LIT>)<EOL><DEDENT>for i in range(N):<EOL><INDENT>ai = np.sum(crossf[i, i][mid - lim:mid + lim + <NUM_LIT:1>])<EOL>offset_autoi = np.mean(crossf[i,i][:mid-<NUM_LIT:1>])<EOL>for j in range(N):<EOL><INDENT>cij = np.sum(crossf[i, j][mid - lim:mid + lim + <NUM_LIT:1>])<EOL>offset_cross = np.mean(crossf[i,j][:mid-<NUM_LIT:1>])<EOL>aj = np.sum(crossf[j, j][mid - lim:mid + lim + <NUM_LIT:1>])<EOL>offset_autoj = np.mean(crossf[j,j][:mid-<NUM_LIT:1>])<EOL>if ai > <NUM_LIT:0.> and aj > <NUM_LIT:0.>:<EOL><INDENT>cc[i, j] = (cij-offset_cross) / np.sqrt((ai-offset_autoi) *(aj-offset_autoj))<EOL><DEDENT>else:<EOL><INDENT>cc[i, j] = <NUM_LIT:0.><EOL><DEDENT><DEDENT><DEDENT>return cc<EOL>
Calculate the correlation coefficient for given auto- and crosscorrelation
functions. Standard settings yield the zero lag correlation coefficient.
Setting integration_window > 0 yields the correlation coefficient of
integrated auto- and crosscorrelation functions. The correlation coefficient
between a zero signal with any other signal is defined as 0.


Parameters
----------
time : numpy.ndarray
    1 dim array of times corresponding to signal.
crossf : numpy.ndarray 
    Crosscorrelation functions, 1st axis first unit, 2nd axis second unit,
    3rd axis times.
integration_window: float
    Size of the integration window.


Returns
-------
cc : numpy.ndarray
    2 dim array of correlation coefficient between two units.