Brian2, neuron group inside a class are not considered in the network, why ?

171 views
Skip to first unread message

Stanislas Cottard

unread,
Dec 17, 2015, 6:41:50 AM12/17/15
to Brian
Hi,

I'm doing a population class with several neuron group and synapses as attribute.

I create three population and try to connect them but when I run I have this message :

WARNING  brian2.core.magic.dependency_warning: "synapses_12" has been included in the network but not the object on which it depends.Setting "synapses_12" to inactive.
WARNING  brian2.core.magic.dependency_warning: "synapses_13" has been included in the network but not the object on which it depends.Setting "synapses_13" to inactive.
WARNING  brian2.core.magic.dependency_warning: "synapses_14" has been included in the network but not the object on which it depends.Setting "synapses_14" to inactive.
WARNING  brian2.core.magic.dependency_warning: "synapses_15" has been included in the network but not the object on which it depends.Setting "synapses_15" to inactive.
WARNING  brian2.core.magic.dependency_warning: "synapses_16" has been included in the network but not the object on which it depends.Setting "synapses_16" to inactive.
WARNING  brian2.core.magic.dependency_warning: "synapses_17" has been included in the network but not the object on which it depends.Setting "synapses_17" to inactive.
WARNING  brian2.core.magic.dependency_warning: "synapses_18" has been included in the network but not the object on which it depends.Setting "synapses_18" to inactive.
WARNING  brian2.core.magic.dependency_warning: "synapses_19" has been included in the network but not the object on which it depends.Setting "synapses_19" to inactive.

It seems that the neuron groups I create as attribute in a class are not considered in the network.

Thanks for your help

Dan Goodman

unread,
Dec 17, 2015, 6:52:49 AM12/17/15
to brians...@googlegroups.com
Hi,

That's right: we only include objects that are visible from the
namespace where you call run(), so attributes are not directly visible
and won't be included. In cases like this, we recommend that you
directly create your own Network object rather than using the magic network.

There is maybe a case for an BrianObjectContainer mixin class that would
enable this, but I think we discussed it and decided against in the end.

Dan
> --
> http://www.facebook.com/briansimulator
> https://twitter.com/briansimulator
>
> New paper about Brian 2: Stimberg M, Goodman DFM, Benichoux V, Brette R
> (2014).Equation-oriented specification of neural models for simulations.
> Frontiers Neuroinf, doi: 10.3389/fninf.2014.00006.
> ---
> You received this message because you are subscribed to the Google
> Groups "Brian" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to briansupport...@googlegroups.com
> <mailto:briansupport...@googlegroups.com>.
> To post to this group, send email to brians...@googlegroups.com
> <mailto:brians...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/briansupport.
> For more options, visit https://groups.google.com/d/optout.

Stanislas Cottard

unread,
Dec 17, 2015, 6:56:07 AM12/17/15
to Brian
Ok, thank you very much for being so fast to answer. I will try creating my own Network object.

Marcel Stimberg

unread,
Dec 17, 2015, 7:25:07 AM12/17/15
to brians...@googlegroups.com
Hi Stanislas,

alternatively, your class could derive from BrianObject and you'd add all the objects to the "contained_objects" attribute: https://brian2.readthedocs.org/en/2.0b4/reference/brian2.core.base.BrianObject.html#brian2.core.base.BrianObject.contained_objects

Best,
  Marcel
To unsubscribe from this group and stop receiving emails from it, send an email to briansupport...@googlegroups.com.
To post to this group, send email to brians...@googlegroups.com.

Dan Goodman

unread,
Dec 17, 2015, 7:26:53 AM12/17/15
to brians...@googlegroups.com
There are some subtleties to this though, not sure if this would be less
effort in the end?
>> <http://www.facebook.com/briansimulator>
>> > https://twitter.com/briansimulator
>> <https://twitter.com/briansimulator>
>> >
>> > New paper about Brian 2: Stimberg M, Goodman DFM, Benichoux V,
>> Brette R
>> > (2014).Equation-oriented specification of neural models for
>> simulations.
>> > Frontiers Neuroinf, doi: 10.3389/fninf.2014.00006.
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups "Brian" group.
>> > To unsubscribe from this group and stop receiving emails from
>> it, send
>> > an email to briansupport...@googlegroups.com <javascript:>
>> > <mailto:briansupport...@googlegroups.com <javascript:>>.
>> > To post to this group, send email to
>> <javascript:>brians...@googlegroups.com
>> > <mailto:brians...@googlegroups.com <javascript:>>.
>> <https://groups.google.com/group/briansupport>.
>> > For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>>
>> --
>> http://www.facebook.com/briansimulator
>> https://twitter.com/briansimulator
>>
>> New paper about Brian 2: Stimberg M, Goodman DFM, Benichoux V, Brette
>> R (2014).Equation-oriented specification of neural models for
>> simulations. Frontiers Neuroinf, doi: 10.3389/fninf.2014.00006.
>> ---
>> You received this message because you are subscribed to the Google
>> Groups "Brian" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to briansupport...@googlegroups.com
>> <mailto:briansupport...@googlegroups.com>.
>> To post to this group, send email to brians...@googlegroups.com
>> <mailto:brians...@googlegroups.com>.
>> Visit this group at https://groups.google.com/group/briansupport.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> http://www.facebook.com/briansimulator
> https://twitter.com/briansimulator
>
> New paper about Brian 2: Stimberg M, Goodman DFM, Benichoux V, Brette R
> (2014).Equation-oriented specification of neural models for simulations.
> Frontiers Neuroinf, doi: 10.3389/fninf.2014.00006.
> ---
> You received this message because you are subscribed to the Google
> Groups "Brian" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to briansupport...@googlegroups.com
> <mailto:briansupport...@googlegroups.com>.

Marcel Stimberg

unread,
Dec 17, 2015, 7:31:50 AM12/17/15
to brians...@googlegroups.com
What kind of subtleties do you have in mind (apart from not overwriting
but extending/appending to the attribute)? We use this mechanism
internally a lot, so it should be fine I think.

Marcel

Dan Goodman

unread,
Dec 17, 2015, 7:36:30 AM12/17/15
to brians...@googlegroups.com
Things like naming, making sure to set the class attributes correctly
(e.g. important to set add_to_magic_network=True). Maybe others?

Dan

Marcel Stimberg

unread,
Dec 17, 2015, 7:42:59 AM12/17/15
to brians...@googlegroups.com
Ah, the "add_to_magic_network" is an important one, indeed (I don't
quite remember why we did not make True the default, though...). We have
a few examples like this in our tutorial from CNS (without the contained
objects part):
https://github.com/brian-team/brian-material/tree/master/2015-CNS-tutorial/04-advanced-brian2
I don't really see any problem with naming things, though. Either way,
just constructing a network manually might be easier, as you said.

Marcel
Reply all
Reply to author
Forward
0 new messages