예제 #1
0
class TestEMDS(BaseCommon.TestAlgorithms):
    def setUp(self):
        print('TestEMDS:setUp')
        BaseCommon.TestAlgorithms.setUp(self)
        self.n_it = 10
        self.N_zero = [5]
        self.N_relaxed = [5]
        self.eps = 1e-8
        self.methods = ['relaxed', 'iterative']

    def create_points(self, N=10, d=3):
        print('TestEMDS:create_points')
        self.pts = HeterogenousSet(N, d)
        self.pts.set_points('normal')
        self.C, self.b = self.pts.get_KE_constraints()

    def call_method(self, method=''):
        print('TestEMDS:call_method with', method)
        if method == '':
            return reconstruct_emds(self.pts.edm,
                                    Om=self.pts.Om,
                                    real_points=self.pts.points)
        else:
            return reconstruct_emds(self.pts.edm,
                                    Om=self.pts.Om,
                                    real_points=self.pts.points,
                                    C=self.C,
                                    b=self.b,
                                    method=method)
예제 #2
0
def parse_options_gaussian(options):
    from pylocus.point_set import HeterogenousSet
    sigmas = np.linspace(options['min_sigma'], options['max_sigma'],
                         options['n_sigma'])
    rhos = np.linspace(options['min_rho'], options['max_rho'],
                       options['n_rhos'])
    points = HeterogenousSet(options['N'], options['d'])
    return sigmas, rhos, points
예제 #3
0
class TestSimulation(unittest.TestCase):
    def setUp(self):
        N = 4
        d = 2
        self.points = HeterogenousSet(N, d)
        self.points.set_points('normal')

    def test_multiple(self):
        for i in range(100):
            print('running test number', i)
            self.points.set_points('normal')
            self.test_Om_from_abs_angles()
            self.test_constraints()

    def test_Om_from_abs_angles(self):
        Om = get_Om_from_abs_angles(self.points.abs_angles, self.points.m)
        self.assertTrue(np.allclose(Om, self.points.Om),
                        'Om from all methods does not give the same result.')

    def test_constraints(self):
        C, b = self.points.get_KE_constraints()
        self.assertTrue(np.allclose(C.dot(self.points.KE), b))
예제 #4
0
 def create_points(self, N=5, d=3):
     print('TestEMDS:create_points')
     self.pts = HeterogenousSet(N, d)
     self.pts.set_points('normal')
     self.C, self.b = self.pts.get_KE_constraints()
예제 #5
0
 def setUp(self):
     N = 4
     d = 2
     self.points = HeterogenousSet(N, d)
     self.points.set_points('normal')