Python numpy.polynomial.legendre.legval2d() Examples

The following are code examples for showing how to use numpy.polynomial.legendre.legval2d(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: LaserTOF   Author: kyleuckert   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 2
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 3
Project: xwavecal   Author: gmbrandt   File: wavelength.py    MIT License 6 votes vote down vote up
def _construct_wavelength_map_matrices(self, normed_pixel, normed_order, order, **kwargs):
        if self.grating_eq:
            m_divisor = 1 / np.add(order, self.m0).astype(np.float64)
        else:
            m_divisor = np.ones_like(normed_pixel, dtype=np.float64)
        columns = ()
        for xpower in self.model:
            for orderpower in self.model[xpower]:
                coefficient_array = np.zeros((xpower+1, orderpower+1))
                coefficient_array[xpower, orderpower] = 1
                columns += (m_divisor * legendre.legval2d(normed_pixel, normed_order, coefficient_array),)
        A = np.column_stack(columns)
        if (0 not in self.model) or (0 not in self.model[0]):
            # we force 0,0 coefficient to 1 for the overlap fit.
            c = -1 * m_divisor.reshape(-1, 1)
        else:
            c = np.zeros_like(normed_pixel, dtype=np.float64).reshape(-1, 1)
        return A, c 
Example 4
Project: recruit   Author: Frank-qlu   File: test_legendre.py    Apache License 2.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 5
Project: att   Author: Centre-Alt-Rendiment-Esportiu   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 6
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 7
Project: MARRtino-2.0   Author: DaniAffCH   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 8
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 9
Project: vnpy_crypto   Author: birforce   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 10
Project: ble5-nrf52-mac   Author: tomasero   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 11
Project: Computable   Author: ktraunmueller   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 12
Project: poker   Author: surgebiswas   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 13
Project: P3_image_processing   Author: latedude2   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 14
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 15
Project: 3dprinteros-client   Author: panasevychol   File: test_legendre.py    GNU Affero General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 16
Project: 3dprinteros-client   Author: panasevychol   File: test_legendre.py    GNU Affero General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 17
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_legendre.py    Apache License 2.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 18
Project: fund   Author: Frank-qlu   File: test_legendre.py    Apache License 2.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 19
Project: pySINDy   Author: luckystarufo   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 20
Project: Programming-for-Non-Technical-Roles-   Author: PacktPublishing   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 21
Project: linear_neuron   Author: uglyboxer   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 22
Project: facethin   Author: ParkerGod   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 23
Project: islam-buddy   Author: hamir   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 24
Project: mxnet-lambda   Author: awslabs   File: test_legendre.py    Apache License 2.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 25
Project: Deribit_funding_rate_indicator   Author: Dimasik007   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 26
Project: psychrometric-chart-makeover   Author: buds-lab   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 27
Project: wine-ml-on-aws-lambda   Author: pierreant   File: test_legendre.py    Apache License 2.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 28
Project: linux-cross-gcc   Author: nmercier   File: test_legendre.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 29
Project: SignLanguage_ML   Author: mareep-raljodid   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 30
Project: ImageFusion   Author: pfchai   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 31
Project: sarah   Author: ChonchoFronto   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 32
Project: honours_project   Author: JFriel   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 33
Project: honours_project   Author: JFriel   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 34
Project: Blackjack-Tracker   Author: martinabeleda   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 35
Project: PYPIC   Author: max614   File: test_legendre.py    BSD 2-Clause "Simplified" License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 36
Project: PYPIC   Author: max614   File: test_legendre.py    BSD 2-Clause "Simplified" License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 37
Project: PYPIC   Author: max614   File: test_legendre.py    BSD 2-Clause "Simplified" License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 38
Project: offlow   Author: satwikkansal   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 39
Project: lambda-tensorflow-object-detection   Author: mikylucky   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 40
Project: elasticintel   Author: securityclippy   File: test_legendre.py    GNU General Public License v3.0 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 41
Project: cnidaria   Author: sauloal   File: test_legendre.py    MIT License 6 votes vote down vote up
def test_legval2d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

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

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

        #test shape
        z = np.ones((2, 3))
        res = leg.legval2d(z, z, self.c2d)
        assert_(res.shape == (2, 3)) 
Example 42
Project: LaserTOF   Author: kyleuckert   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 43
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 44
Project: recruit   Author: Frank-qlu   File: test_legendre.py    Apache License 2.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 45
Project: att   Author: Centre-Alt-Rendiment-Esportiu   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 46
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 47
Project: MARRtino-2.0   Author: DaniAffCH   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 48
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 49
Project: vnpy_crypto   Author: birforce   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 50
Project: ble5-nrf52-mac   Author: tomasero   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 51
Project: Computable   Author: ktraunmueller   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self) :
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 52
Project: poker   Author: surgebiswas   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 53
Project: P3_image_processing   Author: latedude2   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 54
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 55
Project: 3dprinteros-client   Author: panasevychol   File: test_legendre.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 56
Project: 3dprinteros-client   Author: panasevychol   File: test_legendre.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 57
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_legendre.py    Apache License 2.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 58
Project: fund   Author: Frank-qlu   File: test_legendre.py    Apache License 2.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 59
Project: pySINDy   Author: luckystarufo   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 60
Project: Programming-for-Non-Technical-Roles-   Author: PacktPublishing   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 61
Project: linear_neuron   Author: uglyboxer   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 62
Project: facethin   Author: ParkerGod   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 63
Project: islam-buddy   Author: hamir   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 64
Project: mxnet-lambda   Author: awslabs   File: test_legendre.py    Apache License 2.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 65
Project: Deribit_funding_rate_indicator   Author: Dimasik007   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 66
Project: psychrometric-chart-makeover   Author: buds-lab   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 67
Project: wine-ml-on-aws-lambda   Author: pierreant   File: test_legendre.py    Apache License 2.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 68
Project: linux-cross-gcc   Author: nmercier   File: test_legendre.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 69
Project: SignLanguage_ML   Author: mareep-raljodid   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 70
Project: ImageFusion   Author: pfchai   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 71
Project: sarah   Author: ChonchoFronto   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 72
Project: honours_project   Author: JFriel   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 73
Project: honours_project   Author: JFriel   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 74
Project: Blackjack-Tracker   Author: martinabeleda   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 75
Project: PYPIC   Author: max614   File: test_legendre.py    BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 76
Project: PYPIC   Author: max614   File: test_legendre.py    BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 77
Project: offlow   Author: satwikkansal   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 78
Project: lambda-tensorflow-object-detection   Author: mikylucky   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 79
Project: elasticintel   Author: securityclippy   File: test_legendre.py    GNU General Public License v3.0 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6)) 
Example 80
Project: cnidaria   Author: sauloal   File: test_legendre.py    MIT License 5 votes vote down vote up
def test_legvander2d(self):
        # also tests polyval2d for non-square coefficient array
        x1, x2, x3 = self.x
        c = np.random.random((2, 3))
        van = leg.legvander2d(x1, x2, [1, 2])
        tgt = leg.legval2d(x1, x2, c)
        res = np.dot(van, c.flat)
        assert_almost_equal(res, tgt)

        # check shape
        van = leg.legvander2d([x1], [x2], [1, 2])
        assert_(van.shape == (1, 5, 6))