def test_get_mod(self): gas = Gas(0.4, 0.6, 0) assert gas.get_mod() == pytest.approx(25, 0.1) assert gas.get_mod(surf_pressure=0.8) == pytest.approx(27, 0.1) assert gas.get_mod(1.6) == pytest.approx(30, 0.1) assert gas.get_mod(1.6, surf_pressure=0.8) == pytest.approx(32, 0.1) assert gas.get_mod(0.18) == 0
default_value=1000) gravity = UserInput().getFloatInput( "Gravitational acceleration (decimal, m/s^2) [9.81]: ", 0, 25, default_value=9.81) ppo2 = UserInput().getFloatInput("Max PPO2 (decimal, bar) [1.4]: ", 0, 100, default_value=1.4) f_n = 1 - f_o2 - f_he gas = Gas(f_o2, f_n, f_he) round_places = 2 mod = gas.get_mod(ppo2=ppo2, density=density, surf_pressure=surf_pressure, gravity=gravity) print("") print("MOD at " + str(ppo2) + " bars for " + str(gas)) print("With a surface pressure of " + str(surf_pressure) + " bar") print("Density of fluid: " + str(density) + " kg/m^3") print("Gravitational acceleration: " + str(gravity) + " m/s^2") print("MOD: " + str(round(mod, 2)) + " m") print("") if input("Would you like to enter another gas [Y/n]? ") == 'n': break
f_o2 = UserInput().getFloatInput("Fraction of oxygen (decimal) [0.21]: ", 0.01, 1, default_value=0.21) f_he = UserInput().getFloatInput("Fraction of helium (decimal) [0]: ", 0, (1 - f_o2), default_value=0) surf_pressure = UserInput().getFloatInput( "Surface pressure (decimal, bar) [1]: ", 0, 1.1, default_value=1) f_n = 1 - f_o2 - f_he gas = Gas(f_o2, f_n, f_he) fresh_min_od = gas.get_mod(CONST.MIN_PPO2, CONST.DENSITY_FRESHWATER, surf_pressure=surf_pressure) fresh_mod = gas.get_mod(CONST.MAX_PPO2, CONST.DENSITY_FRESHWATER, surf_pressure=surf_pressure) fresh_mod_deco = gas.get_mod(CONST.MAX_PPO2_DECO, CONST.DENSITY_FRESHWATER, surf_pressure=surf_pressure) salt_min_od = gas.get_mod(CONST.MIN_PPO2, CONST.DENSITY_SALTWATER, surf_pressure=surf_pressure) salt_mod = gas.get_mod(CONST.MAX_PPO2, CONST.DENSITY_SALTWATER, surf_pressure=surf_pressure) salt_mod_deco = gas.get_mod(CONST.MAX_PPO2_DECO, CONST.DENSITY_SALTWATER,