本文整理汇总了Python中dipplanner.dive.Dive.no_flight_time方法的典型用法代码示例。如果您正苦于以下问题:Python Dive.no_flight_time方法的具体用法?Python Dive.no_flight_time怎么用?Python Dive.no_flight_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dipplanner.dive.Dive
的用法示例。
在下文中一共展示了Dive.no_flight_time方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestRepetitiveTxDive3
# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import no_flight_time [as 别名]
class TestRepetitiveTxDive3(TestDive):
def setUp(self):
TestDive.setUp(self)
diveseg1 = SegmentDive(55, 20 * 60, self.txtank1, 0)
self.profile0 = Dive([diveseg1], [self.txtank1])
self.profile0.do_dive()
diveseg2 = SegmentDive(50, 20 * 60, self.txtank1, 0)
self.profile1 = Dive([diveseg2], [self.txtank1], self.profile0)
self.profile1.do_surface_interval(30 * 60)
self.profile1.do_dive()
diveseg3 = SegmentDive(35, 35 * 60, self.txtank1, 0)
self.profile2 = Dive([diveseg3], [self.txtank1], self.profile1)
self.profile2.do_surface_interval(60 * 60)
# self.profile2.refill_tanks()
self.profile2.do_dive()
diveseg4 = SegmentDive(55, 20 * 60, self.txtank1, 0)
self.profile3 = Dive([diveseg4], [self.txtank1], self.profile2)
self.profile3.do_surface_interval(12 * 60 * 60)
# self.profile3.refill_tanks()
self.profile3.do_dive()
def test_rt(self):
assert seconds_to_mmss(self.profile3.run_time) == ' 72:40', \
'bad dive runtime ? (%s)' \
% seconds_to_mmss(self.profile3.run_time)
def test_otu(self):
self.assertAlmostEqual(self.profile3.model.ox_tox.otu,
115.825853006, 7, 'bad dive OTU ? (%s)'
% self.profile3.model.ox_tox.otu)
def test_cns(self):
self.assertAlmostEqual(self.profile3.model.ox_tox.cns * 100,
12.6208702934, 7, 'bad dive CNS ? (%s)'
% (self.profile3.model.ox_tox.cns * 100))
def test_tank_cons(self):
self.assertAlmostEqual(self.txtank1.used_gas, 3350.41341833, 7,
'bad used gas (%s)'
% self.txtank1.used_gas)
def test_tank_cons_rule(self):
self.assertEqual(self.profile3.tanks[0].check_rule(), True,
'Wrong tank status : it should pass the remaining '
'gas rule test (result:%s)'
% self.profile2.tanks[0].check_rule())
def test_no_flight(self):
no_flight_time = self.profile3.no_flight_time()
self.assertEqual(no_flight_time, 7380, 'Bad no flight time: %s'
% no_flight_time)
示例2: TestRepetitiveDive1
# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import no_flight_time [as 别名]
class TestRepetitiveDive1(TestDive):
def setUp(self):
TestDive.setUp(self)
diveseg1 = SegmentDive(40, 20 * 60, self.airtank12, 0)
self.profile0 = Dive([diveseg1], [self.airtank12])
self.profile0.do_dive()
diveseg2 = SegmentDive(40, 20 * 60, self.airtank, 0)
self.profile1 = Dive([diveseg2], [self.airtank], self.profile0)
self.profile1.do_surface_interval(20 * 60)
self.profile1.do_dive()
def test_rt(self):
assert seconds_to_mmss(self.profile1.run_time) == ' 68:09', \
'bad dive runtime ? (%s)' \
% seconds_to_mmss(self.profile1.run_time)
def test_otu(self):
self.assertAlmostEqual(self.profile1.model.ox_tox.otu,
40.0702502936, 7, 'bad dive OTU ? (%s)'
% self.profile1.model.ox_tox.otu)
def test_cns(self):
self.assertAlmostEqual(self.profile1.model.ox_tox.cns * 100,
14.3091665925, 7, 'bad dive CNS ? (%s)'
% (self.profile1.model.ox_tox.cns * 100))
def test_tank_cons(self):
self.assertAlmostEqual(self.airtank12.used_gas, 2115.5196384,
7, 'bad used gas (%s)'
% self.airtank12.used_gas)
def test_tank_cons_rule(self):
self.assertEqual(self.profile1.tanks[0].check_rule(), True,
'Wrong tank status : it should pass the remaining '
'gas rule test (result:%s)'
% self.profile1.tanks[0].check_rule())
def test_no_flight(self):
no_flight_time = self.profile1.no_flight_time()
self.assertEqual(no_flight_time, 5460, 'Bad no flight time: %s'
% no_flight_time)
def test_no_flight_wo_exc(self):
no_flight_time = self.profile1.no_flight_time_wo_exception()
self.assertEqual(no_flight_time, 5460, 'Bad no flight time: %s'
% no_flight_time)
def test_surfaceint(self):
self.assertEqual(self.profile1.get_surface_interval(),
' 20:00',
'wrong surface interval:%s'
% self.profile1.get_surface_interval())
示例3: TestRepetitiveTxDive2
# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import no_flight_time [as 别名]
class TestRepetitiveTxDive2(TestDive):
def setUp(self):
TestDive.setUp(self)
diveseg1 = SegmentDive(55, 20 * 60, self.txtank1, 0)
self.profile0 = Dive([diveseg1], [self.txtank1])
self.profile0.do_dive()
diveseg2 = SegmentDive(50, 20 * 60, self.txtank1, 0)
self.profile1 = Dive([diveseg2], [self.txtank1], self.profile0)
self.profile1.do_surface_interval(30 * 60)
self.profile1.do_dive()
diveseg3 = SegmentDive(35, 35 * 60, self.txtank1, 0)
self.profile2 = Dive([diveseg3], [self.txtank1], self.profile1)
self.profile2.do_surface_interval(60 * 60)
# self.profile2.refill_tanks()
self.profile2.do_dive()
def test_rt(self):
assert seconds_to_mmss(self.profile2.run_time) == '166:21', \
'bad dive runtime ? (%s)' \
% seconds_to_mmss(self.profile2.run_time)
def test_otu(self):
self.assertAlmostEqual(self.profile2.model.ox_tox.otu,
86.5037540773, 7, 'bad dive OTU ? (%s)'
% self.profile2.model.ox_tox.otu)
def test_cns(self):
self.assertAlmostEqual(self.profile2.model.ox_tox.cns * 100,
24.2843630006, 7, 'bad dive CNS ? (%s)'
% (self.profile2.model.ox_tox.cns * 100))
def test_tank_cons(self):
self.assertAlmostEqual(self.txtank1.used_gas, 4979.54636588, 7,
'bad used gas (%s)'
% self.txtank1.used_gas)
def test_tank_cons_rule(self):
self.assertEqual(self.profile2.tanks[0].check_rule(), True,
'Wrong tank status : it should pass the remaining '
'gas rule test (result:%s)'
% self.profile2.tanks[0].check_rule())
def test_no_flight(self):
no_flight_time = self.profile2.no_flight_time()
self.assertEqual(no_flight_time, 18960, 'Bad no flight time: %s'
% no_flight_time)
示例4: TestRepetitiveTxDive1
# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import no_flight_time [as 别名]
class TestRepetitiveTxDive1(TestDive):
def setUp(self):
TestDive.setUp(self)
diveseg1 = SegmentDive(55, 20 * 60, self.txtank1, 0)
self.profile0 = Dive([diveseg1], [self.txtank1])
self.profile0.do_dive()
diveseg2 = SegmentDive(50, 20 * 60, self.txtank1, 0)
self.profile1 = Dive([diveseg2], [self.txtank1], self.profile0)
self.profile1.do_surface_interval(20 * 60)
# self.profile1.refill_tanks()
self.profile1.do_dive()
def test_rt(self):
assert seconds_to_mmss(self.profile1.run_time) == '124:44', \
'bad dive runtime ? (%s)' \
% seconds_to_mmss(self.profile1.run_time)
def test_otu(self):
self.assertAlmostEqual(self.profile1.model.ox_tox.otu,
55.5549635111, 7, 'bad dive OTU ? (%s)'
% self.profile1.model.ox_tox.otu)
def test_cns(self):
self.assertAlmostEqual(self.profile1.model.ox_tox.cns * 100,
21.1631708375, 7, 'bad dive CNS ? (%s)'
% (self.profile1.model.ox_tox.cns * 100))
def test_tank_cons(self):
self.assertAlmostEqual(self.txtank1.used_gas, 4006.7619273, 7,
'bad used gas (%s)'
% self.txtank1.used_gas)
def test_tank_cons_rule(self):
self.assertEqual(self.profile1.tanks[0].check_rule(), True,
'Wrong tank status : it should pass the remaining '
'gas rule test (result:%s)'
% self.profile1.tanks[0].check_rule())
def test_no_flight(self):
no_flight_time = self.profile1.no_flight_time()
self.assertEqual(no_flight_time, 12660, 'Bad no flight time: %s'
% no_flight_time)
示例5: TestDive
# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import no_flight_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')
示例6: TestRepetitiveDive3
# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import no_flight_time [as 别名]
class TestRepetitiveDive3(TestDive):
def setUp(self):
TestDive.setUp(self)
diveseg1 = SegmentDive(40, 20 * 60, self.airtank12, 0)
self.profile0 = Dive([diveseg1], [self.airtank12])
self.profile0.do_dive()
diveseg2 = SegmentDive(30, 40 * 60, self.airtank, 0)
self.profile1 = Dive([diveseg2], [self.airtank], self.profile0)
self.profile1.do_surface_interval(30 * 60)
self.profile1.do_dive()
diveseg3 = SegmentDive(25, 35 * 60, self.airtank, 0)
self.profile2 = Dive([diveseg3], [self.airtank], self.profile1)
self.profile2.do_surface_interval(60 * 60)
# self.profile2.refill_tanks()
self.profile2.do_dive()
diveseg4 = SegmentDive(40, 20 * 60, self.airtank, 0)
self.profile3 = Dive([diveseg4], [self.airtank], self.profile2)
self.profile3.do_surface_interval(12 * 60 * 60)
# self.profile3.refill_tanks()
self.profile3.do_dive()
def test_rt(self):
assert seconds_to_mmss(self.profile3.run_time) == ' 38:36', \
'bad dive runtime ? (%s)' \
% seconds_to_mmss(self.profile3.run_time)
def test_otu(self):
self.assertAlmostEqual(self.profile3.model.ox_tox.otu,
86.8657204829, 7, 'bad dive OTU ? (%s)'
% self.profile3.model.ox_tox.otu)
def test_cns(self):
self.assertAlmostEqual(self.profile3.model.ox_tox.cns * 100,
7.75546902304, 7, 'bad dive CNS ? (%s)'
% (self.profile3.model.ox_tox.cns * 100))
def test_tank_cons(self):
self.assertAlmostEqual(self.airtank.used_gas, 2115.5196384, 7,
'bad used gas (%s)'
% self.airtank.used_gas)
def test_tank_cons_rule(self):
self.assertEqual(self.profile3.tanks[0].check_rule(), True,
'Wrong tank status : it should pass the remaining '
'gas rule test (result:%s)'
% self.profile2.tanks[0].check_rule())
def test_no_flight(self):
no_flight_time = self.profile3.no_flight_time()
self.assertEqual(no_flight_time, 1620, 'Bad no flight time: %s'
% no_flight_time)
def test_no_flight_wo_exc(self):
no_flight_time = self.profile3.no_flight_time_wo_exception()
self.assertEqual(no_flight_time, 1620, 'Bad no flight time: %s'
% no_flight_time)
def test_surfaceint(self):
self.assertEqual(self.profile3.get_surface_interval(),
'720:00',
'wrong surface interval:%s'
% self.profile3.get_surface_interval())
示例7: TestRepetitiveDive2
# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import no_flight_time [as 别名]
class TestRepetitiveDive2(TestDive):
def setUp(self):
TestDive.setUp(self)
diveseg1 = SegmentDive(40, 20 * 60, self.airtank12, 0)
self.profile0 = Dive([diveseg1], [self.airtank12])
self.profile0.do_dive()
diveseg2 = SegmentDive(30, 40 * 60, self.airtank, 0)
self.profile1 = Dive([diveseg2], [self.airtank], self.profile0)
self.profile1.do_surface_interval(30 * 60)
self.profile1.do_dive()
diveseg3 = SegmentDive(25, 35 * 60, self.airtank, 0)
self.profile2 = Dive([diveseg3], [self.airtank], self.profile1)
self.profile2.do_surface_interval(60 * 60)
# self.profile2.refill_tanks()
self.profile2.do_dive()
def test_rt(self):
assert seconds_to_mmss(self.profile2.run_time) == ' 70:18', \
'bad dive runtime ? (%s)' \
% seconds_to_mmss(self.profile2.run_time)
def test_otu(self):
self.assertAlmostEqual(self.profile2.model.ox_tox.otu,
66.8427163401, 7, 'bad dive OTU ? (%s)'
% self.profile2.model.ox_tox.otu)
def test_cns(self):
self.assertAlmostEqual(self.profile2.model.ox_tox.cns * 100,
18.1490350581, 7, 'bad dive CNS ? (%s)'
% (self.profile2.model.ox_tox.cns * 100))
def test_tank_cons(self):
self.assertAlmostEqual(self.airtank.used_gas, 2701.73162947, 7,
'bad used gas (%s)'
% self.airtank.used_gas)
def test_tank_cons_rule(self):
self.assertEqual(self.profile2.tanks[0].check_rule(), True,
'Wrong tank status : it should pass the remaining '
'gas rule test (result:%s)'
% self.profile2.tanks[0].check_rule())
def test_no_flight(self):
no_flight_time = self.profile2.no_flight_time()
self.assertEqual(no_flight_time, 18360, 'Bad no flight time: %s'
% no_flight_time)
def test_no_flight_wo_exc(self):
no_flight_time = self.profile2.no_flight_time_wo_exception()
self.assertEqual(no_flight_time, 18360, 'Bad no flight time: %s'
% no_flight_time)
def test_surfaceint(self):
self.assertEqual(self.profile2.get_surface_interval(),
' 60:00',
'wrong surface interval:%s'
% self.profile2.get_surface_interval())