def view_circus_templates(self, indices=None):
if indices is None:
indices = range(self.nb_templates)
if not numpy.iterable(indices):
indices = [indices]
data = self.template_store.get(indices, ['templates', 'norms'])
width = self.template_store.width
templates = data.pop('templates').T
norms = data.pop('norms')
scaling = None
pylab.figure()
for count, i in enumerate(indices):
template = templates[count].toarray().reshape(self.nb_channels, width) * norms[count]
xmin, xmax = self.probe.field_of_view['x_min'], self.probe.field_of_view['x_max']
ymin, ymax = self.probe.field_of_view['y_min'], self.probe.field_of_view['y_max']
if scaling is None:
scaling= 10*numpy.max(numpy.abs(template))
colorVal = self._scalarMap_circus.to_rgba(i)
for count, i in enumerate(xrange(self.nb_channels)):
x, y = self.probe.positions[:, i]
xpadding = ((x - xmin)/(float(xmax - xmin) + 1))*(2*width)
ypadding = ((y - ymin)/(float(ymax - ymin) + 1))*scaling
pylab.plot(xpadding + numpy.arange(width), ypadding + template[i, :], color=colorVal)
pylab.tight_layout()
pylab.setp(pylab.gca(), xticks=[], yticks=[])
pylab.xlim(xmin, 3*width)
pylab.show()
评论列表
文章目录