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


Python constants.pi方法代码示例

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


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

示例1: entr_mixed

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def entr_mixed(x, s, shift, delta_0, act_s1, fit_param_fe):
    """
    Returns a fit function for entropies based on the arctan function and the dilute species model fit of SrFeOx
    (see docstring in Atanfit.entropy)
    :param x:               absolute delta
    :param s:               slope, measure for the preference of B species reduction over A species reduction
    :param shift:           constant entropy shift
    :param delta_0:         shift from absolute delta
    :return:                dS of solid solution at delta = x with delta_0
    """
    efe = entr_fe(x + delta_0, fit_param_fe)
    return (
        ((act_s1 * efe) / pi) * (pd.np.arctan((x - delta_0) * s) + pi / 2)
        + (1 - act_s1) * efe
        + shift
    ) 
开发者ID:materialsproject,项目名称:MPContribs,代码行数:18,代码来源:views.py

示例2: from_state_vector

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def from_state_vector(cls, r, v, body, ref_epoch=J2000):
        """Create orbit from given state vector."""
        elements = elements_from_state_vector(r, v, body.mu)

        self = cls(
            a=elements.a,
            e=elements.e,
            i=elements.i,
            raan=elements.raan,
            arg_pe=elements.arg_pe,
            M0=mean_anomaly_from_true(elements.e, elements.f),
            body=body,
            ref_epoch=ref_epoch)

        # Fix mean anomaly at epoch for new orbit and position.
        oldM0 = self.M0
        self.M0 = ou.mod(self.M - self.n * self.t, 2 * pi)
        assert self.M0 == oldM0

        return self 
开发者ID:RazerM,项目名称:orbital,代码行数:22,代码来源:elements.py

示例3: __init__

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def __init__(self, axes=None, num_points=100):
        if axes:
            self.fig = axes.get_figure()
        else:
            self.fig = plt.figure()
            axes = self.fig.add_subplot(111, projection='3d')
        self.axes = axes
        self.axes.set_xlabel("$x$ [km]")
        self.axes.set_ylabel("$y$ [km]")
        self.axes.set_zlabel("$z$ [km]")

        # These are used to fix aspect ratio of final plot.
        # See Plotter3D._force_aspect()
        self._coords_x = np.array(0)
        self._coords_y = np.array(0)
        self._coords_z = np.array(0)

        self.points_per_rad = num_points / (2 * pi) 
开发者ID:RazerM,项目名称:orbital,代码行数:20,代码来源:plotting.py

示例4: test_set_apside_altitudes

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def test_set_apside_altitudes(self):
        set_apocenter = SetApocenterAltitudeTo(1000 * kilo)
        self.LEO.propagate_anomaly_to(M=0)
        self.LEO.apply_maneuver(set_apocenter)
        self.assertAlmostEqual(
            self.LEO.apocenter_radius,
            self.LEO.body.mean_radius + set_apocenter.apocenter_altitude)
        self.assertTrue(self.LEO.e > 0)

        set_pericenter = SetPericenterAltitudeTo(150 * kilo)
        self.LEO.propagate_anomaly_to(M=pi)
        self.LEO.apply_maneuver(set_pericenter)
        self.assertAlmostEqual(
            self.LEO.pericenter_radius,
            self.LEO.body.mean_radius + set_pericenter.pericenter_altitude)
        self.assertAlmostEqual(
            self.LEO.apocenter_radius,
            self.LEO.body.mean_radius + set_apocenter.apocenter_altitude) 
开发者ID:RazerM,项目名称:orbital,代码行数:20,代码来源:test_maneuver.py

示例5: __plot__

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def __plot__(self, orbit, plotter, next_operation=None):
        if orbit.apocenter_radius > self.apocenter_radius:
            label = 'Lowered apocenter'
        else:
            label = 'Raised apocenter'
        self.__apply__(orbit)

        with saved_state(orbit):
            if (next_operation is not None and
                    isinstance(next_operation, TimeOperation)):
                orbit.apply_maneuver(next_operation)
                f2 = orbit.f
                if f2 == 0:
                    f2 = 2 * pi
            else:
                f2 = 2 * pi

        plotter._plot_orbit(orbit, f1=0, f2=f2, label=label) 
