Terry used the code below in Nengo 1.4 to generate fMRI signals. It should be converted to Nengo 2.0. The basic flow of the code, is to toss a probe on the spiking output, and then multiply the spiking output by the absolute value of the connection weight matrix (i.e. to get the total amount of neurotransmitter used). For the hemodynamic function, just take it from this ACT-R paper.
class FMRI(nef.SimpleNode):
def __init__(self,name,filename,ensembles,terminations):
self.spikes=0
self.synapses=0
nef.SimpleNode.__init__(self,name)
self.ensembles=ensembles
self.encoders={}
for t in terminations:
while hasattr(t,'wrappedTermination'):
t=t.wrappedTermination
self.encoders[t]=numeric.array(t.node.encoders).__abs__()
self.filename=filename
def tick(self):
self.spikes=0
for n in self.ensembles:
total=0
for v in n.getOrigin('AXON').getValues().getValues():
total+=v
self.spikes+=total
self.synapses=0
for t,encoders in self.encoders.items():
x=t.output
enc=self.encoders[t]
self.synapses+=sum(numeric.dot(enc,x))
f=file(self.filename,'a')
f.write('%g,%g,%g\n'%(self.t_start,self.spikes,self.synapses))
f.close()
def origin_spikes(self):
return [self.spikes]
def origin_synpases(self):
return [self.synapses]
I figured I'd make an issue for this, so people could have access to this code.
Terry used the code below in Nengo 1.4 to generate fMRI signals. It should be converted to Nengo 2.0. The basic flow of the code, is to toss a probe on the spiking output, and then multiply the spiking output by the absolute value of the connection weight matrix (i.e. to get the total amount of neurotransmitter used). For the hemodynamic function, just take it from this ACT-R paper.
I figured I'd make an issue for this, so people could have access to this code.