def set_image(self, channel, paninfo, image): if image is None or not isinstance(image, BaseImage): self.logger.debug("no main image--clearing Pan viewer") paninfo.panimage.clear() return if not self.use_shared_canvas: self.logger.debug("setting Pan viewer image") paninfo.panimage.set_image(image) else: paninfo.panimage.zoom_fit() p_canvas = paninfo.panimage.get_private_canvas() # remove old compasses try: p_canvas.delete_object_by_tag(paninfo.compass_wcs) except Exception: pass try: p_canvas.delete_object_by_tag(paninfo.compass_xy) except Exception: pass x, y = 0.5, 0.5 radius = 0.1 paninfo.compass_xy = p_canvas.add(self.dc.Compass( x, y, radius, color=self.settings.get('xy_compass_color', 'yellow'), fontsize=14, ctype='pixel', coord='percentage')) # create compass if image.has_valid_wcs(): try: # HACK: force a wcs error here if one is going to happen wcs.add_offset_xy(image, x, y, 1.0, 1.0) radius = 0.2 paninfo.compass_wcs = p_canvas.add(self.dc.Compass( x, y, radius, color=self.settings.get('compass_color', 'skyblue'), fontsize=14, ctype='wcs', coord='percentage')) except Exception as e: paninfo.compass_wcs = None self.logger.warning("Can't calculate wcs compass: %s" % ( str(e))) try: # log traceback, if possible (type_, value_, tb) = sys.exc_info() tb_str = "".join(traceback.format_tb(tb)) self.logger.error("Traceback:\n%s" % (tb_str)) except Exception: tb_str = "Traceback information unavailable." self.logger.error(tb_str) self.panset(channel.fitsimage, channel, paninfo)
def add_offset_xy(self, x, y, delta_deg_x, delta_deg_y): warnings.warn( "This function has been deprecated--" "use the version in ginga.util.wcs", PendingDeprecationWarning) return wcs.add_offset_xy(self, x, y, delta_deg_x, delta_deg_y)