in jsuarez/extra/embyr_deprecated/embyr/modules.py [0:0]
def render(self):
anns = self.realm.sword.anns
deps = [ann.visDeps() for ann in anns]
grids = []
for dep in deps:
vals = dep
vList = [e[1] for e in vals]
vMean, vStd = np.mean(vList), np.std(vList)+1e-3
nStd, nTol = 4.0, 0.5
grayVal = int(255 / nStd * nTol)
grid = np.zeros((16, 16, 3))
for v in vals:
pos, mat = v
r, c = pos
mat = (mat - vMean) / vStd
color = np.clip(mat, -nStd, nStd)
color = int(color * 255.0 / nStd)
if color > 0:
color = (0, color, 128)
else:
color = (-color, 0, 128)
grid[r, c] = color
grids.append(grid)
grids += 15*[0*grids[0]]
grids = grids[:16]
grids1 = np.vstack(grids[:4])
grids2 = np.vstack(grids[4:8])
grids3 = np.vstack(grids[8:12])
grids4 = np.vstack(grids[12:16])
grids = np.hstack((grids1, grids2, grids3, grids4))
embyr.renderMap(self, grids, self.tileSz)
return self.surf