def test_precheck(self):
     """Test function for simulateDSM_* preliminary 1/1"""
     from deltasigma._utils import _get_zpk
     zeros, poles, _ = _get_zpk(self.H)
     assert np.allclose(cplxpair(zeros), self.zeros, atol=1e-6, rtol=1e-4)
     assert np.allclose(cplxpair(poles), self.poles, atol=1e-6, rtol=1e-4)
     assert np.allclose(self.ABCD, self.ABCD_ref, atol=1e-5, rtol=1e-3)
     assert np.allclose(self.u, self.u_ref, atol=1e-5, rtol=1e-3)
Exemplo n.º 2
0
 def test_precheck(self):
     """Test function for simulateDSM_* preliminary 1/1"""
     from deltasigma._utils import _get_zpk
     zeros, poles, _ = _get_zpk(self.H)
     assert np.allclose(cplxpair(zeros), self.zeros, atol=1e-6, rtol=1e-4)
     assert np.allclose(cplxpair(poles), self.poles, atol=1e-6, rtol=1e-4)
     assert np.allclose(self.ABCD, self.ABCD_ref, atol=1e-5, rtol=1e-3)
     assert np.allclose(self.u, self.u_ref, atol=1e-5, rtol=1e-3)
 def setUp(self):
     fname = pkg_resources.resource_filename(__name__,
             "test_data/test_simulateDSM.mat")
     self.v_ref = scipy.io.loadmat(fname)['v']
     self.xn_ref = scipy.io.loadmat(fname)['xn']
     self.xmax_ref = scipy.io.loadmat(fname)['xmax']
     self.y_ref = scipy.io.loadmat(fname)['y']
     self.u_ref = scipy.io.loadmat(fname)['u']
     self.ABCD_ref = scipy.io.loadmat(fname)['ABCD']
     self.zeros = cplxpair(scipy.io.loadmat(fname)['zeros'])
     self.poles = cplxpair(scipy.io.loadmat(fname)['poles'])
     self.v_ref = self.v_ref.reshape(-1)
     self.y_ref = self.y_ref.reshape(-1)
     OSR = 32
     self.H = synthesizeNTF(5, OSR, 10)
     N = 8192
     f = 85
     self.u = 0.5*np.sin(2*np.pi*f/N*np.arange(N))
     a, g, b, c = realizeNTF(self.H, 'CRFB')
     self.ABCD = stuffABCD(a, g, b, c, form='CRFB')
Exemplo n.º 4
0
 def setUp(self):
     fname = pkg_resources.resource_filename(
         __name__, "test_data/test_simulateDSM.mat")
     self.v_ref = scipy.io.loadmat(fname)['v']
     self.xn_ref = scipy.io.loadmat(fname)['xn']
     self.xmax_ref = scipy.io.loadmat(fname)['xmax']
     self.y_ref = scipy.io.loadmat(fname)['y']
     self.u_ref = scipy.io.loadmat(fname)['u']
     self.ABCD_ref = scipy.io.loadmat(fname)['ABCD']
     self.zeros = cplxpair(scipy.io.loadmat(fname)['zeros'])
     self.poles = cplxpair(scipy.io.loadmat(fname)['poles'])
     self.v_ref = self.v_ref.reshape(-1)
     self.y_ref = self.y_ref.reshape(-1)
     OSR = 32
     self.H = synthesizeNTF(5, OSR, 10)
     N = 8192
     f = 85
     self.u = 0.5 * np.sin(2 * np.pi * f / N * np.arange(N))
     a, g, b, c = realizeNTF(self.H, 'CRFB')
     self.ABCD = stuffABCD(a, g, b, c, form='CRFB')