Dear Jasper,
In NEST 3, this should be possible.
Stine or Håkon, could you provide some advice?
Best, Hans Ekkehard
--
Prof. Dr. Hans Ekkehard Plesser Head, Department of Data Science
Faculty of Science and Technology Norwegian University of Life Sciences PO Box 5003, 1432 Aas, Norway
Phone +47 6723 1560 Email hans.ekkehard.plesser@nmbu.nomailto:hans.ekkehard.plesser@nmbu.no Home http://arken.nmbu.no/~plesser
On 06/04/2021, 12:05, "Albers, Jasper" <j.albers@fz-juelich.demailto:j.albers@fz-juelich.de> wrote:
Dear all,
a colleague of mine (in CC) and myself are implementing a spatially structured network in NEST (using current NEST master). We are wondering how to generate a population of neurons that are distributed on a regular grid plus a random jitter. This means that we want to end up with a spatial distribution as can be seen in Figure 8 in the tutorial for creating spatially structured networkshttps://nest-simulator.readthedocs.io/en/latest/tutorials/pynest_tutorial/part_4_spatially_structured_networks.html?highlight=jitter#defining-spatially-distributed-nodes. Below that figure one finds a code snippet; however, we believe that this does not correspond to the distribution of Figure 8. In the documentation of NEST 2.20.1 we did find a code snippet that produces a jittered grid:
import numpy as np
# grid with jitter
jit = 0.03
xs = np.arange(-0.5,.501,0.1)
poss = [[x,y] for y in xs for x in xs]
poss = [[p[0]+np.random.uniform(-jit,jit),p[1]+np.random.uniform(-jit,jit)] for p in poss]
layer_dict_ex = {"positions": poss,
"extent" : [1.1,1.1],
"elements" : "iaf_psc_alpha"}
As is apparent, this code does not make use of NEST internal random number generation but rather produces a list of positions that is then passed to a layer. Thus our question is: is it possible to create a jittered grid natively in NEST master?
Best regards, Jasper and Anno
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Volker Rieke Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Frauke Melchior ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------
Dear Jasper, dear Anno,
You are right, the figure does not correspond to the code snippet in the documentation. I actually don't think it is possible to create a regular grid with jitter with NEST 3, except for sending a positions vector as you are indicating. The following code should work, and create Figure 8 in the documentation, but we are of course trying to get away from lists of positions in NEST 3. I will create follow-up issues about this, both for the wrong code snippet and for the creation of grid with jitter.
import numpy as np import nest import matplotlib.pyplot as plt
xs = np.arange(-0.5,.501,0.1) poss = [[x,y] for y in xs for x in xs]
poss = [[p[0]+np.random.uniform(-0.03,0.03),p[1]+np.random.uniform(-0.03,0.03)] for p in poss] positions = nest.spatial.free(poss)
s_nodes = nest.Create('iaf_psc_alpha', positions=positions)
nest.PlotLayer(s_nodes) plt.show()
Best wishes, Stine ________________________________ Fra: Hans Ekkehard Plesser hans.ekkehard.plesser@nmbu.no Sendt: tirsdag 6. april 2021 16:28 Til: NEST User Mailing List users@nest-simulator.org Kopi: Kurth, Anno a.kurth@fz-juelich.de Emne: [NEST Users] Re: Spatial grid + jitter
Dear Jasper,
In NEST 3, this should be possible.
Stine or Håkon, could you provide some advice?
Best,
Hans Ekkehard
--
Prof. Dr. Hans Ekkehard Plesser
Head, Department of Data Science
Faculty of Science and Technology
Norwegian University of Life Sciences
PO Box 5003, 1432 Aas, Norway
Phone +47 6723 1560
Email hans.ekkehard.plesser@nmbu.nomailto:hans.ekkehard.plesser@nmbu.no
Home http://arken.nmbu.no/~plesser
On 06/04/2021, 12:05, "Albers, Jasper" <j.albers@fz-juelich.demailto:j.albers@fz-juelich.de> wrote:
Dear all,
a colleague of mine (in CC) and myself are implementing a spatially structured network in NEST (using current NEST master). We are wondering how to generate a population of neurons that are distributed on a regular grid plus a random jitter. This means that we want to end up with a spatial distribution as can be seen in Figure 8 in the tutorial for creating spatially structured networkshttps://nest-simulator.readthedocs.io/en/latest/tutorials/pynest_tutorial/part_4_spatially_structured_networks.html?highlight=jitter#defining-spatially-distributed-nodes. Below that figure one finds a code snippet; however, we believe that this does not correspond to the distribution of Figure 8.
In the documentation of NEST 2.20.1 we did find a code snippet that produces a jittered grid:
import numpy as np
# grid with jitter
jit = 0.03
xs = np.arange(-0.5,.501,0.1)
poss = [[x,y] for y in xs for x in xs]
poss = [[p[0]+np.random.uniform(-jit,jit),p[1]+np.random.uniform(-jit,jit)] for p in poss]
layer_dict_ex = {"positions": poss,
"extent" : [1.1,1.1],
"elements" : "iaf_psc_alpha"}
As is apparent, this code does not make use of NEST internal random number generation but rather produces a list of positions that is then passed to a layer.
Thus our question is: is it possible to create a jittered grid natively in NEST master?
Best regards,
Jasper and Anno
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Volker Rieke Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Frauke Melchior ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------