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


Python constants.physical_constants方法代码示例

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


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

示例1: darkcurrentnoise

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def darkcurrentnoise(inttime, detarea,temptr, Egap, DFM=0.5e-5):
    """Calculate the dark current noise given detector parameters

        Args:
            | inttime (scalar): integration time in seconds
            | detarea (scalar): detector area in m2
            | temptr (scalar): temperature in K
            | Egap (scalar):  bandgap in eV
            | DFM (scalar): in units of nA/m2
 
 
        Returns:
            | n (scalar): dark current noise as number of electrons 

        Raises:
            | No exception is raised.
    """

    keV = const.physical_constants['Boltzmann constant in eV/K'][0]
    ndarkcur = inttime * 2.55e15 * detarea * DFM * (temptr ** 1.5) * np.exp(-Egap/(2 * keV * temptr) )
    
    return np.sqrt(ndarkcur)

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

示例2: _eFieldCouplingDivE

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

示例3: absolute_permittivity

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def absolute_permittivity(self):
        r'''Absolute permittivity of the chemical at its current temperature,
        in units of [farad/meter]. Those units are equivalent to 
        ampere^2*second^4/kg/m^3.

        Examples
        --------
        >>> Chemical('water', T=293.15).absolute_permittivity
        7.096684821859018e-10
        '''
        permittivity = self.permittivity
        if permittivity is not None:
            return permittivity*physical_constants['electric constant'][0]
        return None 
开发者ID:CalebBell,项目名称:thermo,代码行数:16,代码来源:chemical.py

示例4: _prepare_kincalculation

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def _prepare_kincalculation(self, qz, hkl):
        """
        prepare kinematic calculation by calculating some helper values
        """
        rel = constants.physical_constants['classical electron radius'][0]
        rel *= 1e10
        k = self.exp.k0

        # determine q-inplane
        t = self.exp._transform
        ql0 = t(self.lstack[0].material.Q(*hkl))
        qinp = numpy.sqrt(ql0[0]**2 + ql0[1]**2)

        # calculate needed angles
        qv = numpy.asarray([t.inverse((ql0[0], ql0[1], q)) for q in qz])
        Q = numpy.linalg.norm(qv, axis=1)
        theta = numpy.arcsin(Q / (2 * k))
        domega = numpy.arctan2(qinp, qz)
        alphai, alphaf = (theta + domega, theta - domega)
        # calculate structure factors
        f = numpy.empty((len(self.lstack), len(qz)), dtype=numpy.complex)
        fhkl = numpy.empty(len(self.lstack), dtype=numpy.complex)
        for i, l in enumerate(self.lstack):
            m = l.material
            fhkl[i] = m.StructureFactor(m.Q(*hkl), en=self.energy) /\
                m.lattice.UnitCellVolume()
            f[i, :] = m.StructureFactorForQ(qv, en0=self.energy) /\
                m.lattice.UnitCellVolume()

        E = numpy.zeros(len(qz), dtype=numpy.complex)
        return rel, alphai, alphaf, f, fhkl, E, t 
开发者ID:dkriegner,项目名称:xrayutilities,代码行数:33,代码来源:models.py

示例5: set_photosensor_constants

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def set_photosensor_constants(strh5, initialise=True):
    r"""Defining the constants that are necessary for calculation of photon energy, dark current rate, etc.

     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
   """
    #Sensor material constants    
    if (initialise):
        strh5['rystare/material/Eg-eV'] = 0.  #bandgap still to be computed at at temperature 

    # band gap energy, [eV], Varshni equation
    strh5['rystare/material/Eg-eV'][...] = strh5['rystare/photondetector/varshni/Egap0'][()] - \
        (strh5['rystare/photondetector/varshni/varA'][()] * (strh5['rystare/photondetector/operatingtemperature'][()] ** 2)) /\
         (strh5['rystare/photondetector/varshni/varB'][()] + strh5['rystare/photondetector/operatingtemperature'][()])
    
    if (initialise):
        # do this always
        strh5['rystare/photondetector/darkcurrent/fixedPatternNoise/limitnegative'] = True # only used with 'Janesick-Gaussian' 

        #Fundamental constants
        strh5['rystare/constants/Boltzman-Constant-eV'] = const.physical_constants['Boltzmann constant in eV/K'][0] #Boltzman constant, [eV/K].
        strh5['rystare/constants/Boltzman-Constant-JK'] = const.physical_constants['Boltzmann constant'][0] #Boltzman constant, [J/K].
        strh5['rystare/constants/q'] = const.e # charge of an electron [C], coulomb

    return strh5

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

示例6: getRabiFrequency2

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def getRabiFrequency2(self,
                          n1, l1, j1, mj1,
                          n2, l2, j2, q,
                          electricFieldAmplitude,
                          s=0.5):
        """
            Returns a Rabi frequency for resonant excitation with a given
            electric field amplitude

            Args:
                n1,l1,j1,mj1 : state from which we are driving transition
                n2,l2,j2 : state to which we are driving transition
                q : laser polarization (-1,0,1 correspond to :math:`\\sigma^-`,
                    :math:`\\pi` and :math:`\\sigma^+` respectively)
                electricFieldAmplitude : amplitude of electric field
                    driving (V/m)
                s (float): optional, total spin angular momentum of state.
                    By default 0.5 for Alkali atoms.

            Returns:
                float:
                    Frequency in rad :math:`^{-1}`. If you want frequency
                    in Hz, divide by returned value by :math:`2\\pi`
        """
        mj2 = mj1 + q
        if abs(mj2) - 0.1 > j2:
            return 0
        dipole = self.getDipoleMatrixElement(n1, l1, j1, mj1,
                                             n2, l2, j2, mj2, q,
                                             s=s) *\
            C_e * physical_constants["Bohr radius"][0]
        freq = electricFieldAmplitude * abs(dipole) / hbar
        return freq 
