Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 5
0
def load_input_data(tf):
    MAT = loadmat('/home/phil/matlab.mat')
    noise = MAT['noise'].T
    signal = MAT['signal'].T
    nc = noise.shape[1]
    ce = TimeSeriesCovE.white_noise_init(tf, nc, std=.98)
    temps_ml = MAT['T']
    temps = sp.empty((temps_ml.shape[0], temps_ml.shape[1] / nc, nc))
    for i in xrange(temps_ml.shape[0]):
        temps[i] = mcvec_from_conc(temps_ml[i], nc=nc)
    return signal, noise, ce, temps