コード例 #1
0
ファイル: ImageViewCanvas.py プロジェクト: aaronroodman/ginga
    def get_ruler_distances(self, x1, y1, x2, y2):
        mode = self.t_drawparams.get('units', 'arcmin')
        try:
            image = self.fitsimage.get_image()
            if mode == 'arcmin':
                # Calculate RA and DEC for the three points
                # origination point
                ra_org, dec_org = image.pixtoradec(x1, y1)

                # destination point
                ra_dst, dec_dst = image.pixtoradec(x2, y2)

                # "heel" point making a right triangle
                ra_heel, dec_heel = image.pixtoradec(x2, y1)

                text_h = wcs.get_starsep_RaDecDeg(ra_org, dec_org,
                                                  ra_dst, dec_dst)
                text_x = wcs.get_starsep_RaDecDeg(ra_org, dec_org,
                                                  ra_heel, dec_heel)
                text_y = wcs.get_starsep_RaDecDeg(ra_heel, dec_heel,
                                                  ra_dst, dec_dst)
            else:
                dx = abs(x2 - x1)
                dy = abs(y2 - y1)
                dh = math.sqrt(dx**2 + dy**2)
                text_x = str(dx)
                text_y = str(dy)
                text_h = ("%.3f" % dh)
                
        except Exception as e:
            text_h = 'BAD WCS'
            text_x = 'BAD WCS'
            text_y = 'BAD WCS'

        return (text_x, text_y, text_h)
コード例 #2
0
ファイル: ImageViewCanvas.py プロジェクト: aaronroodman/ginga
    def get_ruler_distances(self, x1, y1, x2, y2):
        mode = self.t_drawparams.get('units', 'arcmin')
        try:
            image = self.fitsimage.get_image()
            if mode == 'arcmin':
                # Calculate RA and DEC for the three points
                # origination point
                ra_org, dec_org = image.pixtoradec(x1, y1)

                # destination point
                ra_dst, dec_dst = image.pixtoradec(x2, y2)

                # "heel" point making a right triangle
                ra_heel, dec_heel = image.pixtoradec(x2, y1)

                text_h = wcs.get_starsep_RaDecDeg(ra_org, dec_org, ra_dst,
                                                  dec_dst)
                text_x = wcs.get_starsep_RaDecDeg(ra_org, dec_org, ra_heel,
                                                  dec_heel)
                text_y = wcs.get_starsep_RaDecDeg(ra_heel, dec_heel, ra_dst,
                                                  dec_dst)
            else:
                dx = abs(x2 - x1)
                dy = abs(y2 - y1)
                dh = math.sqrt(dx**2 + dy**2)
                text_x = str(dx)
                text_y = str(dy)
                text_h = ("%.3f" % dh)

        except Exception as e:
            text_h = 'BAD WCS'
            text_x = 'BAD WCS'
            text_y = 'BAD WCS'

        return (text_x, text_y, text_h)
コード例 #3
0
ファイル: astro.py プロジェクト: saimn/ginga
    def get_ruler_distances(self, viewer):
        mode = self.units.lower()
        points = self.get_points()
        x1, y1 = points[0]
        x2, y2 = points[1]

        try:
            image = viewer.get_image()
            if mode in ('arcmin', 'degrees'):
                # Calculate RA and DEC for the three points
                # origination point
                ra_org, dec_org = image.pixtoradec(x1, y1)

                # destination point
                ra_dst, dec_dst = image.pixtoradec(x2, y2)

                # "heel" point making a right triangle
                ra_heel, dec_heel = image.pixtoradec(x2, y1)

                if mode == 'arcmin':
                    text_h = wcs.get_starsep_RaDecDeg(ra_org, dec_org,
                                                      ra_dst, dec_dst)
                    text_x = wcs.get_starsep_RaDecDeg(ra_org, dec_org,
                                                      ra_heel, dec_heel)
                    text_y = wcs.get_starsep_RaDecDeg(ra_heel, dec_heel,
                                                      ra_dst, dec_dst)
                else:
                    sep_h = wcs.deltaStarsRaDecDeg(ra_org, dec_org,
                                                   ra_dst, dec_dst)
                    text_h = str(sep_h)
                    sep_x = wcs.deltaStarsRaDecDeg(ra_org, dec_org,
                                                   ra_heel, dec_heel)
                    text_x = str(sep_x)
                    sep_y = wcs.deltaStarsRaDecDeg(ra_heel, dec_heel,
                                                    ra_dst, dec_dst)
                    text_y = str(sep_y)
            else:
                dx = abs(x2 - x1)
                dy = abs(y2 - y1)
                dh = math.sqrt(dx**2 + dy**2)
                text_x = str(dx)
                text_y = str(dy)
                text_h = ("%.3f" % dh)

        except Exception as e:
            text_h = 'BAD WCS'
            text_x = 'BAD WCS'
            text_y = 'BAD WCS'

        return (text_x, text_y, text_h)
