def __init__(self, image, img_data, sources, poslist, index=0, **kwargs): PanZoomCamera.__init__(self, **kwargs) self.index = index self.image = image self.img_data = img_data self.sources = sources self.poslist = poslist #self.smin = 0.9*np.nanmin(self.img_data) #self.smax = 1.02*np.nanmax(self.img_data) pcts = np.nanpercentile(self.img_data, [5.0, 99.0]) if np.all(np.isfinite(pcts)): self.smin = pcts[0] self.smax = pcts[1] self.accelerator = 5.0 self.nsrc = len(poslist) self._keymap = { keys.UP: +1, keys.DOWN: -1, keys.LEFT: -1, keys.RIGHT: +1, keys.SPACE: +1 } self._timer = Timer(0.2, start=False, connect=self.on_timer)