
import numpy as np


def _check_stc(stc1, stc2):
    # XXX What should we check? that the data is having the same size?
    if stc1.data.shape != stc2.data.shape:
        raise ValueError('data in stcs must have the same size')


def source_estimate_quantification(stc1, stc2, metric='rms'):

    _check_stc(stc1, stc2)

    if metric == 'rms':
        return np.sum((stc1.data - stc2.data) ** 2)

@@ -183,17 +183,17 @@
 eError('
-d
+D
 ata in s
@@ -226,100 +226,763 @@
 e')%0A
-%0A%0Adef source_estimate_quantification(stc1, stc2, metric='rms'):%0A%0A    _check_stc(stc1, stc2)%0A
+    if stc1.times != stc2.times:%0A        raise ValueError('Times of two stcs must match.')%0A%0A%0A%0Adef source_estimate_quantification(stc1, stc2, metric='rms'):%0A    %22%22%22Helper function to calculate matrix similarities.%0A%0A    Parameters%0A    ----------%0A    stc1 : SourceEstimate%0A        First source estimate for comparison%0A    stc2 : SourceEstimate%0A        First source estimate for comparison%0A    metric : str%0A        Metric to calculate. 'rms', 'avg_corrcoef',%0A%0A    Returns%0A    -------%0A%0A    %22%22%22%0A%0A    # TODO Add checks for source space%0A    _check_stc(stc1, stc2)%0A%0A    score = _calc_metric(stc1.data, stc2.data, metric)%0A%0Adef _calc_metric(data1, data2, metric):%0A    %22%22%22Calculate metric of choice%22%22%22%0A%0A    # Calculate root mean square difference between two matrices
 %0A   
@@ -1024,11 +1024,12 @@
  np.
-sum
+mean
 ((st
@@ -1055,8 +1055,167 @@
 ) ** 2)%0A
+%0A    # Calculate correlation coefficient between matrix elements%0A    elif metric == 'avg_corrcoef':%0A        return np.mean(np.corrcoeff(stc1.data, stc2.data))%0A

Add corrcoeff, checks