當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。