コード例 #4
0
    def get_ruler_distances(self, viewer):
        mode = self.units.lower()
        points = self.get_points()
        x1, y1 = points[0]
        x2, y2 = points[1]

        try:
            image = viewer.get_image()
            if mode in ('arcmin', 'degrees'):
                # Calculate RA and DEC for the three points
                # origination point
                ra_org, dec_org = image.pixtoradec(x1, y1)

                # destination point
                ra_dst, dec_dst = image.pixtoradec(x2, y2)

                # "heel" point making a right triangle
                ra_heel, dec_heel = image.pixtoradec(x2, y1)

                if mode == 'arcmin':
                    text_h = wcs.get_starsep_RaDecDeg(ra_org, dec_org, ra_dst,
                                                      dec_dst)
                    text_x = wcs.get_starsep_RaDecDeg(ra_org, dec_org, ra_heel,
                                                      dec_heel)
                    text_y = wcs.get_starsep_RaDecDeg(ra_heel, dec_heel,
                                                      ra_dst, dec_dst)
                else:
                    sep_h = wcs.deltaStarsRaDecDeg(ra_org, dec_org, ra_dst,
                                                   dec_dst)
                    text_h = ("%.8f" % sep_h)
                    sep_x = wcs.deltaStarsRaDecDeg(ra_org, dec_org, ra_heel,
                                                   dec_heel)
                    text_x = ("%.8f" % sep_x)
                    sep_y = wcs.deltaStarsRaDecDeg(ra_heel, dec_heel, ra_dst,
                                                   dec_dst)
                    text_y = ("%.8f" % sep_y)
            else:
                dx = abs(x2 - x1)
                dy = abs(y2 - y1)
                dh = np.sqrt(dx**2 + dy**2)
                text_x = ("%.3f" % dx)
                text_y = ("%.3f" % dy)
                text_h = ("%.3f" % dh)

        except Exception as e:
            text_h = 'BAD WCS'
            text_x = 'BAD WCS'
            text_y = 'BAD WCS'

        return (text_x, text_y, text_h)
コード例 #5
0
ファイル: AstroImage.py プロジェクト: pawel-kw/ginga
    def get_starsep_XY(self, x1, y1, x2, y2):
        # source point
        ra_org, dec_org = self.pixtoradec(x1, y1)

        # destination point
        ra_dst, dec_dst = self.pixtoradec(x2, y2)

        return wcs.get_starsep_RaDecDeg(ra_org, dec_org, ra_dst, dec_dst)
コード例 #6
0
ファイル: AstroImage.py プロジェクト: jeanconn/ginga
    def get_starsep_XY(self, x1, y1, x2, y2):
        # source point
        ra_org, dec_org = self.pixtoradec(x1, y1)

        # destination point
        ra_dst, dec_dst = self.pixtoradec(x2, y2)

        return wcs.get_starsep_RaDecDeg(ra_org, dec_org, ra_dst, dec_dst)