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


Python numpy.degrees方法代码示例

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


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

示例1: test_bounds

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def test_bounds(self):
        """
        Test that out-of-bounds coordinates return NaN reddening, and that
        in-bounds coordinates do not return NaN reddening.
        """

        for mode in (['random_sample', 'random_sample_per_pix',
                      'median', 'samples', 'mean']):
            # Draw random coordinates on the sphere
            n_pix = 10000
            u, v = np.random.random((2,n_pix))
            l = 360. * u
            b = 90. - np.degrees(np.arccos(2.*v - 1.))
            c = coords.SkyCoord(l, b, frame='galactic', unit='deg')

            A_calc = self._iphas(c, mode=mode)

            in_bounds = (l > 32.) & (l < 213.) & (b < 4.5) & (b > -4.5)
            out_of_bounds = (l < 28.) | (l > 217.) | (b > 7.) | (b < -7.)

            n_nan_in_bounds = np.sum(np.isnan(A_calc[in_bounds]))
            n_finite_out_of_bounds = np.sum(np.isfinite(A_calc[out_of_bounds]))

            self.assertTrue(n_nan_in_bounds == 0)
            self.assertTrue(n_finite_out_of_bounds == 0) 
开发者ID:gregreen,项目名称:dustmaps,代码行数:27,代码来源:test_iphas.py

示例2: plot_range_ring

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def plot_range_ring(self, range_ring_location_km, bm=None,
                        color='k', ls='-'):
        """
        Plot a single range ring.
        Parameters::
        ----------
        range_ring_location_km : float
            Location of range ring in km.
        npts: int
            Number of points in the ring, higher for better resolution.
        ax : Axis
            Axis to plot on. None will use the current axis.
        """
        npts = 100
        bm.tissot(self.rlon, self.rlat, 
                  np.degrees(range_ring_location_km * 1000. / RE), npts,
                  fill=False, color='black', linestyle='dashed')
    
################
# Save methods #
################ 
开发者ID:nguy,项目名称:PyRadarMet,代码行数:23,代码来源:BeamBlock.py

示例3: calculate_clock_angle

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def calculate_clock_angle(inst):
    """ Calculate IMF clock angle and magnitude of IMF in GSM Y-Z plane

    Parameters
    -----------
    inst : pysat.Instrument
        Instrument with OMNI HRO data
    """

    # Calculate clock angle in degrees
    clock_angle = np.degrees(np.arctan2(inst['BY_GSM'], inst['BZ_GSM']))
    clock_angle[clock_angle < 0.0] += 360.0
    inst['clock_angle'] = pds.Series(clock_angle, index=inst.data.index)

    # Calculate magnitude of IMF in Y-Z plane
    inst['BYZ_GSM'] = pds.Series(np.sqrt(inst['BY_GSM']**2 +
                                         inst['BZ_GSM']**2),
                                 index=inst.data.index)

    return 
开发者ID:pysat,项目名称:pysat,代码行数:22,代码来源:omni_hro.py

示例4: __init__

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def __init__(self, rotation: Vector, translation: Vector, angle_unit: str, notation: str='XYZ'):
        self.rotation    = rotation
        self.translation = translation

        self.angle_unit = angle_unit
        if self.angle_unit == 'degrees':
            self.rotation = Vector(*[radians(alpha) for alpha in rotation])

        self.R_x = None
        self.R_y = None
        self.R_z = None
        self.T   = None

        self.matrix = None
        self.notation = notation

        self._update_matrix() 
开发者ID:ndrplz,项目名称:differentiable-renderer,代码行数:19,代码来源:rototranslation.py

示例5: sind

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def sind(angle):
    """
    Sine with angle input in degrees

    Parameters
    ----------
    angle : float
        Angle in degrees

    Returns
    -------
    result : float
        Sin of the angle
    """

    res = np.sin(np.radians(angle))
    return res 
开发者ID:pvlib,项目名称:pvlib-python,代码行数:19,代码来源:tools.py

示例6: tand

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def tand(angle):
    """
    Tan with angle input in degrees

    Parameters
    ----------
    angle : float
        Angle in degrees

    Returns
    -------
    result : float
        Tan of the angle
    """

    res = np.tan(np.radians(angle))
    return res 
