当前位置: 首页>>代码示例>>Python>>正文


Python scipy.log方法代码示例

本文整理汇总了Python中scipy.log方法的典型用法代码示例。如果您正苦于以下问题:Python scipy.log方法的具体用法?Python scipy.log怎么用?Python scipy.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy的用法示例。


在下文中一共展示了scipy.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: calc_dTm_HEX

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def calc_dTm_HEX(thi, tho, tci, tco):
    '''
    This function estimates the logarithmic temperature difference between two streams

    :param thi: in temperature hot stream
    :param tho: out temperature hot stream
    :param tci: in temperature cold stream
    :param tco: out temperature cold stream
    :param flag: heat: when using for the heating case, 'cool' otherwise
    :return:
        dtm = logaritimic temperature difference
    '''
    dT1 = thi - tco
    dT2 = tho - tci
    if dT1 == dT2:
        dTm = dT1
    else:
        dTm = (dT1 - dT2) / scipy.log(dT1 / dT2)
    return abs(dTm.real) 
开发者ID:architecture-building-systems,项目名称:CityEnergyAnalyst,代码行数:21,代码来源:substation_matrix.py

示例2: calc_dTm_HEX

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def calc_dTm_HEX(thi, tho, tci, tco):
    '''
    This function estimates the logarithmic temperature difference between two streams

    :param thi: in temperature hot stream
    :param tho: out temperature hot stream
    :param tci: in temperature cold stream
    :param tco: out temperature cold stream
    :return:
        - dtm = logaritimic temperature difference

    '''
    dT1 = thi - tco
    dT2 = tho - tci if not isclose(tho, tci) else 0.0001  # to avoid errors with temperature changes < 0.001

    try:
        dTm = (dT1 - dT2) / scipy.log(dT1 / dT2)
    except ZeroDivisionError:
        raise Exception(thi, tco, tho, tci,
                        "Check the emission_system database, there might be a problem with the selection of nominal temperatures")

    return abs(dTm.real) 
开发者ID:architecture-building-systems,项目名称:CityEnergyAnalyst,代码行数:24,代码来源:substation.py

示例3: Regresion

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def Regresion(self):
        t=array(self.KEq_Tab.getColumn(0)[:-1])
        k=array(self.KEq_Tab.getColumn(1)[:-1])
        if len(t)>=4:
            if 4<=len(t)<8:
                inicio=r_[0, 0, 0, 0]
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T)
                resto=lambda par, T, k: k-f(par, T)
            else:
                inicio=r_[0, 0, 0, 0, 0, 0, 0, 0]
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T+par[4]*T**2+par[5]*T**3+par[6]*T**4+par[7]*T**5)
                resto=lambda par, T, k: k-f(par, T)

            ajuste=leastsq(resto,inicio,args=(t, k))
            kcalc=f(ajuste[0], t)
            error=(k-kcalc)/k*100
            self.KEq_Dat.setColumn(0, ajuste[0])
            self.KEq_Tab.setColumn(2, kcalc)
            self.KEq_Tab.setColumn(3, error)

            if ajuste[1] in [1, 2, 3, 4]:
                self.ajuste=ajuste[0] 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:24,代码来源:UI_reactor.py

示例4: h_tube_Condensation_Traviss

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def h_tube_Condensation_Traviss(fluid, Di, X):
    """ref Pag 558 Kakac: Boiler..."""
    G = fluid.caudalmasico*4/pi/Di**2
    Re = Di*G*(1-fluid.x)/fluid.Liquido.mu
    F1 = 0.15*(1/X+2.85*X**-0.476)
    if Re < 50:
        F2 = 0.707*fluid.Liquido.Prandt*Re
    elif Re < 1125:
        F2 = 5*fluid.Liquido.Prandt+5*log(1+fluid.Liquido.Prandt*(0.0964*Re**0.585-1))
    else:
        F2 = 5*fluid.Liquido.Prandt+5*log(1+5*fluid.Liquido.Prandt)+2.5*log(0.0031*Re**0.812)

    return fluid.Pr*Re**0.9*F1/F2


# Heat Exchanger design methods 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:18,代码来源:heatTransfer.py

示例5: _height

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [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) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:26,代码来源:psycrometry.py

