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


Python Scanner.title方法代码示例

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


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

示例1: runner

# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import title [as 别名]
def runner (parser, options, args):

    if options.task=='scan':
        from scanner import Scanner
        scan = Scanner(options)

        if options.flyback is None:
            flyback_range = get_range(options.flyback_range)
        else:
            flyback_range = [options.flyback]

        scan_speed_range = [options.scan_speed]

        title = scan.title ()
        filename = 'pos_dict_%s.pickle' % (title)
        pos_dict_cache = Cache(filename).load()

        pos_dict = pos_dict_cache.data
        if 0:
            # scan
            for scan_speed in scan_speed_range:
                if scan_speed not in pos_dict:
                    pos_dict[scan_speed] = set([])
                elif isinstance (pos_dict[scan_speed], list):
                    pos_dict[scan_speed] = set(pos_dict[scan_speed])
                stop = False
                for flyback in flyback_range:
                    scan.create_tasks()
                    scan.setup (scan_speed, flyback)
                    try:
                        scan.iterate()
                    except RuntimeError, msg:
                        print 'Scanning failed with runtime error: %s' % (msg)
                        stop = True
                    scan.free_tasks()
                    if stop:
                        break
                    data = (flyback, scan.mirror.line_average(scan.xa_error).std()*1e6)
                    if data not in pos_dict[scan_speed]:
                        pos_dict[scan_speed].add(data)
                        pos_dict_cache.dump()
            #plt = scan.show()
            #plt.draw()
            #plt.show()
            pos_dict_cache.dump()


        import matplotlib.pyplot as plt
        fig = plt.figure(figsize=(12,12))
        def on_keypressed(event, plt=plt, fig=fig):
            key = event.key
            if key=='q':
                plt.close(fig)
            if key=='x':
                plt.close(fig)
                sys.exit(0)
        fig.canvas.mpl_connect('key_press_event', on_keypressed)

        legends = []
        scan_speed_list = sorted(pos_dict.keys ())
        for scan_speed in scan_speed_list:
            flyback_data = pos_dict[scan_speed]
            legends.append ('%.3f m/s' % (scan_speed))
            flyback, data = zip (*flyback_data)
            plt.semilogy(flyback,data, 'x')
        plt.title('Scan speed - flyback ratio curves: %s' % (title))
        plt.xlabel('flyback ratio')
        plt.ylabel('position resolution, um')
        plt.legend(legends)
        plt.show()

        return
开发者ID:pearu,项目名称:iocbio,代码行数:74,代码来源:run_mirrors.py


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