开发者ID:pvlib,项目名称:pvlib-python,代码行数:19,代码来源:tools.py

示例7: asind

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def asind(number):
    """
    Inverse Sine returning an angle in degrees

    Parameters
    ----------
    number : float
        Input number

    Returns
    -------
    result : float
        arcsin result
    """

    res = np.degrees(np.arcsin(number))
    return res 
开发者ID:pvlib,项目名称:pvlib-python,代码行数:19,代码来源:tools.py

示例8: singleaxis

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def singleaxis(self, apparent_zenith, apparent_azimuth):
        """
        Get tracking data. See :py:func:`pvlib.tracking.singleaxis` more
        detail.

        Parameters
        ----------
        apparent_zenith : float, 1d array, or Series
            Solar apparent zenith angles in decimal degrees.

        apparent_azimuth : float, 1d array, or Series
            Solar apparent azimuth angles in decimal degrees.

        Returns
        -------
        tracking data
        """
        tracking_data = singleaxis(apparent_zenith, apparent_azimuth,
                                   self.axis_tilt, self.axis_azimuth,
                                   self.max_angle,
                                   self.backtrack, self.gcr)

        return tracking_data 
开发者ID:pvlib,项目名称:pvlib-python,代码行数:25,代码来源:tracking.py

示例9: __str__

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def __str__(self):
        return ('{name}:\n'
                '    Semimajor axis (a)                           = {a:10.3f} km\n'
                '    Eccentricity (e)                             = {self.e:13.6f}\n'
                '    Inclination (i)                              = {i:8.1f} deg\n'
                '    Right ascension of the ascending node (raan) = {raan:8.1f} deg\n'
                '    Argument of perigee (arg_pe)                 = {arg_pe:8.1f} deg\n'
                '    Mean anomaly at reference epoch (M0)         = {M0:8.1f} deg\n'
                '    Period (T)                                   = {T}\n'
                '    Reference epoch (ref_epoch)                  = {self.ref_epoch!s}\n'
                '        Mean anomaly (M)                         = {M:8.1f} deg\n'
                '        Time (t)                                 = {t}\n'
                '        Epoch (epoch)                            = {self.epoch!s}'
                ).format(
                    name=self.__class__.__name__,
                    self=self,
                    a=self.a / kilo,
                    i=degrees(self.i),
                    raan=degrees(self.raan),
                    arg_pe=degrees(self.arg_pe),
                    M0=degrees(self.M0),
                    M=degrees(self.M),
                    T=timedelta(seconds=self.T),
                    t=timedelta(seconds=self.t)) 
开发者ID:RazerM,项目名称:orbital,代码行数:26,代码来源:elements.py

示例10: _vlines

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def _vlines(lines, ctrs=None, lengths=None, vecs=None, angle_lo=20, angle_hi=160, ransac_options=RANSAC_OPTIONS):
    ctrs = ctrs if ctrs is not None else lines.mean(1)
    vecs = vecs if vecs is not None else lines[:, 1, :] - lines[:, 0, :]
    lengths = lengths if lengths is not None else np.hypot(vecs[:, 0], vecs[:, 1])

    angles = np.degrees(np.arccos(vecs[:, 0] / lengths))
    points = np.column_stack([ctrs[:, 0], angles])
    point_indices, = np.nonzero((angles > angle_lo) & (angles < angle_hi))
    points = points[point_indices]
    if len(points) > 2:
        model_ransac = linear_model.RANSACRegressor(**ransac_options)
        model_ransac.fit(points[:, 0].reshape(-1, 1), points[:, 1].reshape(-1, 1))
        inlier_mask = model_ransac.inlier_mask_
        valid_lines = lines[point_indices[inlier_mask], :, :]
    else:
        valid_lines = []
    return valid_lines 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:19,代码来源:rectify.py

