In [17]:
import deco
import deco_mix
import numpy
In [18]:
# Globals
settings = deco.deco_settings(
last_stop = 3,
gf_low = 0.1,
gf_high = 0.90)
precision = numpy.float32
In [19]:
mix_ctx = deco_mix.deco_mix_ctx()
mix_ctx.set_mix(
1,
deco_mix.deco_mix(
f_o2 = 0.21,
f_he = 0.35,
switch_depth = 0,
enabled = False))
#print(gasmixes)
#print(mix_ctx)
In [20]:
# Initialize decompression context
deco_ctx = deco.deco_zhl16b(
settings = settings,
mix_ctx = mix_ctx,
p_surface = 1.0,
salinity = 1.0)
#print(deco_ctx)
In [21]:
# Simulate dive profile.
deco_ctx.mix_ctx.set_active_mix(1)
deco_ctx.update_asc_desc(
time = 5,
p_begin = deco_ctx.p_surface,
p_end = deco_ctx.depth_to_pressure(50))
deco_ctx.update_constant(
time = 20,
p_amb = deco_ctx.depth_to_pressure(50))
# Get deco info.
di = deco.deco_info()
di = deco_ctx.decotime_update(
p_amb = deco_ctx.depth_to_pressure(50),
di = di)
print (di)
assert di.time_to_surface == 57
assert di.stops[0]['depth'] == 33
assert di.stops[0]['time'] == 1
assert di.stops[1]['depth'] == 30
assert di.stops[1]['time'] == 1
assert di.stops[2]['depth'] == 27
assert di.stops[2]['time'] == 1
assert di.stops[3]['depth'] == 24
assert di.stops[3]['time'] == 1
assert di.stops[4]['depth'] == 21
assert di.stops[4]['time'] == 1
assert di.stops[5]['depth'] == 18
assert di.stops[5]['time'] == 1
assert di.stops[6]['depth'] == 15
assert di.stops[6]['time'] == 2
assert di.stops[7]['depth'] == 12
assert di.stops[7]['time'] == 4
assert di.stops[8]['depth'] == 9
assert di.stops[8]['time'] == 7
assert di.stops[9]['depth'] == 6
assert di.stops[9]['time'] == 12
assert di.stops[10]['depth'] == 3
assert di.stops[10]['time'] == 24