How to use the tigramite.data_processing._get_covariance_matrix function in tigramite

To help you get started, we’ve selected a few tigramite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jakobrunge / tigramite / tests / test_var_process.py View on Github external
# Unpack the parameter set fixture
    good_params, bad_params, message = bad_parameter_sets
    error_message = message + " should trigger a value error for var_process "+\
                              "parent-neighbour dictionary"
    # Test the good parameter set
    try:
        pp._check_parent_neighbor(good_params)
        covar = pp._get_covariance_matrix(good_params)
        pp._check_symmetric_relations(covar)
    # Ensure no exception is raised
    except:
        pytest.fail("Good parameter set triggers exception incorrectly!")
    # Ensure an exception is raised for a bad parameter set
    with pytest.raises(ValueError):
        pp._check_parent_neighbor(bad_params)
        covar = pp._get_covariance_matrix(bad_params)
        pp._check_symmetric_relations(covar)
        pytest.fail(error_message)
github jakobrunge / tigramite / tests / test_var_process.py View on Github external
def test_bad_parameters(bad_parameter_sets):
    """
    Test that the correct exceptions are raised for bad input connectivity
    dictionaries
    """
    # Unpack the parameter set fixture
    good_params, bad_params, message = bad_parameter_sets
    error_message = message + " should trigger a value error for var_process "+\
                              "parent-neighbour dictionary"
    # Test the good parameter set
    try:
        pp._check_parent_neighbor(good_params)
        covar = pp._get_covariance_matrix(good_params)
        pp._check_symmetric_relations(covar)
    # Ensure no exception is raised
    except:
        pytest.fail("Good parameter set triggers exception incorrectly!")
    # Ensure an exception is raised for a bad parameter set
    with pytest.raises(ValueError):
        pp._check_parent_neighbor(bad_params)
        covar = pp._get_covariance_matrix(bad_params)
        pp._check_symmetric_relations(covar)
        pytest.fail(error_message)
github jakobrunge / tigramite / tests / test_var_process.py View on Github external
def covariance_parameters(request):
    """
    Define a good parameter set with no time delays at all to induce
    a noise-only sample and return the resulting covariance matrix
    """
    default_coef = 0.1
    good_params = {}
    good_params[0] = [((1, 0), default_coef * 1.),
                      ((2, 0), default_coef * 3.)]
    good_params[1] = [((2, 0), default_coef * 2.),
                      ((0, 0), default_coef * 1.)]
    good_params[2] = [((0, 0), default_coef * 3.),
                      ((1, 0), default_coef * 2.)]
    good_params[3] = [((3, 0), default_coef * 4.)]
    # Get the innovation matrix
    covar_matrix = pp._get_covariance_matrix(good_params)
    return good_params, covar_matrix