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


Python Engine.data_points方法代码示例

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

示例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
开发者ID:mwhagedorn,项目名称:pyrocksim,代码行数:57,代码来源:eng_parser.py


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