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


Python constants.e方法代码示例

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


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

示例1: eVtoJoule

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def eVtoJoule(EeV):
    """
    Convert energy in eV to Joule.

    Args:
        | E: Energy in eV

    Returns:
        | EJ: Energy in J
    """

    return EeV * const.e


################################################################################
# 
开发者ID:NelisW,项目名称:pyradi,代码行数:18,代码来源:rydetector.py

示例2: JouleTeEv

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def JouleTeEv(EJ):
    """
    Convert energy in Joule to eV.

    Args:
        | EJ: Energy in J

    Returns:
        | EeV: Energy in eV
    """

    return EJ / const.e




################################################################################
# 
开发者ID:NelisW,项目名称:pyradi,代码行数:20,代码来源:rydetector.py

示例3: Responsivity

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def Responsivity(wavelength, quantumEffic):
    """
    Responsivity quantifies the amount of output seen per watt of radiant
    optical power input [1]. But, for this application it is interesting to
    define spectral responsivity that is the output per watt of monochromatic
    radiation.

    The model used here is based on Equations 7.114 in Dereniak's book.

    Args:
        | wavelength: spectral variable [m]
        | quantumEffic: spectral quantum efficiency

    Returns:
        | responsivity in [A/W]
    """

    return (const.e * wavelength * quantumEffic) / (const.h * const.c)


################################################################################
# 
开发者ID:NelisW,项目名称:pyradi,代码行数:24,代码来源:rydetector.py

示例4: _eFieldCouplingDivE

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def _eFieldCouplingDivE(self, n1, l1, j1, mj1, n2, l2, j2, mj2, s=0.5):
        # eFied coupling devided with E (witout actuall multiplication to getE)
        # delta(mj1,mj2') delta(l1,l2+-1)
        if ((abs(mj1 - mj2) > 0.1) or (abs(l1 - l2) != 1)):
            return 0

        # matrix element
        result = self.atom.getRadialMatrixElement(n1, l1, j1,
                                                  n2, l2, j2,
                                                  s=s) *\
            physical_constants["Bohr radius"][0] * C_e

        sumPart = self.eFieldCouplingSaved.getAngular(l1, j1, mj1,
                                                      l2, j2, mj2,
                                                      s=s)
        return result * sumPart 
开发者ID:nikolasibalic,项目名称:ARC-Alkali-Rydberg-Calculator,代码行数:18,代码来源:calculations_atom_single.py

示例5: plotSpectre

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def plotSpectre(transitions, eneval, spectre):
    """ plot the UV-visible spectrum using matplotlib. Absissa are converted in nm. """

    # lambda in nm
    lambdaval = [cst.h * cst.c / (val * cst.e) * 1.e9 for val in eneval]

    # plot gaussian spectra
    plt.plot(lambdaval, spectre, "r-", label = "spectre")

    # plot transitions
    plt.vlines([val[1] for val in transitions], \
               0., \
               [val[2] for val in transitions], \
               color = "blue", \
               label = "transitions" )

    plt.xlabel("lambda   /   nm")
    plt.ylabel("Arbitrary unit")
    plt.title("UV-visible spectra")
    plt.grid()
    plt.legend(fancybox = True, shadow = True)
    plt.show() 
开发者ID:gVallverdu,项目名称:myScripts,代码行数:24,代码来源:spectre.py

示例6: get_electron_wavelength

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def get_electron_wavelength(accelerating_voltage):
    """Calculates the (relativistic) electron wavelength in Angstroms for a
    given accelerating voltage in kV.

    Parameters
    ----------
    accelerating_voltage : float or 'inf'
        The accelerating voltage in kV. Values `numpy.inf` and 'inf' are
        also accepted.

    Returns
    -------
    wavelength : float
        The relativistic electron wavelength in Angstroms.

    """
    if accelerating_voltage in (np.inf, "inf"):
        return 0
    E = accelerating_voltage * 1e3
    wavelength = (
        h / math.sqrt(2 * m_e * e * E * (1 + (e / (2 * m_e * c * c)) * E)) * 1e10
    )
    return wavelength 
开发者ID:pyxem,项目名称:diffsims,代码行数:25,代码来源:sim_utils.py

