自从工作以来,就把很喜爱的 Python 放在了一边。但最近的一个需求让我重新把它捡起来了。需求就是使用 Python, numpy, scipy 和 matplotlib 分析一个项目的数据。这些数据是经过分析得到的结构频率响应,需要画图,需要分类,需要考虑结构的安装制造分析误差造成结构响应变化。因为数据量很大,不 可能对每一个结构都重新考核,因此提出一些假设,经过几个样机的分析后,确定假设是符合实际情况的,在此基础上,利用可爱的Python家族工具,顺利的 完成大量数据的分析和评估。
还是爱不释手啊。
use threading.Timer
from threading import Timer
def hello():
print “hello, world”
t = Timer(30.0, hello)
t.start() # after 30 seconds, “hello, world” will be printed
This example is taken from Python documentation. It’s useful although I can not figure out where to use it exactly in my code, but since Timer is subclass of Thread (in threading) [...]