本文整理汇总了Python中drive.Drive.calibrate方法的典型用法代码示例。如果您正苦于以下问题:Python Drive.calibrate方法的具体用法?Python Drive.calibrate怎么用?Python Drive.calibrate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类drive.Drive
的用法示例。
在下文中一共展示了Drive.calibrate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SRT
# 需要导入模块: from drive import Drive [as 别名]
# 或者: from drive.Drive import calibrate [as 别名]
class SRT():
def __init__(self,mode,device,calibrationSpeeds):
baud = 9600
if mode == Mode.SIM:
self.drive = Drive(device,baud,simulate=1,calibration=calibrationSpeeds)
elif mode == Mode.LIVE:
self.drive = Drive(device,baud,simulate=0,calibration=calibrationSpeeds, persist=False)
self.pos = self.azalt()
self.getCurrentPos()
self.location = self.drive.location #TODO - use this
self.status = Status.INIT
self.mode = mode
def getCurrentPos(self):
"""
Returns current position in azalt.
"""
return self.pos
def setCurrentPos(self, pos):
self.pos = pos
def getMode(self):
return self.mode
def setMode(self,mode):
self.mode = mode
def skycoord(self):
"""
Returns the position information of the telescope in an astropy SkyCoord object.
Returns
-------
SkyCoord : An astropy SkyCoord.
"""
position = self.getCurrentPos()
observatory = self.drive.location
time = self.drive.current_time
coord = SkyCoord(AltAz(az = position[0]*u.degree, alt = position[1]*u.degree, obstime = time, location = observatory))
return coord
def azalt(self):
"""
Returns the azimuth and altitude of the SRT by calling the status() method of the drive class.
"""
#status = self.drive.status()
az,alt = self.drive.az, self.drive.alt
#print("status " + "%f %f" % (az,alt))
return (az,alt)
def radec(self):
"""
Returns the right ascention and declination of the SRT by calling the status() method of the drive class.
"""
status = self.drive.status()
ra,dec = status['ra'],status['dec']
return (ra,dec)
def galactic(self):
"""
"""
return (0.00,0.00)
def stow(self):
"""
A wrapper function for Drive.stow().
"""
self.setStatus(Status.SLEWING)
if self.mode == Mode.SIM:
self.slew((0,90))
elif self.mode == Mode.LIVE:
self.drive.stow()
def home(self):
"""
A wrapper function for Drive.home().
"""
self.setStatus(Status.SLEWING)
if self.mode == Mode.SIM:
self.slew((90,0))
elif self.mode== Mode.LIVE:
self.drive.home()
def calibrate(self):
"""
A wrapper function for Drive.calibrate().
"""
if self.mode == Mode.SIM:
print("Calibration only works in live mode.")
elif self.mode == Mode.LIVE:
self.setStatus(Status.CALIBRATING)
self.drive.calibrate()
def slew(self,pos):
"""
Slews to position pos in degrees.
#.........这里部分代码省略.........