# Path: scot/connectivity.py
# def connectivity(measure_names, b, c=None, nfft=512):
#     """Calculate connectivity measures.
# 
#     Parameters
#     ----------
#     measure_names : str or list of str
#         Name(s) of the connectivity measure(s) to calculate. See
#         :class:`Connectivity` for supported measures.
#     b : array, shape (n_channels, n_channels * model_order)
#         VAR model coefficients. See :ref:`var-model-coefficients` for details
#         about the arrangement of coefficients.
#     c : array, shape (n_channels, n_channels), optional
#         Covariance matrix of the driving noise process. Identity matrix is used
#         if set to None (default).
#     nfft : int, optional
#         Number of frequency bins to calculate. Note that these points cover the
#         range between 0 and half the sampling rate.
# 
#     Returns
#     -------
#     result : array, shape (n_channels, n_channels, `nfft`)
#         An array of shape (m, m, nfft) is returned if measures is a string. If
#         measures is a list of strings, a dictionary is returned, where each key
#         is the name of the measure, and the corresponding values are arrays of
#         shape (m, m, nfft).
# 
#     Notes
#     -----
#     When using this function, it is more efficient to get several measures at
#     once than calling the function multiple times.
# 
#     Examples
#     --------
#     >>> c = connectivity(['DTF', 'PDC'], [[0.3, 0.6], [0.0, 0.9]])
#     """
#     con = Connectivity(b, c, nfft)
#     try:
#         return getattr(con, measure_names)()
#     except TypeError:
#         return dict((m, getattr(con, m)()) for m in measure_names)


import unittest
import numpy as np
from scot import connectivity
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
# Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2013-2015 SCoT Development Team






def assert_zerostructure(a, b):
    assert_array_equal(np.isclose(a, 0), np.isclose(b, 0))


class TestFunctionality(unittest.TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def testFunction(self):
        # Three sources: a <- b <- c
        # simply test if connectivity measures are 0 where expected
        b0 = np.array([[0, 0.9, 0], [0, 0, 0.9], [0, 0, 0]])
        identity = np.eye(3)
        nfft = 5
        measures = ['A', 'H', 'COH', 'DTF', 'PDC']

# Path: scot/connectivity.py
# def connectivity(measure_names, b, c=None, nfft=512):
#     """Calculate connectivity measures.
# 
#     Parameters
#     ----------
#     measure_names : str or list of str
#         Name(s) of the connectivity measure(s) to calculate. See
#         :class:`Connectivity` for supported measures.
#     b : array, shape (n_channels, n_channels * model_order)
#         VAR model coefficients. See :ref:`var-model-coefficients` for details
#         about the arrangement of coefficients.
#     c : array, shape (n_channels, n_channels), optional
#         Covariance matrix of the driving noise process. Identity matrix is used
#         if set to None (default).
#     nfft : int, optional
#         Number of frequency bins to calculate. Note that these points cover the
#         range between 0 and half the sampling rate.
# 
#     Returns
#     -------
#     result : array, shape (n_channels, n_channels, `nfft`)
#         An array of shape (m, m, nfft) is returned if measures is a string. If
#         measures is a list of strings, a dictionary is returned, where each key
#         is the name of the measure, and the corresponding values are arrays of
#         shape (m, m, nfft).
# 
#     Notes
#     -----
#     When using this function, it is more efficient to get several measures at
#     once than calling the function multiple times.
# 
#     Examples
#     --------
#     >>> c = connectivity(['DTF', 'PDC'], [[0.3, 0.6], [0.0, 0.9]])
#     """
#     con = Connectivity(b, c, nfft)
#     try:
#         return getattr(con, measure_names)()
#     except TypeError:
#         return dict((m, getattr(con, m)()) for m in measure_names)


# Path: scot/tests/test_connectivity.py
import unittest
import numpy as np
from scot import connectivity
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal

# Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2013-2015 SCoT Development Team






def assert_zerostructure(a, b):
    assert_array_equal(np.isclose(a, 0), np.isclose(b, 0))


class TestFunctionality(unittest.TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def testFunction(self):
        # Three sources: a <- b <- c
        # simply test if connectivity measures are 0 where expected
        b0 = np.array([[0, 0.9, 0], [0, 0, 0.9], [0, 0, 0]])
        identity = np.eye(3)
        nfft = 5
        measures = ['A', 'H', 'COH', 'DTF', 'PDC']

        C = connectivity.Connectivity(b=b0, c=identity, nfft=nfft)