本文整理汇总了Python中chimera.util.position.Position.raDecToAltAz方法的典型用法代码示例。如果您正苦于以下问题:Python Position.raDecToAltAz方法的具体用法?Python Position.raDecToAltAz怎么用?Python Position.raDecToAltAz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chimera.util.position.Position
的用法示例。
在下文中一共展示了Position.raDecToAltAz方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _validateRaDec
# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import raDecToAltAz [as 别名]
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)
示例2: test_altAzRaDec
# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import raDecToAltAz [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())
示例3: raDecToAltAz
# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import raDecToAltAz [as 别名]
def raDecToAltAz(self, raDec,lst_inRads=None):
if not lst_inRads:
lst_inRads = self.LST_inRads()
return Position.raDecToAltAz(raDec, self['latitude'], lst_inRads)
示例4: raDecToAltAz
# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import raDecToAltAz [as 别名]
def raDecToAltAz(self, raDec):
return Position.raDecToAltAz(raDec, self['latitude'], self.LST_inRads())
示例5: solve_dome_azimuth
# 需要导入模块: from chimera.util.position import Position [as 别名]
# 或者: from chimera.util.position.Position import raDecToAltAz [as 别名]
def solve_dome_azimuth(self, telescope_pos, lst, nloops=10):
# Find the altitude and azimuth of the current pointing
# This should be valid in either hemisphere
pos = Position.raDecToAltAz(telescope_pos, self.site_latitude, lst)
telaz, telalt, ha = pos.az.R, pos.alt.R, CoordUtil.raToHa(telescope_pos.ra, lst).R
# Find the reference point on the optical axis in dome coordinates
# z: vertical
# y: north - south
# x: east - west
# theta: altitude of the polar axis from the horizontal plane
# phi: rotation of dec axis about polar axis
# Meaning of x and y compared to sky depends on the hemisphere!
# z: always + up
# y: always + toward N for +lat or S for -lat
# x: maintains right-handed coordinate system with z and y
# thus x is + to E for +lat and to W for -lat
# theta: always positive from the horizontal plane to the pole
# phi: rotation about polar axis
# and is +90 for a horizontal axis with OTA toward +x
# and is 0 for OTA over mount with dec axis counterweight down
# and is -90 for a horizontal axis with OTA toward -x
# We have a German equatorial and the origin changes with ha
# Assign phi based on an assumption about the basis derived from the ha
phi = ha
# Assign theta
theta = abs(self.site_latitude.R)
# Find the dome coordinates of the OTA reference point for a German equatorial
# This works in either hemisphere
x0 = self.mount_dec_length * sin(phi)
y0 = -self.mount_dec_length * cos(phi) * sin(theta) + self.mount_dec_offset
z0 = self.mount_dec_length * cos(phi) * cos(theta) + self.mount_dec_height
# (x,y,z) is on the optical axis
# Iterate to make this point also lie on the dome surface
# Begin iteration assuming the zero point is at the center of the dome
# Telescope azimuth is measured from the direction to the pole
d = 0.
r = self.dome_radius
if self.site_latitude.R <= 0.:
telaz2 = telaz - pi
# between (0, 2pi):
if telaz2 > 2 * pi:
telaz2 -= 2 * pi
elif telaz2 < 0:
telaz2 += 2 * pi
telalt2 = telalt
# Iterate for convergence
n = 0
while n < nloops:
d -= r - self.dome_radius
rp = self.dome_radius + d
x = x0 + rp * cos(telalt2) * sin(telaz2)
y = y0 + rp * cos(telalt2) * cos(telaz2)
z = z0 + rp * sin(telalt2)
r = sqrt(x * x + y * y + z * z)
# Repeat the calculation correcting the assumed OTA path length each time
# This converges quickly so just do a few loops and assume it is ok
# print "n, r, rp: ", n, r, rp
n += 1
# Use (x,y,0) from the interation to find the azimuth of the dome
# 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