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


Python Position.fromAltAz方法代码示例

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


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

示例1: _moveScope

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
    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,代码行数:36,代码来源:autoskyflat.py

示例2: syncWithTel

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
    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,代码行数:37,代码来源:astelcodome.py

示例3: slewToAltAz

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
    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,代码行数:37,代码来源:faketelescope.py

示例4: slew

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [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

示例5: _moveScope

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
 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,代码行数:12,代码来源:autoskyflat.py

示例6: test_altAzRaDec

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
 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,代码行数:15,代码来源:test_position.py

示例7: _moveScope

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
    def _moveScope(self, pierSide=None):
        """
        Moves the scope, usually to zenith
        """
        tel = self._getTel()

        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'])
        else:
            self.log.warning("Telescope does not support pier side.")

        try:
            self.log.debug("Slewing scope to alt {} az {}".format(self["flat_alt"], self["flat_az"]))

            tel.slewToAltAz(Position.fromAltAz(Coord.fromD(self["flat_alt"]),
                                               Coord.fromD(self["flat_az"])))
            if tel.isTracking():
                tel.stopTracking()

        except:
            self.log.debug("Error moving the telescope")
开发者ID:astroufsc,项目名称:chimera-domeflat,代码行数:24,代码来源:autodomeflat.py

示例8: getTargetAltAz

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
 def getTargetAltAz(self):
     return Position.fromAltAz(self.getAlt(), self.getAz())
开发者ID:astroufsc,项目名称:chimera,代码行数:4,代码来源:faketelescope.py

示例9: addObservation

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
	def addObservation(self,target,obstime):
	
		session = Session()
		
		lineRe = re.compile('(?P<coord>(?P<ra>[\d:-]+)\s+(?P<dec>\+?[\d:-]+)\s+(?P<epoch>[\dnowNOWJjBb\.]+)\s+)?(?P<imagetype>[\w]+)'
                            '\s+(?P<objname>\'([^\\n\'\\\\]|\\\\.)*\'|"([^\\n"\\\\]|\\\\.)*"|([^ \\n"\\\\]|\\\\.)*)\s+(?P<exposures>[\w\d\s:\*\(\),]*)')
		programs = []
		
		entryFormat = '%(ra)s %(dec)s %(epoch)s %(obstype)s %(name)s %(exposures)s'
		
		p = Position.fromRaDec(target.targetRa,target.targetDec)
		ra = p.ra.HMS
		dec = p.dec.DMS
		
		filterExpt = self.sciExpTime
		if target.type == self.stdFlag:
			filterExpt = self.stdExpTime

		exposures = '1*('

		for i in range(self.nfilters):
			exposures = exposures+'%s:%.0f, '%(self.filters[i],filterExpt[i])

		exposures = exposures[:-2]
		exposures += ')'
		
		infos = {	'ra' : '%02.0f:%02.0f:%02.0f'%(ra[1],ra[2],ra[3]),
					'dec': '%+03.0f:%02.0f:%02.0f'%(dec[0]*dec[1],dec[2],dec[3]),
					'epoch' : 'J%.0f'%target.targetEpoch,
					'obstype' : 'OBJECT',
					'name' :target.name,
					'exposures' : exposures
					}

		i = 0
		line = entryFormat%infos
		
		matchs = lineRe.search(line)
		params = matchs.groupdict()
		
		position = None
		objname  = None

		if params.get("coord", None):
			position  = Position.fromRaDec(str(params['ra']), str(params['dec']), params['epoch'])

		imagetype = params['imagetype'].upper()
		objname   = params['objname'].replace("\"", "")

		multiplier, exps = params['exposures'].split("*")
		try:
			multiplier = int(multiplier)
		except ValueError:
			multiplier = 1

		exps = exps.replace("(", "").replace(")", "").strip().split(",")

		mjd = obstime - 2400000.5
		for i in range(multiplier):

			program = Program(tid = target.id ,name="%s-%03d" % (objname.replace(" ", ""), i),
                              slewAt=mjd,exposeAt=mjd+1./60./24.)

			self.log.info("# program: %s" % program.name)

			if imagetype == "OBJECT":
				if position:
					program.actions.append(Point(targetRaDec=position))
				else:
					program.actions.append(Point(targetName=objname))

			if imagetype == "FLAT":
				site = self._remoteManager.getProxy("/Site/0")
				flatPosition = Position.fromAltAz(site['flat_alt'], site['flat_az'])
				program.actions.append(Point(targetAltAz=flatPosition))

			#if i == 0:
			#    program.actions.append(AutoFocus(start=1500, end=3000, step=250, filter="R", exptime=10))
			#    program.actions.append(PointVerify(here=True))

			for exp in exps:
				if exp.count(":") > 1:
					filter, exptime, frames = exp.strip().split(":")
				else:
					filter, exptime = exp.strip().split(":")
					frames = 1

				if imagetype in ("OBJECT", "FLAT"):
					shutter = "OPEN"
				else:
					shutter = "CLOSE"

				if imagetype == "BIAS":
					exptime = 0

				if imagetype in ("BIAS", "DARK"):
					filter = None

				self.log.info("%s %s %s filter=%s exptime=%s frames=%s" % (imagetype, objname, str(position), filter, exptime, frames))

#.........这里部分代码省略.........
开发者ID:tribeiro,项目名称:SMAPS,代码行数:103,代码来源:tao.py

示例10: sunpos

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
    def sunpos(self, date=None):
        date = date or self.ut()
        self._sun.compute(self._getEphem(date))

        return Position.fromAltAz(
            Coord.fromR(self._sun.alt), Coord.fromR(self._sun.az))
开发者ID:arritrancos,项目名称:chimera,代码行数:8,代码来源:site.py

示例11: test_alt_az

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

        p = Position.fromAltAz("60", "200")
        assert p.dd() == (60, 200)

        assert_raises(ValueError, Position.fromAltAz, "xyz", "abc")        
开发者ID:agati,项目名称:chimera,代码行数:8,代码来源:test_position.py

示例12: getParkPosition

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
 def getParkPosition(self):  # no need to convert to Astelco
     return Position.fromAltAz(self["park_position_alt"],
                               self["park_position_az"])
开发者ID:agati,项目名称:chimera,代码行数:5,代码来源:astelco.py

示例13: getPositionAltAz

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
 def getPositionAltAz(self):
     self._telescope.GetAzAlt()
     return Position.fromAltAz(Coord.fromD(self._telescope.dAlt), Coord.fromD(self._telescope.dAz))
开发者ID:agati,项目名称:chimera,代码行数:5,代码来源:theskytelescope.py

示例14: slewToAz

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
    def slewToAz(self, az):
        # Astelco Dome will only enable slew if it is not tracking
        # If told to slew I will check if the dome is syncronized with
        # with the telescope. If it is not it¡ will wait until it gets
        # in sync or timeout...

        if self.getMode() == Mode.Track:
            raise AstelcoDomeException('Dome is in track mode... Slew is completely controled by AsTelOS...')
            # self.log.warning('Dome is in track mode... Slew is completely controled by AsTelOS...')
            # self.slewBegin(az)
            #
            # start_time = time.time()
            # self._abort.clear()
            # self._slewing = True
            # caz = self.getAz()
            #
            # while self.isSlewing():
            #     # time.sleep(1.0)
            #     if time.time() > (start_time + self._maxSlewTime):
            #         self.log.warning('Dome syncronization timed-out...')
            #         self.slewComplete(self.getAz(), DomeStatus.TIMEOUT)
            #         return 0
            #     elif self._abort.isSet():
            #         self._slewing = False
            #         self.slewComplete(self.getAz(), DomeStatus.ABORTED)
            #         return 0
            #     elif abs(caz - self.getAz()) < 1e-6:
            #         self._slewing = False
            #         self.slewComplete(self.getAz(), DomeStatus.OK)
            #         return 0
            #     else:
            #         caz = self.getAz()
            #
            # self.slewComplete(self.getAz(), DomeStatus.OK)
        else:
            self.log.info('Slewing to %f...' % az)

            start_time = time.time()
            self._abort.clear()
            self._slewing = True
            current_az = self.getAz()

            tpl = self.getTPL()

            self.slewBegin(az)
            cmdid = tpl.set('POSITION.INSTRUMENTAL.DOME[0].TARGETPOS', '%f' % az)
            reference_alt = Coord.fromD(0.)
            desired_position = Position.fromAltAz(reference_alt,
                                                  az)
            # Wait for command to be completed
            cmd = tpl.getCmd(cmdid)
            while not cmd.complete:
                if time.time() > (start_time + self._maxSlewTime):
                    self.log.warning('Dome syncronization timed-out...')
                    self.slewComplete(self.getAz(), DomeStatus.ABORTED)
                    return 0
                cmd = tpl.getCmd(cmdid)

            # time.sleep(self['stabilization_time'])
            # Wait dome arrive on desired position

            while True:

                current_position = Position.fromAltAz(reference_alt,
                                                      current_az)
                if time.time() > (start_time + self._maxSlewTime):
                    self.slewComplete(self.getAz(), DomeStatus.ABORTED)
                    raise AstelcoDomeException('Dome syncronization timed-out...')
                elif self._abort.isSet():
                    self._slewing = False
                    tpl.set('POSITION.INSTRUMENTAL.DOME[0].TARGETPOS', current_az)
                    self.slewComplete(self.getAz(), DomeStatus.ABORTED)
                    return 0
                elif abs(current_position.angsep(desired_position)) < tpl.getobject(
                        'POINTING.SETUP.DOME.MAX_DEVIATION') * 2.0:
                    self._slewing = False
                    self.slewComplete(self.getAz(), DomeStatus.OK)
                    return 0
                else:
                    current_az = self.getAz()

            self.slewComplete(self.getAz(), DomeStatus.OK)
开发者ID:astroufsc,项目名称:chimera-astelco,代码行数:84,代码来源:astelcodome.py

示例15: N

# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import fromAltAz [as 别名]
        # Azimuth is N (0), E (90), S (180), W (270) in both hemispheres
        # However x and y are different in the hemispheres so we fix that here

        zeta = atan2(x, y)
        if (zeta > - 2. * pi) and (zeta < 2. * pi):
            if self.site_latitude.R <= 0.:
                zeta += pi
        else:
            zeta = telaz

        if zeta < 0:
            zeta = zeta + 2 * pi
        elif zeta > 2 * pi:
            zeta - 2 * pi

        return zeta * 180 / pi


if __name__ == '__main__':
    import numpy as np

    dome_radius, mount_dec_height, mount_dec_length, mount_dec_offset = 147, 0, 49.2, 0
    site = Site()
    Model = AzimuthModel(site['latitude'], dome_radius, mount_dec_height, mount_dec_length, mount_dec_offset)
    # for dra in np.arange(10, 200, 36):
    #     for ddec in np.arange(1, 360, 10):
    for az, alt in [(ii, jj) for ii in np.arange(5, 360, 10) for jj in np.arange(25, 90, 20)]:
        tel_pos = Position.altAzToRaDec(Position.fromAltAz(Coord.fromD(alt), Coord.fromD(az)), site['latitude'], site.LST())
        model = Model.solve_dome_azimuth(tel_pos, site.LST_inRads())
        print 'here', alt, az, model, model - az
开发者ID:astroufsc,项目名称:chimera-domesync,代码行数:32,代码来源:dome_track.py


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