Python numpy.polynomial.polynomial.polyval2d() Examples
The following are 30
code examples of numpy.polynomial.polynomial.polyval2d().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.polynomial.polynomial
, or try the search function
.
Example #1
Source File: test_polynomial.py From GraphicDesignPatternByPython with MIT License | 7 votes |
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))
Example #2
Source File: test_polynomial.py From recruit with Apache License 2.0 | 6 votes |
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))
Example #3
Source File: test_polynomial.py From elasticintel with GNU General Public License v3.0 | 6 votes |
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))
Example #4
Source File: test_polynomial.py From ImageFusion with MIT License | 6 votes |
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))
Example #5
Source File: test_polynomial.py From mxnet-lambda with Apache License 2.0 | 6 votes |
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))
Example #6
Source File: test_polynomial.py From coffeegrindsize with MIT License | 6 votes |
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))
Example #7
Source File: test_polynomial.py From pySINDy with MIT License | 6 votes |
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))
Example #8
Source File: test_polynomial.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
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))
Example #9
Source File: test_polynomial.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
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))
Example #10
Source File: test_polynomial.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
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))
Example #11
Source File: test_polynomial.py From twitter-stock-recommendation with MIT License | 6 votes |
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))
Example #12
Source File: test_polynomial.py From Computable with MIT License | 6 votes |
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))
Example #13
Source File: test_polynomial.py From vnpy_crypto with MIT License | 6 votes |
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))
Example #14
Source File: test_polynomial.py From keras-lambda with MIT License | 6 votes |
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))
Example #15
Source File: test_polynomial.py From auto-alt-text-lambda-api with MIT License | 6 votes |
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))
Example #16
Source File: test_polynomial.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
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))
Example #17
Source File: test_polynomial.py From coffeegrindsize with MIT License | 5 votes |
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))
Example #18
Source File: test_polynomial.py From twitter-stock-recommendation with MIT License | 5 votes |
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))
Example #19
Source File: test_polynomial.py From elasticintel with GNU General Public License v3.0 | 5 votes |
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))
Example #20
Source File: test_polynomial.py From keras-lambda with MIT License | 5 votes |
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))
Example #21
Source File: normalize_sicd.py From sarpy with MIT License | 5 votes |
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
Example #22
Source File: normalize_sicd.py From sarpy with MIT License | 5 votes |
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
Example #23
Source File: test_utils.py From sarpy with MIT License | 5 votes |
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))
Example #24
Source File: test_polynomial.py From ImageFusion with MIT License | 5 votes |
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))
Example #25
Source File: test_polynomial.py From mxnet-lambda with Apache License 2.0 | 5 votes |
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))
Example #26
Source File: test_polynomial.py From pySINDy with MIT License | 5 votes |
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))
Example #27
Source File: test_polynomial.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
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))
Example #28
Source File: test_polynomial.py From GraphicDesignPatternByPython with MIT License | 5 votes |
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))
Example #29
Source File: test_polynomial.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
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))
Example #30
Source File: test_polynomial.py From Computable with MIT License | 5 votes |
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))