开发者ID:RazerM,项目名称:orbital,代码行数:20,代码来源:maneuver.py

示例6: velocity_delta

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def velocity_delta(self, orbit):
        with saved_state(orbit):
            if self.raise_pericenter:
                orbit.propagate_anomaly_to(M=pi)
                radius = orbit.apocenter_radius
            else:
                orbit.propagate_anomaly_to(M=0)
                radius = orbit.pericenter_radius

            old_velocity = orbit.v

            a, e = elements_for_apsides(radius, radius)
            orbit.a = a
            orbit.e = e

            new_velocity = orbit.v

            return new_velocity - old_velocity 
开发者ID:RazerM,项目名称:orbital,代码行数:20,代码来源:maneuver.py

示例7: shiftmp

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def shiftmp(freq, s11, shiftplanes):#{{{
    """ Adjusts the reflection phase like if the monitor planes were not centered.

    For symmetric metamaterial cell, this function is not needed. The symmetry requires that
    the monitor planes in front of and behind the mm cell are centered.

    However, for an asymmetric metamaterial, the correct position has to be found. Otherwise
    the Fresnel inversion gives negative imaginary part of N and/or negative real part of Z, which
    is quite spooky for passive medium. 
    
    Even such metamaterials, however, may be properly homogenized if we define the 
    position of monitor planes as a function of frequency. We can assume that:
    1) This optimum shift shall hold for all simulations with one or more unit cellnumber.
    2) When the wave direction is reversed (to get s21, s22 parameters), the shift should be negated.
    These rules should enable us to homogenize any asymmetric non-chiral metamaterial. 

    Note that this shifting is still an experimental technique and has to be tested out thoroughly. 
    """
    return np.array(s11) * np.exp(1j*np.array(shiftplanes)/(c/freq) * 2*pi * 2)
#}}} 
开发者ID:FilipDominec,项目名称:python-meep-utils,代码行数:22,代码来源:effparam.py

示例8: PerdidaPresion

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def PerdidaPresion(self):
        entrada = self.kwargs["entrada"]
        rhoS = entrada.solido.rho
        rhoG = entrada.Gas.rho
        QS = entrada.solido.caudal
        Q = entrada.caudalmasico

        if self.kwargs["modelo_DeltaP"] == 0:
            # Cinetic loss
            DeltaP = Pressure(self.kf/2.*rhoG*self.V**2)
        elif self.kwargs["modelo_DeltaP"] == 1:
            # Casal-Martinez-Benet
            DeltaP = Pressure(0.003*self.N*rhoG*self.V**2, "inH2O")
        elif self.kwargs["modelo_DeltaP"] == 2:
            # Leith-Licht
            DeltaP = Pressure(0.003*rhoG*16*(entrada.Q/self.num_ciclones)**2 /
                              self.De**2/self.Bc/self.Hc, "mmHg")
        else:
            # Sheferd, Lapple y Ter Linden
            Ae = self.Bc*self.Hc
            As = pi/4*self.De**2
            rhom = rhoG+QS/rhoG/(Q+QS/rhoG)*(rhoS-rhoG)
            DeltaP = Pressure(1.078*(Ae/As)**1.21*rhom*self.V**2, "mmH2O")
        return DeltaP 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:26,代码来源:gas_solid.py

示例9: velocidad_f_presion

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def velocidad_f_presion(self):
        entrada = self.kwargs["entrada"]
        rhoS = entrada.solido.rho
        rhoG = entrada.Gas.rho
        dP = self.DeltaPAdmisible
        QS = entrada.solido.caudal
        Q = entrada.caudalmasico

        if self.kwargs["modelo_DeltaP"] == 0:
            velocidad = sqrt(dP*2/self.kf/rhoG)
        elif self.kwargs["modelo_DeltaP"] == 1:
            velocidad = sqrt(dP.inH2O/self.N/0.003/rhoG)
        elif self.kwargs["modelo_DeltaP"] == 2:
            velocidad = sqrt(dP*self.De**2*self.Bc*self.Hc/0.003/rhoG/16)
        else:
            Ae = self.Bc*self.Hc
            As = pi/4*self.De**2
            rhom = rhoG+QS/rhoG/(Q+QS/rhoG)*(rhoS-rhoG)
            velocidad = sqrt(dP.mmH2O/1.078/(Ae/As)**1.21/rhom)
        return velocidad 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:22,代码来源:gas_solid.py

