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]])

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)