当前位置: 首页>>代码示例>>Python>>正文


Python Position.fromRaDec方法代码示例

本文整理汇总了Python中chimera.util.position.Position.fromRaDec方法的典型用法代码示例。如果您正苦于以下问题:Python Position.fromRaDec方法的具体用法?Python Position.fromRaDec怎么用?Python Position.fromRaDec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chimera.util.position.Position的用法示例。


在下文中一共展示了Position.fromRaDec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: worldAt

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def worldAt(self, *pixel):

        if not self._findWCS():
            return Position.fromRaDec(0, 0)

        world = self._valueAt(self._wcs.wcs_pix2world, *pixel)
        return Position.fromRaDec(Coord.fromD(world[0]), Coord.fromD(world[1]))
开发者ID:arritrancos,项目名称:chimera,代码行数:9,代码来源:image.py

示例2: test_distances

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def test_distances(self):

        p1 = Position.fromRaDec("10:00:00", "0:0:0")
        p2 = Position.fromRaDec("12:00:00", "0:0:0")

        d = p1.angsep(p2)
        assert p1.within(p2, Coord.fromD(29.99)) == False
        assert p1.within(p2, Coord.fromD(30.01)) == True
开发者ID:agati,项目名称:chimera,代码行数:10,代码来源:test_position.py

示例3: slew

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def slew(self):

        slewFunction = None
        target = None
        
        currentPage = self.module.view.slewOptions.get_current_page()

        if currentPage == 0:
            raHour = self.module.view.raHourSpin.get_value()
            raMinute = self.module.view.raMinuteSpin.get_value()
            raSec = self.module.view.raSecSpin.get_value()
        
            decDegree = self.module.view.decDegreeSpin.get_value()
            decMinute = self.module.view.decMinuteSpin.get_value()
            decSec = self.module.view.decSecSpin.get_value()
        
            ra = "%2d:%2d:%2d" %(raHour, raMinute, raSec)
            dec = "%2d:%2d:%2d" %(decDegree, decMinute, decSec)

            epochStr = str(self.module.view.epochCombo.child.get_text()).lower()

            if epochStr == "j2000":
                epoch = Epoch.J2000
            elif epochStr == "b1950":
                epoch = Epoch.B1950
            elif epochStr == "now":
                epoch = Epoch.Now
            else:
                # FIXME
                epoch = epochStr
        	
            target = Position.fromRaDec(ra, dec, epoch=epoch)
            slewFunction = self.telescope.slewToRaDec

        elif currentPage == 1:

            altDegree = self.module.view.altDegreeSpin.get_value()
            altMinute = self.module.view.altMinuteSpin.get_value()
            altSec = self.module.view.altSecSpin.get_value()
        
            azDegree = self.module.view.azDegreeSpin.get_value()
            azMinute = self.module.view.azMinuteSpin.get_value()
            azSec = self.module.view.azSecSpin.get_value()
            
            alt = "%2d:%2d:%2d" %(altDegree, altMinute, altSec)
            az = "%2d:%2d:%2d" %(azDegree, azMinute, azSec)
        
            target = Position.fromAltAz(alt, az)
            slewFunction = self.telescope.slewToAltAz

        elif currentPage == 2:
            target =  str(self.module.view.objectNameCombo.child.get_text())
            slewFunction = self.telescope.slewToObject
        
        self.module.view.slewBeginUi()
        
        try:
            slewFunction(target)
        except ObjectNotFoundException, e:
            self.module.view.showError("Object %s was not found on our catalogs." % target)
开发者ID:carriercomm,项目名称:chimera-1,代码行数:62,代码来源:telescope.py

示例4: test_precession

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def test_precession(self):

        sirius_j2000 = Position.fromRaDec("06 45 08.9173", "-16 42 58.017")
        sirius_now = sirius_j2000.precess()

        print
        print sirius_j2000
        print sirius_now
开发者ID:agati,项目名称:chimera,代码行数:10,代码来源:test_position.py

示例5: test_changeEpoch

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def test_changeEpoch(self):

        sirius_j2000 = Position.fromRaDec("06 45 08.9173", "-16 42 58.017")
        sirius_now = sirius_j2000.toEpoch(epoch=Epoch.NOW)

        print
        print sirius_j2000
        print sirius_now
开发者ID:arritrancos,项目名称:chimera,代码行数:10,代码来源:test_position.py

