本文整理汇总了Python中motor.Motor.abst方法的典型用法代码示例。如果您正苦于以下问题:Python Motor.abst方法的具体用法?Python Motor.abst怎么用?Python Motor.abst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类motor.Motor
的用法示例。
在下文中一共展示了Motor.abst方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: go
# 需要导入模块: from motor import Motor [as 别名]
# 或者: from motor.Motor import abst [as 别名]
def go(min = 20, max = 50, n_steps = 5, zenith = 0, samp_rate = 4400, acc_len = 1, n_accs = 10,
port = '/dev/ttyUSB0', ip = '128.135.52.192', home=True, docal=True, indef=True):
'''
Main function that creates motor, spec, and hdf5 objects, calculates the computer's offset
from ntp time, and calls snap_and_move() in order to sweep the horn through a range of
elevations and write accumulations and metadata to disk. Closes file and creates a new file
after each return to zenith.
Inputs:
Step size in degrees, zenith angle in degrees, min and max angles in degrees, sample
rate in MHz, accumulation length in seconds, number of accumulations, /dev address of
motor controller, output filename, and ip address of roach board.
Outputs:
None, writes to disk and std out.
'''
m = Motor(port = port)
angles = np.sign(min)*scan_range(min, max, n_steps)
# Flag calibration data if not scanning indefinitely
if not indef:
calext='_cal'
else:
calext='_scan'
while True:
while True:
try:
s = Spec(ip = ip, samp_rate = samp_rate, acc_len = acc_len) #re-initialize roach
break
except Exception:
pass
dt = 0 #ts.offset()
fname = '/'.join(os.path.abspath(io.__file__).split('/')[:-2])\
+ '/output/' + ts.true_time(dt) + calext + '.h5'
if home:
#print('Homing')
m.abst(0)
m.home()
if docal:
move_and_snap(m, s, fname, zenith, CALIBRATOR_POSITION + zenith, acc_len, n_accs, dt)
for destination in tqdm.tqdm(angles, unit = 'steps'):
move_and_snap(m, s, fname, zenith, destination, acc_len, n_accs, dt)
if not indef:
break