I have two questions which fit well together. I will try to describe them in a single example... If this is too long, I would not mind to be asked to reformulate my questions in a simpler way, nor to talk about it on skype.
My first question is the following: is it possible to access, in the transfer functions, to specific neuron populations defined in the brain section? For example, would it be possible to define several "layers" (pyNN populations) in the brain section, and return a PyNN assembly as a circuit, so that I can refer to different populations in the transfer functions? My second question will be: how can I use the decorator "@nrp.MapRobotPublisher"?
Both questions may become more explicit, if I write a minimal example of brain definition and transfer functions:
In the brain definition
nOrientations = 4
nRows = 5
nColumns = 5
LGNLayer = sim.Population(nRows*nColumns, someCellType, label="LGN")
V1Layer = sim.Population(nOrientations*nRows*nColumns, someCellType, label="V1")
sourceTargetVector = [ ] # here I just connect some neurons of LGN to some neurons of V1
for k in range(nOri):
--- for i in range(nRows):
------- for j in range(nColumns):
----------- if #someCondition#:
--------------- sourceTargetVector.append(i*nColumns + j, k*nRows*nColumns + i*nColumns + j)
sim.Projection(LGNLayer, V1Layer, MyConnector(sourceTargetVector), sim.StaticSynapse(someWeight))
circuit = LGNLayer + V1Layer6 # this is an assembly, and I want to refer to both these populations in the TFs
In the transfer functions
Now, let's say I have an input transfer function that gives a resized version of the robot's camera output as an input to my LGN layer. For a second transfer function, I want to publish the live activity of the V1 layer, as a "retinotopic" 2D array which displays the current spike rate of each neurons of the layer. I know how to generate, from all spike counts of the oriented neurons of the V1 Layer, a nicely plottable 2D-array.
What I would want to know is how I can use the decorator @nrp.MapRobotPublisher to make the TF plot, during the simulation, the 2D-array I generated. I tried some pseudo-code here, to illustrate what I would want to do, but I may have done it all wrong:
import numpy as np
import matplotlib.pyplot as plt
@nrp.MapVariable("cumulativePlotDensityV1", scope=nrp.GLOBAL, initial_value =numpy.zeros((4,5,5))
@nrp.MapSpikeSink("V1LayerToPlot", nrp.brain.V1Layer, nrp.leaky_integrator_alpha)
def plot_V1_Activity(t, V1Figure, cumulativePlotDensityV1, V1LayerToPlot):
--- (some code that uses V1LayerToPlot and cumulativePlotDensityV1 (just a global array I need) to get the current spike rate of each neuron of the V1 layer and to generate a plottable 2D-array, "plottableV1", out of it)
--- plottableV1 = ...
--- V1Figure = plt.figure()
Thanks a lot if someone can help me about this!!