示例6: _phi0

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def _phi0(self, tau, delta):
        """Contribución ideal de la energía libre de Helmholtz eq. 7.5"""
        fio = fiot = fiott = fiod = fiodd = fiodt = 0
        nfioni = []   # ðnao/ðni
        for i, componente in enumerate(self.comp):
            deltai = delta*self.rhoc/componente.rhoc
            taui = componente.Tc*tau/self.Tc
            fio_, fiot_, fiott_, fiod_, fiodd_, fiodt_ = componente._phi0(
                componente.GERG["cp"], taui, deltai)
            fio += self.xi[i]*(fio_+log(self.xi[i]))
            fiot += self.xi[i]*fiot_
            fiott += self.xi[i]*fiott_
            fiod += self.xi[i]*fiod_
            fiodd += self.xi[i]*fiodd_
            fiodt += self.xi[i]*fiodt_
            nfioni.append(fio_+1+log(self.xi[i]))
        return fio, fiot, fiott, fiod, fiodd, fiodt, nfioni 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:19,代码来源:gerg.py

示例7: _fug

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def _fug(self, Z, xi):
        rho=self.P.atm/Z/R_atml/self.T
        tita=[]
        for i in range(len(self.componente)):
            suma=0
            for j in range(len(self.componente)):
                suma+=xi[j]*(-self.Ao**0.5*self.Aoi[i]**0.5*(1-self.kij[i][j]) \
                                    -  self.Co**0.5*self.Coi[i]**0.5*(1-self.kij[i][j])**3/self.T**2 \
                                    + self.Do**0.5*self.Doi[i]**0.5*(1-self.kij[i][j])**4/self.T**3 \
                                    -  self.Eo**0.5*self.Eoi[i]**0.5*(1-self.kij[i][j])**5/self.T**4)
#                print suma
            lo=R_atml*self.T*log(rho*R_atml*self.T*xi[i]) \
                    + rho*(self.Bo+self.Boi[i])*R_atml*self.T \
                    + 2*rho*suma \
                    + rho**2/2*(3*(self.b**2*self.bi[i])**(1./3)*R_atml*self.T-3*(self.a**2*self.ai[i])**(1./3)-3*(self.d**2*self.di[i])**(1./3)/self.T) \
                    + self.alfa*rho**5/5*(3*(self.a**2*self.ai[i])**(1./3)+3*(self.d**2*self.di[i])**(1./3)/self.T) \
                    + 3*rho**5/5*(self.a+self.d/self.T)*(self.alfa**2*self.alfai[i])**(1./3) \
                    + 3*(self.c**2*self.ci[i])**(1./3)*rho**2/self.T**2*((1-exp(-self.gamma*rho**2))/self.gamma/rho**2-exp(-self.gamma*rho**2)/2) \
                    - (2*self.c*sqrt(self.gammai[i]/self.gamma)**0.5/self.gamma/self.T**2)*((1-exp(-self.gamma*rho**2))*(1+self.gamma*rho**2+self.gamma**2*rho**4/2))
            tita.append(exp(lo/R_atml/self.T))
        return tita 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:23,代码来源:BWRS.py

示例8: _physics

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [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) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:18,代码来源:virial.py

