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


Python constants.speed_of_light方法代码示例

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


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

示例1: lorentz

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def lorentz(keV):
    """
    Relativistic factor :math:`\gamma`, defined as :math:`\gamma = \\frac{1}{\sqrt{1 - v^2/c^2}}`

    Parameters
    ----------
    keV : array_like or float
        Electron energy [keV].
    
    Returns
    -------
    out : array_like or float

    References
    ----------
    .. Kirkland 2010 Eq. 2.2
    """
    return 1 + (elementary_charge * keV * 1e3) / (electron_mass * speed_of_light ** 2) 
开发者ID:LaurentRDC,项目名称:scikit-ued,代码行数:20,代码来源:eproperties.py

示例2: test_lambda_to_nu

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def test_lambda_to_nu():
    assert_equal(sc.lambda2nu(sc.speed_of_light), 1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:test_constants.py

示例3: test_nu_to_lambda

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def test_nu_to_lambda():
    assert_equal(sc.nu2lambda(1), sc.speed_of_light) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:test_constants.py

示例4: acceleration_voltage_to_wavelength

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def acceleration_voltage_to_wavelength(acceleration_voltage):
    """Get electron wavelength from the acceleration voltage.

    Parameters
    ----------
    acceleration_voltage : float or array-like
        In Volt

    Returns
    -------
    wavelength : float or array-like
        In meters

    Examples
    --------
    >>> import pixstem.diffraction_tools as dt
    >>> acceleration_voltage = 200000  # 200 kV (in Volt)
    >>> wavelength = dt.acceleration_voltage_to_wavelength(
    ...     acceleration_voltage)
    >>> wavelength_picometer = wavelength*10**12

    """
    E = acceleration_voltage * sc.elementary_charge
    h = sc.Planck
    m0 = sc.electron_mass
    c = sc.speed_of_light
    wavelength = h / (2 * m0 * E * (1 + (E / (2 * m0 * c ** 2)))) ** 0.5
    return wavelength 
开发者ID:pyxem,项目名称:pyxem,代码行数:30,代码来源:diffraction_tools.py

示例5: acceleration_voltage_to_velocity

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def acceleration_voltage_to_velocity(acceleration_voltage):
    """Get relativistic velocity of electron from acceleration voltage.

    Parameters
    ----------
    acceleration_voltage : float
        In Volt

    Returns
    -------
    v : float
        In m/s

    Example
    -------
    >>> import pyxem.utils.dpc_utils as dpct
    >>> v = dpct.acceleration_voltage_to_velocity(200000) # 200 kV
    >>> round(v)
    208450035

    """
    c = sc.speed_of_light
    av = acceleration_voltage
    e = sc.elementary_charge
    me = sc.electron_mass
    part1 = (1 + (av * e) / (me * c ** 2)) ** 2
    v = c * (1 - (1 / part1)) ** 0.5
    return v 
开发者ID:pyxem,项目名称:pyxem,代码行数:30,代码来源:dpc_utils.py

示例6: acceleration_voltage_to_relativistic_mass

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def acceleration_voltage_to_relativistic_mass(acceleration_voltage):
    """Get relativistic mass of electron as function of acceleration voltage.

    Parameters
    ----------
    acceleration_voltage : float
        In Volt

    Returns
    -------
    mr : float
        Relativistic electron mass

    Example
    -------
    >>> import pyxem.utils.dpc_utils as dpct
    >>> mr = dpct.acceleration_voltage_to_relativistic_mass(200000) # 200 kV

    """
    av = acceleration_voltage
    c = sc.speed_of_light
    v = acceleration_voltage_to_velocity(av)
    me = sc.electron_mass
    part1 = 1 - (v ** 2) / (c ** 2)
    mr = me / (part1) ** 0.5
    return mr 
开发者ID:pyxem,项目名称:pyxem,代码行数:28,代码来源:dpc_utils.py

示例7: electron_wavelength

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def electron_wavelength(keV):
    """ 
    Relativistic wavelength :math:`\lambda` of an accelerated electron.

    .. math::

        \lambda = \\frac{h}{\sqrt{2 m_e e V}}\gamma
    
    where :math:`\gamma` is the relativistic Lorentz factor.
        
    Parameters
    ----------
    keV : array_like or float
        Electron energy [keV].
    
    Returns
    -------
    out : array_like or float
        Electron wavelength [:math:`Å^{-1}`]

    References
    ----------
    .. Kirkland 2010 Eq. 2.5
    """
    eV = elementary_charge * keV * 1e3
    wavelength_meters = (
        Planck
        * speed_of_light
        / np.sqrt(eV * (2 * electron_mass * speed_of_light ** 2 + eV))
    )
    return wavelength_meters * 1e10  # wavelength in angstroms 
开发者ID:LaurentRDC,项目名称:scikit-ued,代码行数:33,代码来源:eproperties.py

示例8: electron_velocity

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def electron_velocity(keV):
    """
    Relativistic velocity :math:`v_e` of an accelerated electron.

    .. math::

        \\frac{v_e}{c} = \sqrt{1 - \\frac{m_0 c^2}{m_0 c^2 + e V}}

    Parameters
    ----------
    keV : array_like or float
        Electron energy [keV].
    
    Returns
    -------
    out : array_like or float
        Electron velocity [:math:`Å / s`]

    References
    ----------
    .. Kirkland 2010 Eq. 2.3
    """
    eV = elementary_charge * keV * 1e3
    m0c2 = electron_mass * speed_of_light ** 2
    v_over_c = np.sqrt(eV * (eV + 2 * m0c2)) / (m0c2 + eV)
    return (speed_of_light * v_over_c) * 1e10  # speed in Angstroms 
开发者ID:LaurentRDC,项目名称:scikit-ued,代码行数:28,代码来源:eproperties.py

示例9: interaction_parameter

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def interaction_parameter(keV):
    """
    Interaction parameter from relativistic electron wavelength.

    Parameters
    ----------
    keV : array_like or float
        Electron energy [keV].
    
    Returns
    -------
    out : array_like or float
        Interaction parameter [:math:`rad/(V Å)`]

    References
    ----------
    .. Kirkland 2010 Eq. 5.6
    """
    l = electron_wavelength(keV)
    V = keV * 1e3

    return (
        (2 * np.pi)
        / (electron_wavelength(keV) * V)
        * (electron_mass * speed_of_light ** 2 + elementary_charge * V)
        / (2 * electron_mass * speed_of_light ** 2 + elementary_charge * V)
    ) 
开发者ID:LaurentRDC,项目名称:scikit-ued,代码行数:29,代码来源:eproperties.py

示例10: test_limits

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def test_limits(self):
        """ Test that the electron velocity never exceeds the speed of light. """
        c = speed_of_light * 1e10  # Speed of light in Ang/s
        self.assertEqual(electron_velocity(1e20) / c, 1) 
开发者ID:LaurentRDC,项目名称:scikit-ued,代码行数:6,代码来源:test_eproperties.py

示例11: _derive_rma_rmat

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def _derive_rma_rmat(self, RMA, GeoData, RadarCollection, ImageFormation):
        """

        Parameters
        ----------
        RMA : sarpy.io.complex.sicd_elements.RMA.RMAType
        GeoData : sarpy.io.complex.sicd_elements.GeoData.GeoDataType
        RadarCollection : sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType
        ImageFormation : sarpy.io.complex.sicd_elements.ImageFormation.ImageFormationType

        Returns
        -------
        None
        """

        if RMA.RMAT is None:
            return

        if self.ImagePlane is None:
            self.ImagePlane = 'SLANT'
        if self.Type is None:
            self.Type = 'XCTYAT'

        if self.Row.UVectECF is None and self.Col.UVectECF is None:
            params = self._derive_unit_vector_params(GeoData, RMA.RMAT)
            if params is not None:
                SCP, upos_ref, uvel_ref, uLOS, left, look = params
                uYAT = -look*uvel_ref
                uSPZ = numpy.cross(uLOS, uYAT)
                uSPZ /= norm(uSPZ)
                uXCT = numpy.cross(uYAT, uSPZ)
                self.Row.UVectECF = XYZType.from_array(uXCT)
                self.Col.UVectECF = XYZType.from_array(uYAT)

        center_frequency = _get_center_frequency(RadarCollection, ImageFormation)
        if center_frequency is not None and RMA.RMAT.DopConeAngRef is not None:
            if self.Row.KCtr is None:
                self.Row.KCtr = (2*center_frequency/speed_of_light)*numpy.sin(numpy.deg2rad(RMA.RMAT.DopConeAngRef))
            if self.Col.KCtr is None:
                self.Col.KCtr = (2*center_frequency/speed_of_light)*numpy.cos(numpy.deg2rad(RMA.RMAT.DopConeAngRef)) 
开发者ID:ngageoint,项目名称:sarpy,代码行数:42,代码来源:Grid.py

示例12: _derive_rma_rmcr

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def _derive_rma_rmcr(self, RMA, GeoData, RadarCollection, ImageFormation):
        """

        Parameters
        ----------
        RMA : sarpy.io.complex.sicd_elements.RMA.RMAType
        GeoData : sarpy.io.complex.sicd_elements.GeoData.GeoDataType
        RadarCollection : sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType
        ImageFormation : sarpy.io.complex.sicd_elements.ImageFormation.ImageFormationType

        Returns
        -------
        None
        """

        if RMA.RMCR is None:
            return

        if self.ImagePlane is None:
            self.ImagePlane = 'SLANT'
        if self.Type is None:
            self.Type = 'XRGYCR'

        if self.Row.UVectECF is None and self.Col.UVectECF is None:
            params = self._derive_unit_vector_params(GeoData, RMA.RMAT)
            if params is not None:
                SCP, upos_ref, uvel_ref, uLOS, left, look = params
                uXRG = uLOS
                uSPZ = look*numpy.cross(uvel_ref, uXRG)
                uSPZ /= norm(uSPZ)
                uYCR = numpy.cross(uSPZ, uXRG)
                self.Row.UVectECF = XYZType.from_array(uXRG)
                self.Col.UVectECF = XYZType.from_array(uYCR)

        center_frequency = _get_center_frequency(RadarCollection, ImageFormation)
        if center_frequency is not None:
            if self.Row.KCtr is None:
                self.Row.KCtr = 2*center_frequency/speed_of_light
            if self.Col.KCtr is None:
                self.Col.KCtr = 2*center_frequency/speed_of_light 
开发者ID:ngageoint,项目名称:sarpy,代码行数:42,代码来源:Grid.py

示例13: _get_grid_row

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def _get_grid_row(self):
        """
        Gets the Grid.Row metadata.

        Returns
        -------
        DirParamType
        """

        center_freq = self._get_center_frequency()
        if self.generation == 'RS2':
            row_ss = float(self._find('./imageAttributes'
                                      '/rasterAttributes'
                                      '/sampledPixelSpacing').text)
        elif self.generation == 'RCM':
            row_ss = float(self._find('./imageReferenceAttributes'
                                      '/rasterAttributes'
                                      '/sampledPixelSpacing').text)
        else:
            raise ValueError('unhandled generation {}'.format(self.generation))

        row_irbw = 2*float(self._find('./imageGenerationParameters'
                                      '/sarProcessingInformation'
                                      '/totalProcessedRangeBandwidth').text)/speed_of_light
        row_wgt_type = WgtTypeType(WindowName=self._find('./imageGenerationParameters'
                                                         '/sarProcessingInformation'
                                                         '/rangeWindow/windowName').text.upper())
        if row_wgt_type.WindowName == 'KAISER':
            row_wgt_type.Parameters = {'BETA': self._find('./imageGenerationParameters'
                                                          '/sarProcessingInformation'
                                                          '/rangeWindow/windowCoefficient').text}
        return DirParamType(
            SS=row_ss, ImpRespBW=row_irbw, Sgn=-1, KCtr=2*center_freq/speed_of_light,
            DeltaKCOAPoly=Poly2DType(Coefs=((0,),)), WgtType=row_wgt_type) 
开发者ID:ngageoint,项目名称:sarpy,代码行数:36,代码来源:radarsat.py

示例14: _derive_pfa

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def _derive_pfa(self, GeoData, RadarCollection, ImageFormation, Position, PFA):
        """
        Expected to be called by SICD parent.

        Parameters
        ----------
        GeoData : sarpy.io.complex.sicd_elements.GeoData.GeoDataType
        RadarCollection : sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType
        ImageFormation : sarpy.io.complex.sicd_elements.ImageFormation.ImageFormationType
        Position : sarpy.io.complex.sicd_elements.Position.PositionType
        PFA : sarpy.io.complex.sicd_elements.PFA.PFAType

        Returns
        -------
        None
        """

        if self.Type is None:
            self.Type = 'RGAZIM'  # the natural result for PFA

        if PFA is None:
            return  # nothing to be done
        if GeoData is None or GeoData.SCP is None:
            return  # nothing to be done

        SCP = GeoData.SCP.ECF.get_array()

        if Position is not None and Position.ARPPoly is not None \
                and PFA.PolarAngRefTime is not None:
            polar_ref_pos = Position.ARPPoly(PFA.PolarAngRefTime)
        else:
            polar_ref_pos = SCP

        if PFA.IPN is not None and PFA.FPN is not None and \
                self.Row.UVectECF is None and self.Col.UVectECF is None:
            ipn = PFA.IPN.get_array()
            fpn = PFA.FPN.get_array()

            dist = numpy.dot((SCP - polar_ref_pos), ipn) / numpy.dot(fpn, ipn)
            ref_pos_ipn = polar_ref_pos + (dist * fpn)
            uRG = SCP - ref_pos_ipn
            uRG /= norm(uRG)
            uAZ = numpy.cross(ipn, uRG)  # already unit
            self.Row.UVectECF = XYZType.from_array(uRG)
            self.Col.UVectECF = XYZType.from_array(uAZ)

        if self.Col is not None and self.Col.KCtr is None:
            self.Col.KCtr = 0  # almost always 0 for PFA

        if self.Row is not None and self.Row.KCtr is None:
            center_frequency = _get_center_frequency(RadarCollection, ImageFormation)
            if PFA.Krg1 is not None and PFA.Krg2 is not None:
                self.Row.KCtr = 0.5*(PFA.Krg1 + PFA.Krg2)
            elif center_frequency is not None and PFA.SpatialFreqSFPoly is not None:
                # APPROXIMATION: may not be quite right, due to rectangular inscription loss in PFA.
                self.Row.KCtr = 2*center_frequency/speed_of_light + PFA.SpatialFreqSFPoly.Coefs[0] 
开发者ID:ngageoint,项目名称:sarpy,代码行数:58,代码来源:Grid.py

示例15: _derive_rma_inca

# 需要导入模块: from scipy import constants [as 别名]
# 或者: from scipy.constants import speed_of_light [as 别名]
def _derive_rma_inca(self, RMA, GeoData, Position):
        """

        Parameters
        ----------
        RMA : sarpy.io.complex.sicd_elements.RMA.RMAType
        GeoData : sarpy.io.complex.sicd_elements.GeoData.GeoDataType
        Position : sarpy.io.complex.sicd_elements.Position.PositionType

        Returns
        -------
        None
        """

        if RMA.INCA is None:
            return

        if self.Type is None:
            self.Type = 'RGZERO'

        if RMA.INCA.TimeCAPoly is not None and Position is not None and Position.ARPPoly is not None and \
                self.Row.UVectECF is None and self.Col.UVectECF is None and \
                GeoData is not None and GeoData.SCP is not None:
            SCP = GeoData.SCP.ECF.get_array()

            t_zero = RMA.INCA.TimeCAPoly.Coefs[0]
            ca_pos = Position.ARPPoly(t_zero)
            ca_vel = Position.ARPPoly.derivative_eval(t_zero, der_order=1)

            uca_pos = ca_pos/norm(ca_pos)
            uca_vel = ca_vel/norm(ca_vel)
            uRg = (SCP - ca_pos)
            uRg_norm = norm(uRg)
            if uRg_norm > 0:
                uRg /= uRg_norm
                left = numpy.cross(uca_pos, uca_vel)
                look = numpy.sign(numpy.dot(left, uRg))
                uSPZ = -look*numpy.cross(uRg, uca_vel)
                uSPZ /= norm(uSPZ)
                uAZ = numpy.cross(uSPZ, uRg)
                self.Row.UVectECF = XYZType.from_array(uRg)
                self.Col.UVectECF = XYZType.from_array(uAZ)

        if self.Row is not None and self.Row.KCtr is None and RMA.INCA.FreqZero is not None:
            self.Row.KCtr = 2*RMA.INCA.FreqZero/speed_of_light
        if self.Col is not None and self.Col.KCtr is None:
            self.Col.KCtr = 0 
开发者ID:ngageoint,项目名称:sarpy,代码行数:49,代码来源:Grid.py


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