def map_coord2pix(self, ra, dec): """ :param ra: ra coordinates, relative :param dec: dec coordinates, relative :return: x, y pixel coordinates """ x_0, y_0 = self.pixel_at_angle_0 _pix2coord_transform, _coord2pix_transform = self.transforms x_pos, y_pos = util.map_coord2pix(ra, dec, x_0, y_0, _coord2pix_transform) return x_pos, y_pos
def map_pix2coord(self, x_pos, y_pos): """ :param x_pos: pixel coordinate :param y_pos: pixel coordinate :return: relative ra, dec coordinate """ ra_0, dec_0 = self.coord_at_pixel_0 _pix2coord_transform, _coord2pix_transform = self.transforms ra_pos, dec_pos = util.map_coord2pix(x_pos, y_pos, ra_0, dec_0, _pix2coord_transform) return ra_pos, dec_pos
def coord_at_pixel_0(self): """ :return: angular coordinate (relative arc sec) (ra_0, dec_0) of (pix_x,pix_y) = (0,0) """ #head = self.header #wcs = pywcs.WCS(head) x0, y0 = self.pixel_at_angle_0 _pix2coord_transform, _coord2pix_transform = self.transforms ra_pos, dec_pos = util.map_coord2pix(-x0, -y0, 0, 0, _pix2coord_transform) #ra_0, dec_0 = wcs.all_pix2world(self._xmin_c, self._ymin_c, 0) #cos_dec = np.cos(self.dec / 360 * 2 * np.pi) #d_ra = (ra_0 - self.ra) * 3600. * cos_dec #d_dec = (dec_0 - self.dec) * 3600. #return d_ra, d_dec return ra_pos, dec_pos