示例9: _fugacity

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [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 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:25,代码来源:cubic.py

示例10: _so

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def _so(self, T):
        r"""
        Ideal gas entropy, referenced in API procedure 7F2.1, pag 741

        .. math::
            S_m^o = \sum_i x_wS_i^o - \frac{R}{M} x_i\lnx_i

        Parameters
        ----------
        T : float
            Temperature, [K]
        """
        s = 0
        for x, xw, cmp in zip(
                self.fraccion, self.fraccion_masica, self.componente):
            s += xw*cmp._So(T) + R/cmp.M*x*log(x)
        return unidades.SpecificHeat(s) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:19,代码来源:mezcla.py

示例11: MuL_Parametric

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def MuL_Parametric(T, args):
    r"""Calculates liquid viscosity using a paremtric equation

    .. math::
        \log\mu = A\left(\frac{1}{T}-\frac{1}{B}\right)

    Parameters
    ----------
    T : float
        Temperature, [K]
    args : list
        Coefficients for equation

    Returns
    -------
    mu : float
        Liquid viscosity, [Pa·s]

    Notes
    -----
    The parameters for several compound are in database
    """
    A, B = args
    mu = 10**(A*(1/T-1/B))
    return unidades.Viscosity(mu, "cP") 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:27,代码来源:compuestos.py

示例12: _so

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def _so(self, T):
        r"""Ideal gas entropy calculation from polinomial coefficient of
        specific heat saved in database
        Coefficient in database are in the form [A,B,C,D,E,F]
        Explained in procedure 7A1.1, pag 543

        .. math::
            So = A \ln T + BT + C/2T^2 + D/3T^3 + E/4T^4 + F/5T^5

        Parameters
        ----------
        T : float
            Temperature, [K]

        Notes
        -----
        The units in the calculate ideal enthalpy are in cal/mol·K, the
        reference state is set to T=298.15K
        """
        A, B, C, D, E, F = self.cp
        so = A*log(T) + B*T + C/2*T**2 + D/3*T**3 + E/4*T**4 + F/5*T**5
        return unidades.SpecificHeat(so/self.M, "calgK")

    # Physical properties 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:26,代码来源:compuestos.py

示例13: M_Goossens

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def M_Goossens(Tb, d20):
    """Calculate petroleum fractions molecular weight with the Goossens
    (1971) correlation

    Parameters
    ------------
    Tb : float
        Normal boiling temperature, [K]
    d20 : float
        Liquid density at 20ºC and 1 atm, [g/cm³]

    Returns
    -------
    M: float
        Molecular weight, [-]

    Examples
    --------
    >>> "%.1f" % M_Goossens(306, 0.6258)["M"]
    '77.0'
    """
    b = 1.52869 + 0.06486*log(Tb/(1078-Tb))
    M = 0.01077*Tb**b/d20
    return {"M": unidades.Dimensionless(M)} 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:26,代码来源:petro.py

示例14: Viscosidad_liquido_blend

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def Viscosidad_liquido_blend(self, T, fraccion_masica, petro1, petro2):
        """Método de cálculo de la viscosidad de líquidos en mezclas de fracciones petrolíferas, API procedure 11A4.5, pag 1066
        Los parámetros petro tienen la estructura [T1,T2,mu1,mu2]"""
        #TODO: de momoento el procedimiento requiere como parámetros petro1 y petro2, matrices con cuatro elementos, dos temperaturas y sus correspondientes viscosidades, cuando se defina correctamente las fracciones petroliferas estos parámetros serán sustituidos por un simple id de fracción petrolífera
        t=unidades.Temperature(T)
        T1=unidades.Temperature(petro1[0])
        T2=unidades.Temperature(petro1[1])

        ml=(log(log(petro1[3]+0.7))-log(log(petro1[2]+0.7)))/(log(T2.R)-log(T1.R))
        bl=log(log(petro1[2]+0.7))-ml*log(T1.R)
        mh=(log(log(petro2[3]+0.7))-log(log(petro2[2]+0.7)))/(log(T2.R)-log(T1.R))
        bh=log(log(petro2[2]+0.7))-mh*log(T1.R)

        Tl=exp((log(log(petro2[2]+0.7))-bl)/ml)
        Tx=exp(fraccion_masica[0]*log(Tl)+fraccion_masica[1]*log(T1.R))
        Th=exp((log(log(petro1[3]+0.7))-bh)/mh)
        Ty=exp(fraccion_masica[0]*log(T2.R)+fraccion_masica[1]*log(Th))

        m=(log(log(petro1[3]+0.7))-log(log(petro2[2]+0.7)))/(log(Ty)-log(Tx))
        b=log(log(petro2[2]+0.7))-m*log(Tx)

        return exp(exp(m*log(t.R)+b))-0.7 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:24,代码来源:petro.py

示例15: binary_logloss

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import log [as 别名]
def binary_logloss(p, y):
    epsilon = 1e-15
    p = sp.maximum(epsilon, p)
    p = sp.minimum(1-epsilon, p)
    res = sum(y * sp.log(p) + sp.subtract(1, y) * sp.log(sp.subtract(1, p)))
    res *= -1.0/len(y)
    return res 
开发者ID:lllcho,项目名称:CAPTCHA-breaking,代码行数:9,代码来源:np_utils.py


注:本文中的scipy.log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。