本文整理汇总了Python中engine.Engine.data_points方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.data_points方法的具体用法?Python Engine.data_points怎么用?Python Engine.data_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类engine.Engine
的用法示例。
在下文中一共展示了Engine.data_points方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import data_points [as 别名]
def parse(self):
if not os.path.exists(self._filename):
print("no file %s" % self._filename)
return False
engine = untangle.parse(self._filename)
engine_attributes = engine.engine_database.engine_list.engine
data_points = [(dp["t"],dp["f"], dp["m"]) for dp in engine.engine_database.engine_list.engine.data.eng_data]
engine = Engine(**engine_attributes._attributes)
engine.data_points = data_points
return engine
示例2: parse
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import data_points [as 别名]
def parse(self):
if not os.path.exists(self._filename):
return False
lines = []
code = ""
dia = 0.0
length = 0.0
mfg = ""
delays=""
mass = 0.0
prop_mass = 0.0
data_points = []
with open(self._filename) as f:
lines = f.readlines()
for line in lines:
if line.startswith(";"):
self._comment += line
tokens = line.split()
kwargs = {}
if len(tokens) == 7:
code = tokens[0]
dia = float(tokens[1])
length = float(tokens[2])
delays = tokens[3]
prop_mass = float(tokens[4]) * 1000.0
mass = float(tokens[5]) * 1000.0
mfg = tokens[6]
if len(tokens) == 2:
tokens = line.split()
# TODO calculate the mass curve on each iteration
timestamp = tokens[0]
force = tokens[1]
data_points.append([float(timestamp), float(force),0.0])
if len(data_points):
mass_increment = mass/len(data_points)
for i in range(0,len(data_points)):
data_points[i][2] = i*mass_increment
kwargs['code'] = code
kwargs['len'] = length
kwargs['comment'] = self._comment
kwargs['dia'] = dia
kwargs['propWt'] = prop_mass
kwargs['initWt'] = mass
kwargs['mfg'] = mfg
engine = Engine(**kwargs)
engine.data_points = data_points
return engine