Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_Clamond_numba():
assert_close(fluids.numba.Clamond(10000.0, 2.0),
fluids.Clamond(10000.0, 2.0), rtol=5e-15)
assert_close(fluids.numba.Clamond(10000.0, 2.0, True),
fluids.Clamond(10000.0, 2.0, True), rtol=5e-15)
assert_close(fluids.numba.Clamond(10000.0, 2.0, False),
fluids.Clamond(10000.0, 2.0, False), rtol=5e-15)
Res = np.array([1e5, 1e6])
eDs = np.array([1e-5, 1e-6])
fast = np.array([False]*2)
assert_close1d(fluids.numba_vectorized.Clamond(Res, eDs, fast),
fluids.vectorized.Clamond(Res, eDs, fast), rtol=1e-14)
def test_misc_compressible():
assert_close(fluids.numba.isentropic_work_compression(P1=1E5, P2=1E6, T1=300, k=1.4, eta=0.78),
fluids.isentropic_work_compression(P1=1E5, P2=1E6, T1=300, k=1.4, eta=0.78),)
assert_close(fluids.numba.isentropic_efficiency(1E5, 1E6, 1.4, eta_p=0.78),
fluids.isentropic_efficiency(1E5, 1E6, 1.4, eta_p=0.78))
assert_close(fluids.numba.polytropic_exponent(1.4, eta_p=0.78),
fluids.polytropic_exponent(1.4, eta_p=0.78))
assert_close(fluids.numba.Panhandle_A(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15),
fluids.Panhandle_A(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15))
assert_close(fluids.numba.Panhandle_B(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15),
fluids.Panhandle_B(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15))
assert_close(fluids.numba.Weymouth(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15),
fluids.Weymouth(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15))
assert_close(fluids.numba.Spitzglass_high(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15),
fluids.Spitzglass_high(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15))
assert_close(fluids.numba.Spitzglass_high(P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15, Q=30),
Spitzglass_high(P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15, Q=30))
assert_close(fluids.numba.Spitzglass_low(D=0.154051, P1=6720.3199, P2=0, L=54.864, SG=0.6, Tavg=288.7),
fluids.Spitzglass_low(D=0.154051, P1=6720.3199, P2=0, L=54.864, SG=0.6, Tavg=288.7))
def infer_dictionary_types(d):
if not d:
raise ValueError("Empty dictionary cannot infer")
keys = list(d.keys())
type_keys = type(keys[0])
for k in keys:
if type(k) != type_keys:
raise ValueError("Inconsistent key types in dictionary")
values = list(d.values())
type_values = type(values[0])
for v in values:
if type(v) != type_values:
raise ValueError("Inconsistent value types in dictionary")
return numba.typeof(keys[0]), numba.typeof(values[0])
from __future__ import division
import sys
import importlib.util
import types
import numpy as np
import fluids
import fluids.numba
import ht as normal_ht
import ht.numba
orig_file = __file__
normal = normal_ht
__all__ = []
__funcs = {}
numerics = fluids.numba.numerics
replaced = fluids.numba.numerics_dict.copy()
ht.numba.transform_complete_ht(replaced, __funcs, __all__, normal, vec=True)
globals().update(__funcs)
globals().update(replaced)
__name__ = 'ht.numba_vectorized'
__file__ = orig_file
from __future__ import division
import sys
import importlib.util
import types
import numpy as np
import fluids
import fluids.numba
import ht as normal_ht
import ht.numba
orig_file = __file__
normal = normal_ht
__all__ = []
__funcs = {}
numerics = fluids.numba.numerics
replaced = fluids.numba.numerics_dict.copy()
ht.numba.transform_complete_ht(replaced, __funcs, __all__, normal, vec=True)
globals().update(__funcs)
globals().update(replaced)
__name__ = 'ht.numba_vectorized'
__file__ = orig_file
import fluids
import fluids.numba
normal_fluids = fluids
normal = ht
orig_file = __file__
caching = False
'''
'''
__all__ = []
__funcs = {}
numerics = fluids.numba.numerics
replaced = fluids.numba.numerics_dict.copy()
def transform_complete_ht(replaced, __funcs, __all__, normal, vec=False):
cache_blacklist = set(['h_Ganguli_VDI', 'fin_efficiency_Kern_Kraus', 'h_Briggs_Young',
'h_ESDU_high_fin', 'h_ESDU_low_fin', 'Nu_Nusselt_Rayleigh_Holling_Herwig',
'DBundle_for_Ntubes_Phadkeb', 'Thome', 'to_solve_q_Thome',
'temperature_effectiveness_air_cooler', 'factorial',
'size_bundle_from_tubecount', 'crossflow_effectiveness_to_int',
'temperature_effectiveness_basic', '_NTU_from_P_solver',
'NTU_from_P_basic', '_NTU_from_P_erf',
'NTU_from_P_G', 'NTU_from_P_J', 'NTU_from_P_E',
'NTU_from_P_H', 'NTU_from_P_plate'])
__funcs.update(normal_fluids.numba.numbafied_fluids_functions.copy())
new_mods = normal_fluids.numba.transform_module(normal, __funcs, replaced, vec=vec,
cache_blacklist=cache_blacklist)
if vec:
import ht
import fluids
import fluids.numba
normal_fluids = fluids
normal = ht
orig_file = __file__
caching = False
'''
'''
__all__ = []
__funcs = {}
numerics = fluids.numba.numerics
replaced = fluids.numba.numerics_dict.copy()
def transform_complete_ht(replaced, __funcs, __all__, normal, vec=False):
cache_blacklist = set(['h_Ganguli_VDI', 'fin_efficiency_Kern_Kraus', 'h_Briggs_Young',
'h_ESDU_high_fin', 'h_ESDU_low_fin', 'Nu_Nusselt_Rayleigh_Holling_Herwig',
'DBundle_for_Ntubes_Phadkeb', 'Thome', 'to_solve_q_Thome',
'temperature_effectiveness_air_cooler', 'factorial',
'size_bundle_from_tubecount', 'crossflow_effectiveness_to_int',
'temperature_effectiveness_basic', '_NTU_from_P_solver',
'NTU_from_P_basic', '_NTU_from_P_erf',
'NTU_from_P_G', 'NTU_from_P_J', 'NTU_from_P_E',
'NTU_from_P_H', 'NTU_from_P_plate'])
__funcs.update(normal_fluids.numba.numbafied_fluids_functions.copy())
new_mods = normal_fluids.numba.transform_module(normal, __funcs, replaced, vec=vec,
cache_blacklist=cache_blacklist)
SOFTWARE.'''
from __future__ import division
import sys
import importlib.util
import types
import numpy as np
import fluids as normal_fluids
import numba
import fluids.numba
__all__ = []
__funcs = {}
numerics = fluids.numba.numerics
#replaced, NUMERICS_SUBMOD = fluids.numba.create_numerics(replaced, vec=True)
normal = normal_fluids
replaced = fluids.numba.numerics_dict.copy()
fluids.numba.transform_complete(replaced, __funcs, __all__, normal, vec=True)
globals().update(__funcs)
globals().update(replaced)
import sys
import importlib.util
import types
import numpy as np
import fluids as normal_fluids
import numba
import fluids.numba
__all__ = []
__funcs = {}
numerics = fluids.numba.numerics
#replaced, NUMERICS_SUBMOD = fluids.numba.create_numerics(replaced, vec=True)
normal = normal_fluids
replaced = fluids.numba.numerics_dict.copy()
fluids.numba.transform_complete(replaced, __funcs, __all__, normal, vec=True)
globals().update(__funcs)
globals().update(replaced)