示例11: _hlines

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def _hlines(lines, ctrs=None, lengths=None, vecs=None, angle_lo=20, angle_hi=160, ransac_options=RANSAC_OPTIONS):
    ctrs = ctrs if ctrs is not None else lines.mean(1)
    vecs = vecs if vecs is not None else lines[:, 1, :] - lines[:, 0, :]
    lengths = lengths if lengths is not None else np.hypot(vecs[:, 0], vecs[:, 1])

    angles = np.degrees(np.arccos(vecs[:, 1] / lengths))
    points = np.column_stack([ctrs[:, 1], angles])
    point_indices, = np.nonzero((angles > angle_lo) & (angles < angle_hi))
    points = points[point_indices]
    if len(points) > 2:
        model_ransac = linear_model.RANSACRegressor(**ransac_options)
        model_ransac.fit(points[:, 0].reshape(-1, 1), points[:, 1].reshape(-1, 1))
        inlier_mask = model_ransac.inlier_mask_
        valid_lines = lines[point_indices[inlier_mask], :, :]
    else:
        valid_lines = []
    return valid_lines 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:19,代码来源:rectify.py

示例12: set_default_locators_and_formatters

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def set_default_locators_and_formatters(self, axis):
        """
        Override to set up the locators and formatters to use with the
        scale.  This is only required if the scale requires custom
        locators and formatters.  Writing custom locators and
        formatters is rather outside the scope of this example, but
        there are many helpful examples in ``ticker.py``.

        In our case, the Mercator example uses a fixed locator from
        -90 to 90 degrees and a custom formatter class to put convert
        the radians to degrees and put a degree symbol after the
        value::
        """
        class DegreeFormatter(Formatter):
            def __call__(self, x, pos=None):
                return "%d\N{DEGREE SIGN}" % np.degrees(x)

        axis.set_major_locator(FixedLocator(
            np.radians(np.arange(-90, 90, 10))))
        axis.set_major_formatter(DegreeFormatter())
        axis.set_minor_formatter(DegreeFormatter()) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:23,代码来源:custom_scale.py

示例13: __true_to_mean

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def __true_to_mean(T,e):
    """Converts true anomaly to mean anomaly.

       Args:
           T(float): true anomaly in degrees
           e(float): eccentricity

       Returns:
           float: the mean anomaly in degrees
    """

    T = np.radians(T)
    E = np.arctan2((1-e**2)*np.sin(T),e+np.cos(T))
    M = E - e*np.sin(E)
    M = np.degrees(M)
    M = M%360
    return M

# Parts of this method have been copied from:
# https://github.com/brandon-rhodes/python-sgp4/blob/master/sgp4/io.py 
开发者ID:aerospaceresearch,项目名称:orbitdeterminator,代码行数:22,代码来源:sgp4_prop.py

示例14: convert_xy_to_dirdip

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def convert_xy_to_dirdip(self, event):
        """
        Converts xy-coordinates of a matplotlib-event into dip-direction/dip
        by using the inverse transformation of mplstereonet. Returns floats in
        degree.
        """
        alpha = np.arctan2(event.xdata, event.ydata)
        alpha_deg = np.degrees(alpha)
        if alpha_deg < 0:
            alpha_deg += 360

        xy = np.array([[event.xdata, event.ydata]])
        xy_trans = self.inv.transform(xy)

        x = float(xy_trans[0,0:1])
        y = float(xy_trans[0,1:2])

        array = mplstereonet.stereonet_math._rotate(np.degrees(x),
                    np.degrees(y), (-1)*alpha_deg)

        gamma = float(array[1])
        gamma_deg = 90 - np.degrees(gamma)
        return alpha_deg, gamma_deg 
开发者ID:innstereo,项目名称:innstereo,代码行数:25,代码来源:main_ui.py

示例15: add_eigenvector_feature

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import degrees [as 别名]
def add_eigenvector_feature(self, datastore, dip_direct=0, dip=0, value=0):
        """
        Adds an eigenvector feature.

        Checks if the values lie in the normal range of degrees. Then the
        row is appended to the treestore that is passed to the method.
        """
        while dip_direct > 360:
            dip_direct = dip_direct - 360
        while dip_direct < 0:
            dip_direct = dip_direct + 360
        while dip > 90:
            dip = dip - 90
        while dip < 0:
            dip = dip + 90

        itr = datastore.append([dip_direct, dip, value])
        return itr 
开发者ID:innstereo,项目名称:innstereo,代码行数:20,代码来源:main_ui.py


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