def info_xy(self, data_x, data_y, settings): ct = self.get('ct', None) # Get the value under the data coordinates try: # We report the value across the pixel, even though the coords # change halfway across the pixel x, y = int(data_x + 0.5), int(data_y + 0.5) value = self.get_data_xy(x, y) # Mapping from bytescaled values back to original values value = iis.wcs_pix_transform(ct, value) except Exception as e: self.logger.error("Exception getting value at %d,%d: %s" % (x, y, str(e))) value = None # Calculate WCS RA, if available try: # Subtract offsets of data in framebuffer and add offsets of # rect beginning in source data_x = data_x - (ct.dx - 1) + (ct.sx - 1) data_y = data_y - (ct.dy - 1) + (ct.sy - 1) #ra_deg, dec_deg = wcs_coord_transform(ct, data_x, data_y) #ra_txt, dec_txt = self.wcs.deg2fmt(ra_deg, dec_deg, 'str') ra_txt = 'BAD WCS' dec_txt = 'BAD WCS' except Exception as e: self.logger.warning("Bad coordinate conversion: %s" % (str(e))) ra_txt = 'BAD WCS' dec_txt = 'BAD WCS' # Note: FITS coordinates are 1-based, whereas numpy FITS arrays # are 0-based ra_lbl, dec_lbl = unichr(945), unichr(948) fits_x, fits_y = data_x + 1, data_y + 1 info = Bunch.Bunch(itype='astro', data_x=data_x, data_y=data_y, fits_x=fits_x, fits_y=fits_y, x=fits_x, y=fits_y, ra_txt=ra_txt, dec_txt=dec_txt, ra_lbl=ra_lbl, dec_lbl=dec_lbl, value=value) return info
def info_xy(self, data_x, data_y, settings): ct = self.get("ct", None) # Get the value under the data coordinates try: # We report the value across the pixel, even though the coords # change halfway across the pixel x, y = int(data_x + 0.5), int(data_y + 0.5) value = self.get_data_xy(x, y) # Mapping from bytescaled values back to original values value = iis.wcs_pix_transform(ct, value) except Exception, e: self.logger.error("Exception getting value at %d,%d: %s" % (x, y, str(e))) value = None
def info_xy(self, data_x, data_y): ct = self.get('ct', None) # Get the value under the data coordinates try: # We report the value across the pixel, even though the coords # change halfway across the pixel x, y = int(data_x + 0.5), int(data_y + 0.5) value = self.get_data_xy(x, y) # Mapping from bytescaled values back to original values value = iis.wcs_pix_transform(ct, value) except Exception, e: self.logger.error("Exception getting value at %d,%d: %s" % (x, y, str(e))) value = None
def info_xy(self, data_x, data_y, settings): ct = self.get('ct', None) # Get the value under the data coordinates try: # We report the value across the pixel, even though the coords # change halfway across the pixel x, y = int(data_x+0.5), int(data_y+0.5) value = self.get_data_xy(x, y) # Mapping from bytescaled values back to original values value = iis.wcs_pix_transform(ct, value) except Exception as e: self.logger.error("Exception getting value at %d,%d: %s" % ( x, y, str(e))) value = None # Calculate WCS RA, if available try: # Subtract offsets of data in framebuffer and add offsets of # rect beginning in source data_x = data_x - (ct.dx-1) + (ct.sx-1) data_y = data_y - (ct.dy-1) + (ct.sy-1) #ra_deg, dec_deg = wcs_coord_transform(ct, data_x, data_y) #ra_txt, dec_txt = self.wcs.deg2fmt(ra_deg, dec_deg, 'str') ra_txt = 'BAD WCS' dec_txt = 'BAD WCS' except Exception as e: self.logger.warn("Bad coordinate conversion: %s" % ( str(e))) ra_txt = 'BAD WCS' dec_txt = 'BAD WCS' # Note: FITS coordinates are 1-based, whereas numpy FITS arrays # are 0-based ra_lbl, dec_lbl = unichr(945), unichr(948) fits_x, fits_y = data_x + 1, data_y + 1 info = Bunch.Bunch(itype='astro', data_x=data_x, data_y=data_y, fits_x=fits_x, fits_y=fits_y, x=fits_x, y=fits_y, ra_txt=ra_txt, dec_txt=dec_txt, ra_lbl=ra_lbl, dec_lbl=dec_lbl, value=value) return info