本文整理汇总了Python中scanner.Scanner.create_tasks方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.create_tasks方法的具体用法?Python Scanner.create_tasks怎么用?Python Scanner.create_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scanner.Scanner
的用法示例。
在下文中一共展示了Scanner.create_tasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runner
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import create_tasks [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