本文整理匯總了Python中scipy.exp方法的典型用法代碼示例。如果您正苦於以下問題:Python scipy.exp方法的具體用法?Python scipy.exp怎麽用?Python scipy.exp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scipy
的用法示例。
在下文中一共展示了scipy.exp方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: closed_loop_contours
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def closed_loop_contours(Gcl_mags, Gcl_phases):
"""Contours of the function Gcl = Gol/(1+Gol), where
Gol is an open-loop transfer function, and Gcl is a corresponding
closed-loop transfer function.
Parameters
----------
Gcl_mags : array-like
Array of magnitudes of the contours
Gcl_phases : array-like
Array of phases in radians of the contours
Returns
-------
contours : complex array
Array of complex numbers corresponding to the contours.
"""
# Compute the contours in Gcl-space. Since we're given closed-loop
# magnitudes and phases, this is just a case of converting them into
# a complex number.
Gcl = Gcl_mags*sp.exp(1.j*Gcl_phases)
# Invert Gcl = Gol/(1+Gol) to map the contours into the open-loop space
return Gcl/(1.0 - Gcl)
示例2: calc_water_temperature
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def calc_water_temperature(T_ambient_C, depth_m):
"""
Calculates hourly ground temperature fluctuation over a year following [Kusuda, T. et al., 1965]_.
..[Kusuda, T. et al., 1965] Kusuda, T. and P.R. Achenbach (1965). Earth Temperatures and Thermal Diffusivity at
Selected Stations in the United States. ASHRAE Transactions. 71(1):61-74
"""
heat_capacity_soil = 2000 # _[A. Kecebas et al., 2011]
conductivity_soil = 1.6 # _[A. Kecebas et al., 2011]
density_soil = 1600 # _[A. Kecebas et al., 2011]
T_max = max(T_ambient_C) + 273.15 # to K
T_avg = np.mean(T_ambient_C) + 273.15 # to K
e = depth_m * math.sqrt(
(math.pi * heat_capacity_soil * density_soil) / (HOURS_IN_YEAR * conductivity_soil)) # soil constants
Tg = [(T_avg + (T_max - T_avg) * math.exp(-e) * math.cos((2 * math.pi * (i + 1) / HOURS_IN_YEAR) - e)) - 274
for i in range(HOURS_IN_YEAR)]
return Tg # in C
示例3: _height
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def _height(P):
"""
Inverted _Pbar function
Parameters
------------
P : float
Standard barometric pressure, [Pa]
Returns
-------
Z : float
Altitude, [m]
Examples
--------
Selected point from Table 1 in [1]_
>>> "%0.0f" % _height(107478)
'-500'
"""
P_atm = P/101325.
Z = 1/2.25577e-5*(1-exp(log(P_atm)/5.2559))
return unidades.Length(Z)
示例4: _thermo0
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def _thermo0(self, rho, T, fase):
rhol = 68.345
B1 = -2.5370
B2 = 0.05366
C1 = 0.94215
C2 = 0.14914
deltaG = 2508.58
lmax = 25.
Drho = rhol-rho/self.M
delta = rho/self.M-7.5114
tau = T-299.28
lg = (B1+B2*T)*(Drho/rhol)**C1
lr = (rho/self.M/rhol)**C1*C2*rhol**2/Drho*T**0.5*exp(
rho/self.M/Drho*deltaG/self.R.kJkgK/self.M/T)
lc = 4*lmax/(exp(delta)+exp(-delta))/(exp(tau)+exp(-tau))
return unidades.ThermalConductivity(lg+lr+lc, "mWmK")
示例5: _tc
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def _tc(self, rho, T, fase):
"""Custom method for critical enhancement"""
Tr = T/304.1282
rhor = rho/467.6
nc = 0.775547504
# Table 4
a = [0, 3, 6.70697, 0.94604, 0.3, 0.3, 0.39751, 0.33791, 0.77963,
0.79857, 0.9, 0.02, 0.2]
# Eq 6
alfa = 1-a[10]*arccosh(1+a[11]*((1-Tr)**2)**a[12])
# Eq 5
num = rhor*exp(-rhor**a[1]/a[1]-(a[2]*(Tr-1))**2-(a[3]*(rhor-1))**2)
den1 = pow(pow(1-1/Tr+a[4]*pow(pow(rhor-1, 2), 0.5/a[5]), 2), a[6])
den2 = pow(pow(a[7]*(rhor-alfa), 2), a[8])
lc = num / (den1+den2)**a[9]
return lc*nc*4.81384e-3
示例6: _vir
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def _vir(self, rho, T, fase):
# The initial density dependence has a different expresion, without muo
# and other normal method calculation so hardcoded here
muB = 0
if rho:
for i, n in enumerate([13.2814, -10862.4, 1664060]):
muB += n/T**i
# Special exponential term for residual viscosity, Eq 5
Ei = [-3.29316e-13, -2.92665e-13, 2.97768e-13, 1.76186e-18]
ni = [4.6, 11.1, 5.6, 12.4]
ki = [20.8, 10.6, 19.7, 21.9]
Tr = T/617.12
rhor = rho/self.M/2.741016
# Eq 7
g = 0
for E, n, k in zip(Ei, ni, ki):
g += E*rhor**n/Tr**k
mur = g*exp(rhor**2)
return muB*rho/self.M + mur
示例7: Z_ShellOil
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def Z_ShellOil(Tr, Pr):
"""Calculate gas compressibility factor using the Shell Oil Company
correlation (2004)
Parameters
------------
Tr : float
Reduced temperature [-]
Pr : float
Reduced pressure [-]
Returns
-------
Z : float
Gas compressibility factor [-]
"""
A = -0.101 - 0.36*Tr + 1.3868*(Tr-0.919)**0.5
B = 0.021 + 0.04275/(Tr-0.65)
C = 0.6222 - 0.224*Tr
D = 0.0657/(Tr-0.86) - 0.037
E = 0.32*exp(-19.53*(Tr-1))
F = 0.122*exp(-11.3*(Tr-1))
G = Pr*(C + D*Pr + E*Pr**4)
Z = A + B*Pr + (1-A)*exp(-G) - F*(Pr/10)**4
return unidades.Dimensionless(Z)
示例8: _physics
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def _physics(self, T, P, mezcla):
"""Properties of Gases calculation. Explanation in [1]_ section 1.4"""
B, B1, B2 = self.B(T)
C, C1, C2 = self.C(T)
self.Z = 1+B*(P/R/T)+(C-B**2)*(P/R/T)**2
V = self.Z*R*T/P
self.U_exc = -R*T*(B1/V+C1/2/V**2)
self.H_exc = R*T*((B-B1)/V+(2*C-C1)/2/V**2)
self.Cv_exc = -R*((2*B1+B2)/V+(2*C1+C2)/2/V**2)
self.Cp_exc = -R*(B2/V-((B-B1)**2-(C-C1)-C2/2)/V**2)
self.S_exc = -R*(log(P)+B1/V+(B**2-C+C1)/2/V**2)
self.A_exc = R*T*(log(P)+(B**2-C/2/V**2))
self.G_exc = R*T*(log(P)+B/V+(B**2+C)/2/V**2)
self.fug = P*exp(B/V+(C+B**2)/2/V**2)
示例9: _fugacity
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def _fugacity(self, Z, zi, A, B, Ai, Bi):
"""Fugacity for individual components in a mixture using the GEoS in
the Schmidt-Wenzel formulation, so the subclass must define the
parameters u and w in the EoS
Any other subclass with different formulation must overwrite this
method
"""
# Precalculation of inner sum in equation
aij = []
for ai, kiji in zip(Ai, self.kij):
suma = 0
for xj, aj, kij in zip(zi, Ai, kiji):
suma += xj*(1-kij)*(ai*aj)**0.5
aij.append(suma)
tita = []
for bi, aai in zip(Bi, aij):
rhs = bi/B*(Z-1) - log(Z-B) + A/B/(self.u-self.w)*(
bi/B-2/A*aai) * log((Z+self.u*B)/(Z+self.w*B))
tita.append(exp(rhs))
return tita
示例10: project_x
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def project_x(x_new, X, gamma, alphas, lambdas):
pair_dist = np.array([np.sum((x_new-row)**2) for row in X])
k = np.exp(-gamma * pair_dist)
return k.dot(alphas / lambdas)
# projection of the "new" datapoint
示例11: debye_func
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def debye_func(x):
"""
Calculate the debye function D(x) = 3*x**(-2)*Integral(z**3/exp(z-1)dz,2,x)
"""
def func(z):
f = z**3./(sp.exp(z)-1)
return f
integral,error = quad(func,0,x)
D = integral*3.*x**(-3.)
return D
示例12: debye_S_vib
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def debye_S_vib(T,thetaD,natoms):
"""
Returns the vibrational entropy of the Debeye model at a given temperature,
T, in meV/atom/K.
"""
S_vib = 4*debye_func(thetaD/T)-3*sp.log(1-sp.exp(-thetaD/T))
S_vib = natoms*BOLTZCONST*S_vib
return S_vib
示例13: debye_C_V
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def debye_C_V(T,thetaD,natoms):
"""
Returns the heat capacity at constant volume, C_V, of the Debeye model at a
given temperature, T, in meV/atom/K.
"""
C_V = 4*debye_func(thetaD/T)-3*(thetaD/T)/(sp.exp(thetaD/T)-1.)
C_V = 3*natoms*BOLTZCONST*C_V
return C_V
示例14: __call__
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def __call__(self, x):
if not isinstance(x, float):
x = float(x)
return 1.0 / (1.0 + scipy.exp(-x))
示例15: calc_plate_HEX
# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import exp [as 別名]
def calc_plate_HEX(NTU, cr):
'''
This function calculates the efficiency of exchange for a plate heat exchanger according to the NTU method of
AShRAE 90.1
:param NTU: number of transfer units
:param cr: ratio between min and max capacity mass flow rates
:return:
eff: efficiency of heat exchange
'''
eff = 1 - scipy.exp((1 / cr) * (NTU ** 0.22) * (scipy.exp(-cr * (NTU) ** 0.78) - 1))
return eff