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


Python position.Position类代码示例

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


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

示例1: worldAt

    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,代码行数:7,代码来源:image.py

示例2: _moveScope

    def _moveScope(self, tracking=False, pierSide=None):
        """
        Moves the scope, usually to zenith
        """
        tel = self._getTel()
        site = self._getSite()
        self.log.debug('Moving scope to alt %s az %s.' % (self["flat_alt"], self["flat_az"]))
        if tel.getPositionAltAz().angsep(
                Position.fromAltAz(Coord.fromD(self["flat_alt"]), Coord.fromD(self["flat_az"]))).D < self[
            "flat_position_max"]:

            self.log.debug(
                'Telescope is less than {} degrees from flat position. Not moving!'.format(self["flat_position_max"]))
            if tracking and not tel.isTracking():
                tel.startTracking()
            elif not tracking and tel.isTracking():
                tel.stopTracking()
            if pierSide is not None and tel.features(TelescopePier):
                self.log.debug("Setting telescope pier side to %s." % tel.getPierSide().__str__().lower())
                tel.setSideOfPier(self['pier_side'])

            return

        try:
            self.log.debug("Skyflat Slewing scope to alt {} az {}".format(self["flat_alt"], self["flat_az"]))
            tel.slewToRaDec(Position.altAzToRaDec(Position.fromAltAz(Coord.fromD(self["flat_alt"]),
                                                                     Coord.fromD(self["flat_az"])),
                                                  site['latitude'], site.LST()))
            if tracking:
                self._startTracking()
            else:
                self._stopTracking()
        except:
            self.log.debug("Error moving the telescope")
开发者ID:astroufsc,项目名称:chimera-skyflat,代码行数:34,代码来源:autoskyflat.py

示例3: slew

    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,代码行数:60,代码来源:telescope.py

示例4: syncWithTel

    def syncWithTel(self):
        self.syncBegin()

        self.log.debug('[sync] Check if dome is in sync with telescope')

        if self.getMode() == Mode.Track:
            self.log.warning('Dome is in track mode... Slew is completely controled by AsTelOS...'
                             'Waiting for dome to reach expected position')

            start_time = time.time()

            tpl = self.getTPL()
            ref_altitude = Coord.fromD(0.)
            target_az = Coord.fromD(tpl.getobject('POSITION.INSTRUMENTAL.DOME[0].TARGETPOS'))
            target_position = Position.fromAltAz(ref_altitude,
                                                 target_az)
            while True:
                current_az = self.getAz()
                current_position = Position.fromAltAz(ref_altitude,
                                                      current_az)
                self.log.debug('Current az: %s | Target az: %s' % (current_az.toDMS(), target_az.toDMS()))
                if time.time() > (start_time + self._maxSlewTime):
                    if abs(target_position.angsep(current_position).D) < tpl.getobject(
                            'POINTING.SETUP.DOME.MAX_DEVIATION') * 4.0:
                        self.log.warning("[sync] Dome too far from target position!")
                        break
                    else:
                        self.syncComplete()
                        raise AstelcoDomeException("Dome synchronization timed-out")
                elif abs(target_position.angsep(current_position).D) < tpl.getobject(
                        'POINTING.SETUP.DOME.MAX_DEVIATION') * 2.0:
                    break

        self.syncComplete()
        self.log.debug('[sync] Dome in sync')
开发者ID:astroufsc,项目名称:chimera-astelco,代码行数:35,代码来源:astelcodome.py

示例5: test_distances

    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,代码行数:8,代码来源:test_position.py

示例6: test_altAzRaDec

 def test_altAzRaDec(self):
     
     altAz = Position.fromAltAz('20:30:40', '222:11:00')
     lat = Coord.fromD(0)
     o = ephem.Observer()
     o.lat = '0:0:0'
     o.long = '0:0:0'
     o.date = dt.now(tz.tzutc())
     lst = float(o.sidereal_time())
     raDec = Position.altAzToRaDec(altAz, lat, lst)
     
     altAz2 = Position.raDecToAltAz(raDec, lat, lst)
     assert equal(altAz.alt.toR(),altAz2.alt.toR()) & equal(altAz.az.toR(),altAz2.az.toR())
开发者ID:agati,项目名称:chimera,代码行数:13,代码来源:test_position.py

示例7: slewToAltAz

    def slewToAltAz(self, position):

        if not isinstance(position, Position):
            position = Position.fromAltAz(*position)

        self.slewBegin(self._getSite().altAzToRaDec(position))

        alt_steps = position.alt - self.getAlt()
        alt_steps = float(alt_steps/10.0)

        az_steps = position.az - self.getAz()
        az_steps = float(az_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._alt  += alt_steps
            self._az += az_steps
            self._setRaDecFromAltAz()
            
            time.sleep(0.5)
            t += 0.5
        
        self._slewing = False
            
        self.slewComplete(self.getPositionRaDec(), status)
开发者ID:carriercomm,项目名称:chimera-1,代码行数:35,代码来源:faketelescope.py

示例8: test_precession

    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,代码行数:8,代码来源:test_position.py

示例9: test_changeEpoch

    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,代码行数:8,代码来源:test_position.py

示例10: test_slew_abort

    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,代码行数:46,代码来源:test_telescope.py

示例11: checkPointing

    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,代码行数:44,代码来源:pointverify.py

示例12: _moveScope

 def _moveScope(self):
     """
     Moves the scope, usually to zenith
     """
     tel = self._getTel()
     try:
         self.log.debug("Skyflat Slewing scope to zenith")
         tel.slewToAltAz(Position.fromAltAz(90, 270))
     except:
         self.log.debug("Error moving the telescope")
开发者ID:tribeiro,项目名称:chimera-skyflat,代码行数:10,代码来源:autoskyflat.py

示例13: __init__

 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,代码行数:10,代码来源:stellarium.py

示例14: _validateRaDec

    def _validateRaDec(self, position):

        site = self.getManager().getProxy("/Site/0")
        lst = site.LST()
        latitude = site["latitude"]

        altAz = Position.raDecToAltAz(position,
                                      latitude,
                                      lst)

        return self._validateAltAz(altAz)
开发者ID:arritrancos,项目名称:chimera,代码行数:11,代码来源:telescope.py

示例15: moveSouth

    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,代码行数:12,代码来源:faketelescope.py


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