예제 #1
0
 def testXiVsF(self, nc=2):
     xi1 = sp.array([[0, 0, 1, 0, 0]] * nc, dtype=float).T
     xi2 = sp.array([[0, 0, 1, 0, 0]] * nc, dtype=float).T
     xis = sp.asarray([mcvec_to_conc(xi1), mcvec_to_conc(xi2)])
     xvf = xi_vs_f(xis, xis, nc=2)
     assert_equal(xvf.shape, (nc, nc, 2 * xi1.shape[0] - 1))
     assert_equal(xvf.sum(), 8.0)
     assert_equal((xvf != 0.0).sum(), 4)
예제 #2
0
 def testXiVsF(self, nc=2):
     xi1 = sp.array([[0, 0, 1, 0, 0]] * nc, dtype=float).T
     xi2 = sp.array([[0, 0, 1, 0, 0]] * nc, dtype=float).T
     xis = sp.asarray([mcvec_to_conc(xi1), mcvec_to_conc(xi2)])
     xvf = xi_vs_f(xis, xis, nc=2)
     assert_equal(xvf.shape, (nc, nc, 2 * xi1.shape[0] - 1))
     assert_equal(xvf.sum(), 8.0)
     assert_equal((xvf != 0.0).sum(), 4)
예제 #3
0
 def testFilterTrivial(self):
     mf_h = MatchedFilterNode(self.tf, self.nc, self.ce)
     mf_h.append_xi_buf(self.xi, recalc=True)
     nmf_h = NormalisedMatchedFilterNode(self.tf, self.nc, self.ce)
     nmf_h.append_xi_buf(self.xi, recalc=True)
     f = sp.dot(mcvec_to_conc(self.xi), self.ce.get_icmx(tf=self.tf))
     nf = sp.dot(f, mcvec_to_conc(self.xi))
     f = mcvec_from_conc(f, nc=self.nc)
     assert_equal(mf_h.f, f)
     assert_equal(nmf_h.f, f / nf)
예제 #4
0
 def testFilterTrivial(self):
     mf_h = MatchedFilterNode(self.tf, self.nc, self.ce)
     mf_h.append_xi_buf(self.xi, recalc=True)
     nmf_h = NormalisedMatchedFilterNode(self.tf, self.nc, self.ce)
     nmf_h.append_xi_buf(self.xi, recalc=True)
     f = sp.dot(mcvec_to_conc(self.xi), self.ce.get_icmx(tf=self.tf))
     nf = sp.dot(f, mcvec_to_conc(self.xi))
     f = mcvec_from_conc(f, nc=self.nc)
     assert_equal(mf_h.f, f)
     assert_equal(nmf_h.f, f / nf)
예제 #5
0
    def testMcvecFromConc_McvecToConc(self, nc=2):
        """single observation conversion test"""

        concv = sp.array([1, 2, 3, 4, 5, 6])
        mcvec = sp.array([[1, 4], [2, 5], [3, 6]])
        concv_test = mcvec_to_conc(mcvec)
        mcvec_test = mcvec_from_conc(concv, nc)
        assert_equal(concv_test, concv)
        assert_equal(mcvec_test, mcvec)
        assert_equal(mcvec_to_conc(mcvec_from_conc(concv, nc)), concv)
        assert_equal(mcvec_from_conc(mcvec_to_conc(mcvec), nc), mcvec)
예제 #6
0
    def testMcvecFromConc_McvecToConc(self, nc=2):
        """single observation conversion test"""

        concv = sp.array([1, 2, 3, 4, 5, 6])
        mcvec = sp.array([[1, 4], [2, 5], [3, 6]])
        concv_test = mcvec_to_conc(mcvec)
        mcvec_test = mcvec_from_conc(concv, nc)
        assert_equal(concv_test, concv)
        assert_equal(mcvec_test, mcvec)
        assert_equal(mcvec_to_conc(mcvec_from_conc(concv, nc)), concv)
        assert_equal(mcvec_from_conc(mcvec_to_conc(mcvec), nc), mcvec)