开发者ID:nikolasibalic,项目名称:ARC-Alkali-Rydberg-Calculator,代码行数:35,代码来源:alkali_atom_functions.py

示例7: getC3term

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def getC3term(self, n, l, j, n1, l1, j1, n2, l2, j2, s=0.5):
        """
            C3 interaction term for the given two pair-states

            Calculates :math:`C_3` intaraction term for
                :math:`|n,l,j,n,l,j\\rangle \
                 \\leftrightarrow |n_1,l_1,j_1,n_2,l_2,j_2\\rangle`

            Args:
                n (int): principal quantum number
                l (int): orbital angular momenutum
                j (float): total angular momentum
                n1 (int): principal quantum number
                l1 (int): orbital angular momentum
                j1 (float): total angular momentum
                n2 (int): principal quantum number
                l2 (int): orbital angular momentum
                j2 (float): total angular momentum
                s (float): optional, total spin angular momentum of state.
                    By default 0.5 for Alkali atoms.

            Returns:
                float:  :math:`C_3 = \\frac{\\langle n,l,j |er\
                |n_1,l_1,j_1\\rangle \
                \\langle n,l,j |er|n_2,l_2,j_2\\rangle}{4\\pi\\varepsilon_0}`
                (:math:`h` Hz m :math:`{}^3`).
        """
        d1 = self.getRadialMatrixElement(n, l, j, n1, l1, j1, s=s)
        d2 = self.getRadialMatrixElement(n, l, j, n2, l2, j2, s=s)
        d1d2 = 1 / (4.0 * pi * epsilon_0) * d1 * d2 * C_e**2 *\
            (physical_constants["Bohr radius"][0])**2
        return d1d2 
开发者ID:nikolasibalic,项目名称:ARC-Alkali-Rydberg-Calculator,代码行数:34,代码来源:alkali_atom_functions.py

示例8: getZeemanEnergyShift

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def getZeemanEnergyShift(self, l, j, mj, magneticFieldBz, s=0.5):
        r"""
            Retuns linear (paramagnetic) Zeeman shift.

            :math:`\mathcal{H}_P=\frac{\mu_B B_z}{\hbar}(\hat{L}_{\rm z}+\
            g_{\rm S}S_{\rm z})`

            Args:
                l (int): orbital angular momentum
                j (float): total angular momentum
                mj (float): projection of total angular momentum alon z-axis
                magneticFieldBz (float): applied magnetic field (alon z-axis
                    only) in units of T (Tesla)
                s (float): optional, total spin angular momentum of state.
                    By default 0.5 for Alkali atoms.

            Returns:
                float: energy offset of the state (in J)
        """
        prefactor = physical_constants["Bohr magneton"][0] * magneticFieldBz
        gs = - physical_constants["electron g factor"][0]
        sumOverMl = 0

        for ml in np.linspace(mj - s, mj + s, round(2 * s + 1)):
            if abs(ml) <= l + 0.1:
                ms = mj - ml
                sumOverMl += (ml + gs * ms) * \
                    abs(CG(l, ml, s, ms, j, mj))**2
        return prefactor * sumOverMl 
开发者ID:nikolasibalic,项目名称:ARC-Alkali-Rydberg-Calculator,代码行数:31,代码来源:alkali_atom_functions.py

示例9: _atomLightAtomCoupling

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import physical_constants [as 别名]
def _atomLightAtomCoupling(n, l, j, nn, ll, jj, n1, l1, j1, n2, l2, j2,
                           atom1, atom2=None, s=0.5, s2=None):
    """
        Calculates radial part of atom-light coupling

        This function might seem redundant, since similar function exist for
        each of the atoms. Function that is not connected to specific
        atomic species is provided in order to provides route to implement
        inter-species coupling.
    """
    if atom2 is None:
        # if not explicitly inter-species, assume it's the same species
        atom2 = atom1
    if s2 is None:
        s2 = s

    # determine coupling
    dl = abs(l - l1)
    dj = abs(j - j1)
    c1 = 0
    if dl == 1 and (dj < 1.1):
        c1 = 1  # dipole couplings1
    elif (dl == 0 or dl == 2 or dl == 1) and(dj < 2.1):
        c1 = 2  # quadrupole coupling
    else:
        return False
    dl = abs(ll - l2)
    dj = abs(jj - j2)
    c2 = 0
    if dl == 1 and (dj < 1.1):
        c2 = 1  # dipole coupling
    elif (dl == 0 or dl == 2 or dl == 1) and(dj < 2.1):
        c2 = 2  # quadrupole coupling
    else:
        return False

    radial1 = atom1.getRadialCoupling(n, l, j, n1, l1, j1, s=s)
    radial2 = atom2.getRadialCoupling(nn, ll, jj, n2, l2, j2, s=s2)

    # TO-DO: check exponent of the Boht radius (from where it comes?!)

    coupling = C_e**2 / (4.0 * pi * epsilon_0) * radial1 * radial2 *\
        (physical_constants["Bohr radius"][0])**(c1 + c2)
    return coupling


# ================== Saving and loading calculations (START) ================== 
开发者ID:nikolasibalic,项目名称:ARC-Alkali-Rydberg-Calculator,代码行数:49,代码来源:alkali_atom_functions.py


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