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


Python polynomial.polyval2d方法代码示例

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


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

示例1: test_polyval2d

# 需要导入模块: from numpy.polynomial import polynomial [as 别名]
# 或者: from numpy.polynomial.polynomial import polyval2d [as 别名]
def test_polyval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

        #test exceptions
        assert_raises(ValueError, poly.polyval2d, x1, x2[:2], self.c2d)

        #test values
        tgt = y1*y2
        res = poly.polyval2d(x1, x2, self.c2d)
        assert_almost_equal(res, tgt)

        #test shape
        z = np.ones((2, 3))
        res = poly.polyval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:18,代码来源:test_polynomial.py

示例2: test_polyvander2d

# 需要导入模块: from numpy.polynomial import polynomial [as 别名]
# 或者: from numpy.polynomial.polynomial import polyval2d [as 别名]
def test_polyvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = poly.polyvander2d(x1, x2, [1, 2])
        tgt = poly.polyval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = poly.polyvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:14,代码来源:test_polynomial.py

示例3: test_polyvander2d

# 需要导入模块: from numpy.polynomial import polynomial [as 别名]
# 或者: from numpy.polynomial.polynomial import polyval2d [as 别名]
def test_polyvander2d(self) :
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = poly.polyvander2d(x1, x2, [1, 2])
        tgt = poly.polyval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = poly.polyvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_polynomial.py

示例4: test_two_dim_poly_fit

# 需要导入模块: from numpy.polynomial import polynomial [as 别名]
# 或者: from numpy.polynomial.polynomial import polyval2d [as 别名]
def test_two_dim_poly_fit(self):
        coeffs = numpy.arange(9).reshape((3, 3))
        y, x = numpy.meshgrid(numpy.arange(2, 6), numpy.arange(-2, 2))
        z = polynomial.polyval2d(x, y, coeffs)
        t_coeffs, residuals, rank, sing_vals = two_dim_poly_fit(x, y, z, x_order=2, y_order=2)
        diff = (numpy.abs(coeffs - t_coeffs) < 1e-10)
        self.assertTrue(numpy.all(diff)) 
开发者ID:ngageoint,项目名称:sarpy,代码行数:9,代码来源:test_utils.py

示例5: deskewmem

# 需要导入模块: from numpy.polynomial import polynomial [as 别名]
# 或者: from numpy.polynomial.polynomial import polyval2d [as 别名]
def deskewmem(input_data, DeltaKCOAPoly, dim0_coords_m, dim1_coords_m, dim, fft_sgn=-1):
    """
    Performs deskew (centering of the spectrum on zero frequency) on a complex dataset.

    Parameters
    ----------
    input_data : numpy.ndarray
        Complex FFT Data
    DeltaKCOAPoly : numpy.ndarray
        Polynomial that describes center of frequency support of data.
    dim0_coords_m : numpy.ndarray
    dim1_coords_m : numpy.ndarray
    dim : int
    fft_sgn : int|float

    Returns
    -------
    Tuple[numpy.ndarray, numpy.ndarray]
        * `output_data` - Deskewed data
        * `new_DeltaKCOAPoly` - Frequency support shift in the non-deskew dimension caused by the deskew.
    """

    # Integrate DeltaKCOA polynomial (in meters) to form new polynomial DeltaKCOAPoly_int
    DeltaKCOAPoly_int = polynomial.polyint(DeltaKCOAPoly, axis=dim)
    # New DeltaKCOAPoly in other dimension will be negative of the derivative of
    # DeltaKCOAPoly_int in other dimension (assuming it was zero before).
    new_DeltaKCOAPoly = - polynomial.polyder(DeltaKCOAPoly_int, axis=dim-1)
    # Apply phase adjustment from polynomial
    dim1_coords_m_2d, dim0_coords_m_2d = np.meshgrid(dim1_coords_m, dim0_coords_m)
    output_data = np.multiply(input_data, np.exp(1j * fft_sgn * 2 * np.pi *
                                                 polynomial.polyval2d(
                                                     dim0_coords_m_2d,
                                                     dim1_coords_m_2d,
                                                     DeltaKCOAPoly_int)))
    return output_data, new_DeltaKCOAPoly 
开发者ID:ngageoint,项目名称:sarpy,代码行数:37,代码来源:normalize_sicd.py

示例6: deskewmem

# 需要导入模块: from numpy.polynomial import polynomial [as 别名]
# 或者: from numpy.polynomial.polynomial import polyval2d [as 别名]
def deskewmem(input_data, DeltaKCOAPoly, dim0_coords_m, dim1_coords_m, dim, fft_sgn=-1):
    """Performs deskew (centering of the spectrum on zero frequency) on a complex dataset.

    INPUTS:
       input_data:  Complex FFT Data
       DeltaKCOAPoly:  Polynomial that describes center of frequency support of data.
       dim0_coords_m:  Coordinate of each "row" in dimension 0
       dim1_coords_m:  Coordinate of each "column" in dimension 1
       dim:  Dimension over which to perform deskew
       fft_sgn:  FFT sign required to transform data to spatial frequency domain
    OUTPUTS:
       output_data:  Deskewed data
       new_DeltaKCOAPoly:  Frequency support shift in the non-deskew dimension
          caused by the deskew.
    """

    # Integrate DeltaKCOA polynomial (in meters) to form new polynomial DeltaKCOAPoly_int
    DeltaKCOAPoly_int = polynomial.polyint(DeltaKCOAPoly, axis=dim)
    # New DeltaKCOAPoly in other dimension will be negative of the derivative of
    # DeltaKCOAPoly_int in other dimension (assuming it was zero before).
    new_DeltaKCOAPoly = - polynomial.polyder(DeltaKCOAPoly_int, axis=dim-1)
    # Apply phase adjustment from polynomial
    [dim1_coords_m_2d, dim0_coords_m_2d] = np.meshgrid(dim1_coords_m, dim0_coords_m)
    output_data = np.multiply(input_data, np.exp(1j * fft_sgn * 2 * np.pi *
                                                 polynomial.polyval2d(
                                                     dim0_coords_m_2d,
                                                     dim1_coords_m_2d,
                                                     DeltaKCOAPoly_int)))
    return output_data, new_DeltaKCOAPoly 
开发者ID:ngageoint,项目名称:sarpy,代码行数:31,代码来源:normalize_sicd.py


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