예제 #1
0
    def testparametrized_mutable_mapping(self):
        d = ParameterizedMutableMapping()
        d['a'] = [1.0, 4.0, 9.0]
        d['b'] = 6.0
        self.obj.param1 = d

        self.assertEqual(len(self.obj.__parameters__) + 2,
                         len(list(iter_parameters(self.obj))))
        self.assertEqual(4, len(list(iter_values(self.obj))))
        self.assertEqual(3, len(expand(self.obj)))
예제 #2
0
    def testexpand2(self):
        self.obj.param8 = [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]

        objs = expand(self.obj)

        self.assertEqual(3, len(objs))

        self.assertAlmostEqual(1.0, objs[0].param8[0], 4)
        self.assertAlmostEqual(4.0, objs[1].param8[0], 4)
        self.assertAlmostEqual(7.0, objs[2].param8[0], 4)
예제 #3
0
    def testexpand(self):
        subobj1 = MockParameterization('subobj1')
        subobj1.param1 = [88, 108]
        self.obj.param1 = subobj1

        objs = expand(self.obj)

        self.assertEqual(2, len(objs))

        self.assertEqual([88, 108], self.obj.param1.param1.tolist())
        self.assertEqual(88, objs[0].param1.param1)
        self.assertEqual(108, objs[1].param1.param1)
예제 #4
0
    def expandCount(self):
        if self._tbl_limit.model().rowCount() == 0:
            return 0

        try:
            count = 1

            for limit in self._tbl_limit.model().limits():
                count *= len(expand(limit))

            return count
        except:
            return 0
예제 #5
0
    def expandCount(self):
        if self._tbl_detector.model().rowCount() == 0:
            return 0

        try:
            count = 1

            for detectors in self._tbl_detector.model().detectors().values():
                count *= len(detectors)
                for detector in detectors:
                    count *= len(expand(detector))

            return count
        except:
            return 0
예제 #6
0
    def testexpand(self):
        self.assertEqual(1, len(expand(self.g1)))

        self.g1.add_layer(Material.pure(79), [1.0, 2.0])
        self.assertEqual(2, len(expand(self.g1)))
예제 #7
0
 def expandCount(self):
     try:
         return len(expand(self._wdg_geometry.currentWidget().value()))
     except:
         return 0