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


Python Dive.full_desat_time方法代码示例

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


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

示例1: TestDive

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import full_desat_time [as 别名]

#.........这里部分代码省略.........
        self.cctxhypo = Tank(0.10, 0.50, tank_vol=3.0, tank_pressure=200,
                             tank_rule='10b')
        self.setpoint = 1.2

        self.deco1 = Tank(0.8,
                          0.0,
                          tank_vol=7.0,
                          tank_pressure=200,
                          tank_rule="10b")
        self.deco2 = Tank(0.5,
                          0.0,
                          tank_vol=7.0,
                          tank_pressure=200,
                          tank_rule="10b")
        self.decoo2 = Tank(1.0,
                           0.0,
                           tank_vol=7.0,
                           tank_pressure=200,
                           tank_rule="10b")

        self.setpoint = 0.0
        self.dive_tank = None
        self.all_tanks = None
        self.dive_segs = []

    def do_dive(self):
        """do the actual dive.

        self.params is in the form ((depth, time), (depth, time))
        each couple of depth, time is a segment of the same dive.
        """
        if not hasattr(self, 'name'):
            self.name = '%s:%s' % (self.params[0][0], self.params[0][1])

        for param in self.params:
            self.dive_segs.append(SegmentDive(param[0], param[1] * 60,
                                              self.dive_tank, self.setpoint))
        self.profile1 = Dive(self.dive_segs, self.all_tanks)
        self.profile1.do_dive()
        # self.write_details()

    def do_repetitive_dive(self):
        """do the actual dive.

        self.params is in the form:
            ((depth, time, interval), (depth, time, interval))
        each couple of depth, time, interval is a full dive at the given depth
        interval is done before the dive.
        """
        if not hasattr(self, 'name'):
            self.name = '%s:%s' % (self.params[0][0], self.params[0][1])
        self.profiles = []  # repetive dive profiles.
        for param in self.params:
            if len(self.profiles) > 0:
                self.profiles.append(
                    Dive([SegmentDive(param[0], param[1] * 60,
                                      self.dive_tank, self.setpoint)],
                         self.all_tanks,
                         self.profiles[-1]))
                self.profiles[-1].do_surface_interval(param[2] * 60)
            else:
                self.profiles.append(
                    Dive([SegmentDive(param[0], param[1] * 60,
                                      self.dive_tank, self.setpoint)],
                         self.all_tanks))
            self.profiles[-1].do_dive()

        self.profile1 = self.profiles[-1]  # save last dive
        # self.write_details()

    def tearDown(self):
        """After tests."""
        # settings.SURFACE_TEMP = 20
        settings.RUN_TIME = True

    @property
    def details(self):
        """Output details of the dive.

        :returns: string
        :rtype: str
        """
        return '"%s": ["%s", %f, %f, %d, %d, %f, %s], ' % (
            self.name,
            seconds_to_mmss(self.profile1.run_time),
            self.profile1.model.ox_tox.otu,
            self.profile1.model.ox_tox.cns * 100,
            self.profile1.no_flight_time(),
            self.profile1.full_desat_time(),
            self.profile1.tanks[0].used_gas,
            str(self.profile1.tanks[0].check_rule()).lower())

    def print_details(self):
        """print detailed results."""
        print(self.details)

    def write_details(self):
        """write in /tmp/details.txt the detailed results."""
        with open('/tmp/details.txt', 'a') as myfile:
            myfile.write(self.details + '\n')
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:104,代码来源:common.py


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