示例6: test_slew_abort

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def test_slew_abort (self):

        site = self.manager.getProxy("/Site/0")

        # go to know position
        self.tel.slewToRaDec(Position.fromRaDec(site.LST(), site["latitude"]))
        last = self.tel.getPositionRaDec()

        # clear event checkings
        FiredEvents = {}

        # drift it
        dest = Position.fromRaDec(last.ra+Coord.fromH(1), last.dec+Coord.fromD(10))
        real_dest = None

        @callback(self.manager)
        def slewBeginClbk(target):
            global real_dest
            real_dest = target

        @callback(self.manager)
        def slewCompleteClbk(position, status):
            assert last.ra  < position.ra  < real_dest.ra
            assert last.dec < position.dec < real_dest.dec

        self.tel.slewBegin += slewBeginClbk
        self.tel.slewComplete += slewCompleteClbk

        # async slew
        def slew():
            tel = self.manager.getProxy(self.TELESCOPE)
            tel.slewToRaDec(dest)

        pool = ThreadPool()
        pool.queueTask(slew)

        # wait thread to be scheduled
        time.sleep(2)

        # abort and test
        self.tel.abortSlew()

        pool.joinAll()

        # event checkings
        self.assertEvents(TelescopeStatus.ABORTED)
开发者ID:agati,项目名称:chimera,代码行数:48,代码来源:test_telescope.py

示例7: checkPointing

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def checkPointing(self):
        """
        This method *chooses* a field to verify the telescope pointing.
        Then it does the pointing and verifies it.
        If unsuccesfull e-mail the operator for help
        isto em portugues eh chamado calagem

        Choice is based on some catalog (Landolt here)
        We choose the field closest to zenith
        """
        # find where the zenith is
        site = self.getManager().getProxy("/Site/0")
        lst = site.LST()
        lat = site["latitude"]
        coords = Position.fromRaDec(lst, lat)

        self.log.info(
            "Check pointing - Zenith coordinates: %f %f" % (lst, lat))

        tel = self.getTel()

        # use the Vizier catalogs to see what Landolt field is closest to
        # zenith
        self.log.debug("Calling landolt")
        fld = Landolt()
        fld.useTarget(coords, radius=45)
        obj = fld.find(limit=self["max_fields"])

        print "Objects returned from Landolt", obj
        # get ra, dec to call pointVerify
        ra = obj[self.currentField]["RA"]
        dec = obj[self.currentField]["DEC"]
        name = obj[self.currentField]["ID"]
        print "Current object ", ra, dec, name

        self.log.info("Chose %s %f %f" % (name, ra, dec))
        tel.slewToRaDec(Position.fromRaDec(ra, dec))
        try:
            self.pointVerify()
        except Exception, e:
            printException(e)
            raise CantSetScopeException(
                "Can't set scope on field %s %f %f we are in trouble, call for help" % 
                (name, ra, dec))
开发者ID:agati,项目名称:chimera,代码行数:46,代码来源:pointverify.py

示例8: __init__

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
 def __init__(self, buffer):
     # discard time
     buffer.recv(8)
     self.ra = struct.unpack("<1I", buffer.recv(4))[0]
     self.ra *= (math.pi / 0x80000000)
     self.ra = Coord.fromR(self.ra).toHMS()
     self.dec = struct.unpack("<1i", buffer.recv(4))[0]
     self.dec *= (math.pi / 0x80000000)
     self.dec = Coord.fromR(self.dec).toDMS()
     self.position = Position.fromRaDec(self.ra, self.dec)
开发者ID:astroufsc,项目名称:chimera-stellarium,代码行数:12,代码来源:stellarium.py

示例9: moveSouth

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def moveSouth(self, offset, rate=SlewRate.MAX):
        self._slewing = True

        pos = self.getPositionRaDec()
        pos = Position.fromRaDec(pos.ra, pos.dec + Coord.fromAS(-offset))
        self.slewBegin(pos)

        self._dec += Coord.fromAS(-offset)
        self._setAltAzFromRaDec()

        self._slewing = False
        self.slewComplete(self.getPositionRaDec(), TelescopeStatus.OK)
开发者ID:astroufsc,项目名称:chimera,代码行数:14,代码来源:faketelescope.py

示例10: test_find

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def test_find (self):
        x = VizQuery()
        x.useCat("II/183A/")
        x.useColumns("*POS_EQ_RA_MAIN,*POS_EQ_DEC_MAIN,*ID_MAIN,Vmag,_r",
                     sortBy="*POS_EQ_RA_MAIN")
        x.useTarget(Position.fromRaDec("14:00:00","-22:00:00"),radius=45)
        
        data = x.find(limit=5)

        for obj in data:
            for k,v in obj.items():
                print k, v
            print
开发者ID:agati,项目名称:chimera,代码行数:15,代码来源:test_vizquery.py

示例11: test_find

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def test_find (self):

        landolt = Landolt()
        landolt.useTarget(Position.fromRaDec("14:00:00","-22:00:00"),radius=45)
        landolt.constrainColumns({"Vmag":"<10"})

        data = landolt.find(limit=5)

        for obj in data:
            for k,v in obj.items():
                assert k
                assert v
                print k, v