示例7: get_interaction_constant

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [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

示例8: calcularRendimientos_parciales

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def calcularRendimientos_parciales(self, A):
        """Calculate the separation efficiency per diameter"""
        entrada = self.kwargs["entrada"]
        rendimiento_parcial = []
        for dp in entrada.solido.diametros:
            if dp <= 1e-6:
                q = dp*e*1e8
            else:
                q = pi*epsilon_0*self.potencialCarga*dp**2 * \
                    (1+2*(self.epsilon-1.)/(self.epsilon+2.))
            U = q*self.potencialDescarga/(3*pi*dp*entrada.Gas.mu)
            rendimiento_parcial.append(Dimensionless(1-exp(-U*A/entrada.Q)))
        return rendimiento_parcial 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:15,代码来源:gas_solid.py

示例9: __init__

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def __init__(self):
        self.n = 2
        f = 1000000      # f is a scalar, it's the trap frequency
        self.w = 2 * pi * f
        self.C = (4 * pi * constants.epsilon_0) ** (-1) * constants.e ** 2
        # C is a scalar, it's the I
        self.m = 39.96 * 1.66e-27 
开发者ID:pbrod,项目名称:numdifftools,代码行数:9,代码来源:hamiltonian.py

示例10: Absorption

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def Absorption(wavelength, Eg, tempDet, a0, a0p):
    """
    Calculate the spectral absorption coefficient
    for a semiconductor material with given material values.

    The model used here is based on Equations 3.5, 3.6 in Dereniaks book.

    Args:
        | wavelength: spectral variable [m]
        | Eg: bandgap energy [Ev]
        | tempDet: detector's temperature in [K]
        | a0: absorption coefficient [m-1] (Dereniak Eq 3.5 & 3.6)
        | a0p:  absorption coefficient in [m-1] (Dereniak Eq 3.5 & 3.6)

    Returns:
        | absorption: spectral absorption coefficient in [m-1]
    """

    #frequency/wavelength expressed as energy in Ev
    E = const.h * const.c / (wavelength * const.e )

    # the np.abs() in the following code is to prevent nan and inf values
    # the effect of the abs() is corrected further down when we select
    # only the appropriate values based on E >= Eg and E < Eg

    # Absorption coef - eq. 3.5- Dereniak
    a35 = (a0 * np.sqrt(np.abs(E - Eg))) + a0p
    # Absorption coef - eq. 3.6- Dereniak
    a36 = a0p * np.exp((- np.abs(E - Eg)) / (const.k * tempDet))
    absorption = a35 * (E >= Eg) + a36 * (E < Eg)

    return absorption

################################################################################
# 
开发者ID:NelisW,项目名称:pyradi,代码行数:37,代码来源:rydetector.py

示例11: stefanboltzman

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def stefanboltzman(temperature, type='e'):
    """Stefan-Boltzman wideband integrated exitance.

    Calculates the total Planck law exitance, integrated over all wavelengths,
    from a surface at the stated temperature. Exitance can be given in radiant or
    photon rate units, depending on user input in type.

    Args:
        | (scalar, list[M], np.array (M,), (M,1) or (1,M)):  Temperature in [K]
        | type (string):  'e' for radiant or 'q' for photon rate exitance.

    Returns:
        | (float): integrated radiant exitance in  [W/m^2] or [q/(s.m^2)].
        | Returns a -1 if the type is not 'e' or 'q'

    Raises:
        | No exception is raised.
    """

    #confirm that only vector is used, break with warning if so.
    if isinstance(temperature, np.ndarray):
        if len(temperature.flat) != max(temperature.shape):
            print('ryplanck.stefanboltzman: temperature must be of shape (M,), (M,1) or (1,M)')
            return -1

    tempr = np.asarray(temperature).astype(float)
    #use dictionary to switch between options, lambda fn to calculate, default -1
    rtnval = {
              'e': lambda temp: pconst.sigmae * np.power(temp, 4) ,
              'q': lambda temp: pconst.sigmaq * np.power(temp, 3)
              }.get(type, lambda temp: -1)(tempr)
    return rtnval



################################################################
##
# dictionaries to allow case-like statements in generic planck functions, below. 
开发者ID:NelisW,项目名称:pyradi,代码行数:40,代码来源:ryplanck.py

示例12: planck

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def planck(spectral, temperature, type='el'):
    """Planck law spectral exitance.

    Calculates the Planck law spectral exitance from a surface at the stated 
    temperature. Temperature can be a scalar, a list or an array. Exitance can 
    be given in radiant or photon rate units, depending on user input in type.

    Args:
        | spectral (scalar, np.array (N,) or (N,1)):  spectral vector.
        | temperature (scalar, list[M], np.array (M,), (M,1) or (1,M)):  Temperature in [K]
        | type (string):
        |  'e' signifies Radiant values in [W/m^2.*].
        |  'q' signifies photon rate values  [quanta/(s.m^2.*)].
        |  'l' signifies wavelength spectral vector  [micrometer].
        |  'n' signifies wavenumber spectral vector [cm-1].
        |  'f' signifies frequency spectral vecor [Hz].

    Returns:
        | (scalar, np.array[N,M]):  spectral radiant exitance (not radiance) in units selected.
        | For type = 'el' units will be [W/(m^2.um)].
        | For type = 'qf' units will be [q/(s.m^2.Hz)].
        | Other return types are similarly defined as above.
        | Returns None on error.

    Raises:
        | No exception is raised, returns None on error.
    """
    if type in list(plancktype.keys()):
        #select the appropriate fn as requested by user
        exitance = plancktype[type](spectral, temperature)
    else:
        # return all minus one if illegal type
        exitance = None

    return exitance


################################################################
## 
开发者ID:NelisW,项目名称:pyradi,代码行数:41,代码来源:ryplanck.py

示例13: dplanck

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def dplanck(spectral, temperature, type='el'):
    """Temperature derivative of Planck law exitance.

    Calculates the temperature derivative for Planck law spectral exitance
    from a surface at the stated temperature. dM/dT can be given in radiant or
    photon rate units, depending on user input in type. Temperature can be a 
    scalar, a list or an array. 

    Args:
        | spectral (scalar, np.array (N,) or (N,1)):  spectral vector in  [micrometer], [cm-1] or [Hz].
        | temperature (scalar, list[M], np.array (M,), (M,1) or (1,M)):  Temperature in [K]
        | type (string):
        |  'e' signifies Radiant values in [W/(m^2.K)].
        |  'q' signifies photon rate values  [quanta/(s.m^2.K)].
        |  'l' signifies wavelength spectral vector  [micrometer].
        |  'n' signifies wavenumber spectral vector [cm-1].
        |  'f' signifies frequency spectral vecor [Hz].

    Returns:
        | (scalar, np.array[N,M]):  spectral radiant exitance (not radiance) in units selected.
        | For type = 'el' units will be [W/(m2.um.K)]
        | For type = 'qf' units will be [q/(s.m2.Hz.K)]
        | Other return types are similarly defined as above.
        | Returns None on error.

    Raises:
        | No exception is raised, returns None on error.
    """

    if type in list(dplancktype.keys()):
        #select the appropriate fn as requested by user
        exitance = dplancktype[type](spectral, temperature)
    else:
        # return all zeros if illegal type
        exitance = - np.ones(spectral.shape)

    return exitance


################################################################
## 
开发者ID:NelisW,项目名称:pyradi,代码行数:43,代码来源:ryplanck.py

示例14: multiply_detector_area

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def multiply_detector_area(strh5):
    r"""This routine multiplies  detector area

    The input to the model of the photosensor is assumed to be a matrix :math:`E_{q}\in R^{N\times M}` 
    that has been converted to electronrate irradiance, corresponding to electron rate  [e/(m2.s)].  
    The electron rate irriance is converted to electron rate into the pixel by accounting for 
    detector area:

    :math:`\Phi_{q}  =  \textrm{round} \left(  E_{q} \cdot P_A    \right),`

    where :math:`P_A` is the area of a pixel [m2].
     
     Args:
        | strh5 (hdf5 file): hdf5 file that defines all simulation parameters
 
    Returns:
         | in strh5: (hdf5 file) updated data fields

    Raises:
        | No exception is raised.

    Author: Mikhail V. Konnik, revised/ported by CJ Willers

    Original source: http://arxiv.org/pdf/1412.4031.pdf
    """


    # calculate radiant flux [W] from irradiance [W/m^2] and area
    strh5['rystare/signal/electronRate'][...]  = strh5['rystare/detectorArea'][()] * strh5['rystare/signal/electronRateIrradiance'][()] 

    return strh5

###################################################################################################### 
开发者ID:NelisW,项目名称:pyradi,代码行数:35,代码来源:rystare.py

示例15: multiply_integration_time

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import e [as 别名]
def multiply_integration_time(strh5):
    r"""This routine multiplies with integration time
     
    The input to the model of the photosensor is assumed to be a matrix :math:`E_{q}\in R^{N\times M}` 
    that has been converted to electrons, corresponding to electron rate  [e/s].  
    The electron rate is converted to electron count into the pixel by accounting for 
    detector integration time:

    :math:`\Phi_{q}  =  \textrm{round} \left(  E_{q} \cdot t_I  \right),`

    where :math:`t_{I}` is integration     (exposure) time.

     Args:
        | strh5 (hdf5 file): hdf5 file that defines all simulation parameters
 
    Returns:
         | in strh5: (hdf5 file) updated data fields

    Raises:
        | No exception is raised.

    Author: Mikhail V. Konnik, revised/ported by CJ Willers

    Original source: http://arxiv.org/pdf/1412.4031.pdf
    """

    #the number of electrons accumulated during the integration time  (rounded).
    strh5['rystare/signal/lightelectronsnoshotnoise'][...] = np.round(strh5['rystare/signal/electronRate'][()] * strh5['rystare/photondetector/integrationtime'][()])

    return strh5

###################################################################################################### 
开发者ID:NelisW,项目名称:pyradi,代码行数:34,代码来源:rystare.py


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