示例10: _visco0

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def _visco0(self, rho, T, fase=None):
        a = [17.67484, -2.78751, 311498.7, -48826500, 3938774000, -1.654629e11,
             2.86561e12]
        Tr = T/0.29944
        y = 0.68321*(a[0] + a[1]*log10(Tr) + a[2]/Tr**2 + a[3]/Tr**3 +
                     a[4]/Tr**4 + a[5]/Tr**5 + a[6]/Tr**6)
        nt = 266.93*(T*self.M)**0.5/y
        om = rho/1673.0
        c = [1.03010, -0.99175, 2.47127, -3.11864, 1.57066]
        b = [0.48148, -1.18732, 2.80277, -5.41058, 7.04779, -3.76608]
        sum1 = sum([ci*om**i for i, ci in enumerate(c)])
        sum2 = sum([bi*om**i for i, bi in enumerate(b)])
        sigma = 3.05e-10*(sum1-sum2*log10(T/122.1))
        br = 2.0/3.0*pi*Avogadro*sigma**3
        brho = rho/self.M*1000*br
        d = [1, 0.27676, 0.014355, 2.6480, -1.9643, 0.89161]
        nd = sum([di*brho**i for i, di in enumerate(d)])
        return unidades.Viscosity(nd*nt/100, "muPas") 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:20,代码来源:Ne.py

示例11: _areaFzFull

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def _areaFzFull(self):
        """
        area of z-faces prior to deflation
        """
        if self.isSymmetric:
            return np.kron(
                    np.ones_like(self.vectorNz), pi*(
                        self.vectorNx**2 -
                        np.r_[0, self.vectorNx[:-1]]**2
                    )
            )
        return np.kron(
            np.ones(self._ntNz), np.kron(
                self.hy,
                0.5 * (self.vectorNx[1:]**2 - self.vectorNx[:-1]**2)
            )
        ) 
开发者ID:simpeg,项目名称:discretize,代码行数:19,代码来源:CylMesh.py

示例12: get_interaction_constant

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def get_interaction_constant(accelerating_voltage):
    """Calculates the interaction constant, sigma, for a given
    acelerating voltage.

    Parameters
    ----------
    accelerating_voltage : float
        The accelerating voltage in V.

    Returns
    -------
    sigma : float
        The relativistic electron wavelength in m.

    """
    E = accelerating_voltage
    wavelength = get_electron_wavelength(accelerating_voltage)
    sigma = 2 * pi * (m_e + e * E)

    return sigma 
开发者ID:pyxem,项目名称:diffsims,代码行数:22,代码来源:sim_utils.py

示例13: enth_arctan

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def enth_arctan(x, dh_max, dh_min, t, s):
    """
    arctan function to fit enthalpy values of solid solutions
    :param x:       Delta_delta, change in non-stoichiometric redox extent vs. a reference
    :param t:       transition point; x value at which the reaction enthalpy of the solid solution
                    is exactly the average of dh_max and dh_min
    :param s:       slope, measure for the preference of B species reduction over A species reduction
    """
    return (((dh_max - dh_min) / pi) * (pd.np.arctan((x - t) * s) + (pi / 2))) + dh_min 
开发者ID:materialsproject,项目名称:MPContribs,代码行数:11,代码来源:views.py

示例14: epoch

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def epoch(self, value):
        """Set epoch, adjusting current mean anomaly (from which
        other anomalies are calculated).
        """
        t = (value - self.ref_epoch).sec
        self._M = self.M0 + self.n * t
        self._M = ou.mod(self._M, 2 * pi)
        self._t = t 
开发者ID:RazerM,项目名称:orbital,代码行数:10,代码来源:elements.py

示例15: t

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import pi [as 别名]
def t(self, value):
        """Set time since ref_epoch, adjusting current mean anomaly (from which
        other anomalies are calculated).
        """
        self._M = self.M0 + self.n * value
        self._M = ou.mod(self._M, 2 * pi)
        self._t = value 
开发者ID:RazerM,项目名称:orbital,代码行数:9,代码来源:elements.py


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