~tfardet/nngt-developers

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH NNGT v1] Version 2.4.0 - Core - Make default NeuralGroup excitatory and fix Structure.create_neta_group

Details
Message ID
<LkixJkIrZROjkLhRR53wkGKfjpjfGv4SnYeXxlRc@cp4-web-036.plabs.ch>
DKIM signature
pass
Download raw message
Patch: +25 -11
---
 nngt/__init__.py              |  2 +-
 nngt/core/graph.py            |  3 ---
 nngt/core/group_structure.py  |  4 ++--
 nngt/core/neural_pop_group.py |  4 ++--
 nngt/generation/connectors.py |  2 ++
 testing/base_test.py          |  1 -
 testing/test_group_pop.py     |  7 +++++++
 testing/test_nest.py          | 13 +++++++++++--
 8 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/nngt/__init__.py b/nngt/__init__.py
index 3252b42..ede5108 100644
--- a/nngt/__init__.py
+++ b/nngt/__init__.py
@@ -89,7 +89,7 @@ import logging as _logging
import numpy as _np


__version__ = '2.3.0'
__version__ = '2.4.0'


# ----------------------- #
diff --git a/nngt/core/graph.py b/nngt/core/graph.py
index e8e372f..d5010b4 100644
--- a/nngt/core/graph.py
+++ b/nngt/core/graph.py
@@ -1394,9 +1394,6 @@ class Graph(nngt.core.GraphObject):
        '''
        Return the type of all or a subset of the edges.

        .. versionchanged:: 1.0.1
            Added the possibility to ask for a subset of edges.

        Parameters
        ----------
        edges : (E, 2) array, optional (default: all edges)
diff --git a/nngt/core/group_structure.py b/nngt/core/group_structure.py
index e54a8ce..b8be9ae 100644
--- a/nngt/core/group_structure.py
+++ b/nngt/core/group_structure.py
@@ -402,9 +402,9 @@ class Structure(OrderedDict):
        replace : bool, optional (default: False)
            Whether to override previous exiting meta group with same name.
        '''
        neuron_param = {} if neuron_param is None else neuron_param.copy()
        properties = {} if properties is None else properties.copy()

        group = MetaGroup(nodes, name=name, neuron_param=neuron_param)
        group = MetaGroup(nodes, name=name, properties=properties)

        self.add_meta_group(group, replace=replace)

diff --git a/nngt/core/neural_pop_group.py b/nngt/core/neural_pop_group.py
index e01ca28..71d1e3a 100644
--- a/nngt/core/neural_pop_group.py
+++ b/nngt/core/neural_pop_group.py
@@ -826,7 +826,7 @@ class NeuralGroup(Group):

    def __new__(cls, *args, **kwargs):
        # check neuron type for MetaGroup
        neuron_type = None
        neuron_type = 1 if cls == NeuralGroup else None

        if "neuron_type" in kwargs:
            neuron_type = kwargs["neuron_type"]
@@ -1013,7 +1013,7 @@ class MetaNeuralGroup(MetaGroup, NeuralGroup):
        -------
        A new :class:`~nngt.MetaNeuralGroup` object.
        '''
        kwargs["neuron_type"] = kwargs.get("neuron_type",None)
        kwargs["neuron_type"] = kwargs.get("neuron_type", None)

        super().__init__(nodes=nodes, name=name, properties=properties,
                         **kwargs)
diff --git a/nngt/generation/connectors.py b/nngt/generation/connectors.py
index 08e7a4c..70234d4 100644
--- a/nngt/generation/connectors.py
+++ b/nngt/generation/connectors.py
@@ -127,6 +127,7 @@ def connect_nodes(network, sources, targets, graph_model, density=None,
            attr['weight'] = _generate_random(len(elist), ww)
        else:
            attr['weight'] = ww

    if 'delays' in kwargs:
        dd = kwargs['delays']

@@ -134,6 +135,7 @@ def connect_nodes(network, sources, targets, graph_model, density=None,
            attr['delay'] = _generate_random(len(elist), dd)
        else:
            attr['delay'] = dd

    if network.is_spatial() and distance:
        attr['distance'] = distance

diff --git a/testing/base_test.py b/testing/base_test.py
index f4d3421..098976a 100755
--- a/testing/base_test.py
+++ b/testing/base_test.py
@@ -39,7 +39,6 @@ import nngt
from tools_testing import _bool_from_string, _xml_to_dict, _list_from_string



# ------------------- #
# Path to input files #
# ------------------- #
diff --git a/testing/test_group_pop.py b/testing/test_group_pop.py
index ab6ddaa..c9fcb1b 100644
--- a/testing/test_group_pop.py
+++ b/testing/test_group_pop.py
@@ -33,6 +33,11 @@ def test_groups():
    g3 = nngt.NeuralGroup(ids, neuron_type=1, name="test")
    assert g1 != g3
    assert g3.name == "test"
    assert g3.neuron_type == 1

    g4 = nngt.NeuralGroup()

    assert g4.neuron_type == 1


def test_add_nodes():
@@ -147,6 +152,8 @@ def test_group_structure():
    with pytest.raises(AssertionError):
        g = nngt.Graph(100, structure=struct)

    struct.create_meta_group(range(20, 70), name="meta2")

    g = nngt.Graph(structure=struct)

    nngt.generation.connect_groups(g, g1, g1, "all_to_all")
diff --git a/testing/test_nest.py b/testing/test_nest.py
index f22dc23..1e265be 100644
--- a/testing/test_nest.py
+++ b/testing/test_nest.py
@@ -51,9 +51,18 @@ def test_net_creation():

    assert len(conn) == net.edge_nb()

    weights = {d['weight'] for d in nest.GetStatus(conn)}
    weights = np.array([d['weight'] for d in nest.GetStatus(conn)])

    assert weights == {-w, w}
    # check inhibitory connections
    etypes = net.get_edge_types()

    num_i = np.sum(etypes == -1)

    assert num_i == int(0.2*net.edge_nb())

    assert np.sum(weights == -w) == num_i

    assert set(weights) == {-w, w}


@pytest.mark.skipif(nngt.get_config('mpi'), reason="Don't test for MPI")
-- 
2.32.0

[NNGT/patches/.build.yml] build success

builds.sr.ht
Details
Message ID
<CC959CE5VQE5.27VX9I4F0QPLQ@cirno>
In-Reply-To
<LkixJkIrZROjkLhRR53wkGKfjpjfGv4SnYeXxlRc@cp4-web-036.plabs.ch> (view parent)
DKIM signature
missing
Download raw message
NNGT/patches/.build.yml: SUCCESS in 25m10s

[Version 2.4.0 - Core - Make default NeuralGroup excitatory and fix Structure.create_neta_group][0] from [tfardet][1]

[0]: https://lists.sr.ht/~tfardet/nngt-developers/patches/23415
[1]: tanguyfardet@protonmail.com

✓ #530004 SUCCESS NNGT/patches/.build.yml https://builds.sr.ht/~tfardet/job/530004
Reply to thread Export thread (mbox)