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


Python Motor.abst方法代码示例

本文整理汇总了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
开发者ID:jkyl,项目名称:xhorn,代码行数:48,代码来源:scan.py


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