开发者ID:agati,项目名称:chimera,代码行数:15,代码来源:test_landolt.py

示例12: _parseSesame

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def _parseSesame (xml):

        try:
            sesame = ET.fromstring(xml.replace("&", "&amp;"))
            target = sesame.findall("Target")
            
            if target:
                for resolver in target[0].findall("Resolver"):
                    jpos  = resolver.find("jpos")
                    if jpos is None:
                        continue
                    return Position.fromRaDec(*jpos.text.split())
        except ExpatError, e:
            return False
开发者ID:carriercomm,项目名称:chimera-1,代码行数:16,代码来源:simbad.py

示例13: slewToRaDec

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def slewToRaDec(self, position):

        if not isinstance(position, Position):
            position = Position.fromRaDec(position[0], position[1], epoch=Epoch.J2000)

        self._validateRaDec(position)

        self.slewBegin(position)

        # Change position epoch to J2000.
        # Most of the Telescopes must have this precession calculation, otherwise pointing to positions of epochs
        # different of J2000 will point the telescope to a wrong position.
        # This should be done after self.slewBegin()
        if position.epoch != Epoch.J2000:
            position = position.toEpoch(Epoch.J2000)


        ra_steps = position.ra - self.getRa()
        ra_steps = float(ra_steps / 10.0)

        dec_steps = position.dec - self.getDec()
        dec_steps = float(dec_steps / 10.0)

        self._slewing = True
        self._abort.clear()

        status = TelescopeStatus.OK

        t = 0
        while t < 5:

            if self._abort.isSet():
                self._slewing = False
                status = TelescopeStatus.ABORTED
                break

            self._ra += ra_steps
            self._dec += dec_steps
            self._setAltAzFromRaDec()

            time.sleep(0.5)
            t += 0.5

        self._slewing = False

        self.startTracking()

        self.slewComplete(self.getPositionRaDec(), status)
开发者ID:arritrancos,项目名称:chimera,代码行数:50,代码来源:faketelescope.py

示例14: test_park

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def test_park (self):
        
        # FIXME: make a real test.
        raise SkipTest()

        def printPosition():
            print self.tel.getPositionRaDec(), self.tel.getPositionAltAz()
            sys.stdout.flush()
            
        print

        ra  = self.tel.getRa()
        dec = self.tel.getDec()

        print "current position:", self.tel.getPositionRaDec()
        print "moving to:", (ra-"01 00 00"), (dec-"01 00 00")

        self.tel.slewToRaDec(Position.fromRaDec(ra-Coord.fromH(1), dec-Coord.fromD(1)))

        for i in range(10):
            printPosition()
            time.sleep(0.5)

        print "parking..."
        sys.stdout.flush()
        self.tel.park()

        t0 = time.time()
        wait = 30

        for i in range(10):
            printPosition()
            time.sleep(0.5)
       
        while time.time() < t0+wait:
            print "\rwaiting ... ",
            sys.stdout.flush()
            time.sleep(1)

        print "unparking..."
        sys.stdout.flush()

        self.tel.unpark()

        for i in range(10):
            printPosition()
            time.sleep(0.5)
开发者ID:agati,项目名称:chimera,代码行数:49,代码来源:test_telescope.py

示例15: __main__

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromRaDec [as 别名]
    def __main__(self):

        tel = self._getTel()
        tel.slewComplete += self.getProxy()._updateSlewPosition

        self._updateSlewPosition(tel.getPositionRaDec(), None)

        # From man(7) fifo: The FIFO must be opened on both ends
        #(reading and writing) before data can be passed.  Normally,
        # opening the FIFO blocks until the other end is opened also

        # force non-blocking open
        fd = os.open(self._in_fifo, os.O_RDONLY | os.O_NONBLOCK)
        in_fifo = os.fdopen(fd, "r")

        while not self._loop_abort.isSet():

            ret = select([in_fifo], [], [], 0)

            # timeout
            if not any(ret):
                time.sleep(1)
                continue

            try:
                edb = in_fifo.readline()

                # writer not connected (XEphem closed)
                if not edb:
                    time.sleep(1)
                    continue

                edb = edb.split(",")

                ra = edb[2].split("|")[0].strip()
                dec = edb[3].split("|")[0].strip()

                target = Position.fromRaDec(ra, dec)
                self.log.info("XEphem FIFO changed: slewing to %s" % target)
                self._getTel().slewToRaDec(target)
            except (ValueError, IndexError):
                self.log.exception("Cannot convert XEphem EDB to Position.")
                continue
            except:
                self.log.exception("Something wrong...")
开发者ID:astroufsc,项目名称:chimera-xephem,代码行数:47,代码来源:xephem.py


注:本文中的chimera.util.position.Position.fromRaDec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。