Exemplo n.º 1
0
def test_no_required_bbp_edge_group_datasets():
    with copy_circuit() as (circuit_copy_path, config_copy_path):
        edges_file = circuit_copy_path / 'edges.h5'
        with h5py.File(edges_file, 'r+') as h5f:
            del h5f['edges/default/0/syn_weight']
        errors = test_module.validate(str(config_copy_path), True)
        assert errors == {BbpError(Error.WARNING, 'Group default/0 of {} misses fields: {}'.
                                   format(edges_file, ['syn_weight']))}
Exemplo n.º 2
0
def test_edge_population_multiple_groups():
    with copy_circuit() as (circuit_copy_path, config_copy_path):
        edges_file = circuit_copy_path / 'edges.h5'
        with h5py.File(edges_file, 'r+') as h5f:
            h5f.create_group('edges/default/1')
        errors = test_module.validate(str(config_copy_path), bbp_check=True)
        assert BbpError(Error.WARNING, 'Population default of {} have multiple groups. '
                                       'Cannot be read via bluepysnap or libsonata'.
                        format(edges_file)) in errors
Exemplo n.º 3
0
def test_no_bio_component_dirs():
    dirs = ['morphologies_dir', 'biophysical_neuron_models_dir']
    for dir_ in dirs:
        with copy_circuit() as (_, config_copy_path):
            with edit_config(config_copy_path) as config:
                del config['components'][dir_]
            errors = test_module.validate(str(config_copy_path), True)
            # multiplication by 2 because we have 2 populations, each produces the same error.
            assert errors == {BbpError(Error.FATAL,
                                       'Invalid components "{}": {}'.format(dir_, None))}
Exemplo n.º 4
0
def test_no_required_bbp_edge_group_datasets():
    with copy_circuit() as (circuit_copy_path, config_copy_path):
        edges_file = circuit_copy_path / "edges.h5"
        with h5py.File(edges_file, "r+") as h5f:
            del h5f["edges/default/0/syn_weight"]
        errors = test_module.validate(str(config_copy_path), True)
        assert errors == {
            BbpError(
                Error.WARNING,
                "Group default/0 of {} misses fields: {}".format(edges_file, ["syn_weight"]),
            )
        }
Exemplo n.º 5
0
def test_invalid_bio_alternate_morphology_dir():
    with copy_circuit() as (circuit_copy_path, config_copy_path):
        component = "neurolucida-asc"
        fake_path = str(circuit_copy_path / "fake/path")
        with edit_config(config_copy_path) as config:
            config["networks"]["nodes"][0]["populations"]["default"]["alternate_morphologies"] = {
                component: fake_path
            }
        errors = test_module.validate(str(config_copy_path), True)
        assert errors == {
            BbpError(Error.FATAL, 'Invalid components "{}": {}'.format(component, fake_path))
        }
Exemplo n.º 6
0
def test_edge_population_multiple_groups():
    with copy_circuit() as (circuit_copy_path, config_copy_path):
        edges_file = circuit_copy_path / "edges.h5"
        with h5py.File(edges_file, "r+") as h5f:
            h5f.create_group("edges/default/1")
        errors = test_module.validate(str(config_copy_path), bbp_check=True)
        assert (
            BbpError(
                Error.WARNING,
                "Population default of {} have multiple groups. "
                "Cannot be read via bluepysnap or libsonata".format(edges_file),
            )
            in errors
        )
Exemplo n.º 7
0
def test_no_rotation_bbp_node_group_datasets():
    angle_datasets = ['rotation_angle_xaxis', 'rotation_angle_yaxis', 'rotation_angle_zaxis']
    with copy_circuit() as (circuit_copy_path, config_copy_path):
        nodes_file = circuit_copy_path / 'nodes.h5'
        with h5py.File(nodes_file, 'r+') as h5f:
            for ds in angle_datasets:
                shape = h5f['nodes/default/0/' + ds].shape
                del h5f['nodes/default/0/' + ds]
            h5f['nodes/default/0/'].create_dataset('orientation_w', shape, fillvalue=0)
        errors = test_module.validate(str(config_copy_path), bbp_check=True)
        assert errors == {
            Error(Error.WARNING, 'Group default/0 of {} has no rotation fields'.format(nodes_file)),
            BbpError(Error.WARNING,
                     'Group default/0 of {} has no rotation fields'.format(nodes_file))
        }
Exemplo n.º 8
0
def test_no_rotation_bbp_node_group_datasets():
    angle_datasets = ["rotation_angle_xaxis", "rotation_angle_yaxis", "rotation_angle_zaxis"]
    with copy_circuit() as (circuit_copy_path, config_copy_path):
        nodes_file = circuit_copy_path / "nodes.h5"
        with h5py.File(nodes_file, "r+") as h5f:
            for ds in angle_datasets:
                shape = h5f["nodes/default/0/" + ds].shape
                del h5f["nodes/default/0/" + ds]
            h5f["nodes/default/0/"].create_dataset("orientation_w", shape, fillvalue=0)
        errors = test_module.validate(str(config_copy_path), bbp_check=True)
        assert errors == {
            Error(Error.WARNING, "Group default/0 of {} has no rotation fields".format(nodes_file)),
            BbpError(
                Error.WARNING, "Group default/0 of {} has no rotation fields".format(nodes_file)
            ),
        }