Example #1
0
 def test_columnwise_iteration(self):
     ps2d = ParameterSpace(
         {
             'a': [[2, 3, 5, 8, 13], [21, 34, 55, 89, 144]],
             'b': 7,
             'c': lambda i, j: 3 * i - 2 * j
         },
         shape=(2, 5))
     ps2d.evaluate(mask=(slice(None), [1, 3, 4]))
     expected = [{
         'a': np.array([3, 34]),
         'b': np.array([7, 7]),
         'c': np.array([-2, 1])
     }, {
         'a': np.array([8, 89]),
         'b': np.array([7, 7]),
         'c': np.array([-6, -3])
     }, {
         'a': np.array([13, 144]),
         'b': np.array([7, 7]),
         'c': np.array([-8, -5])
     }]
     for x, y in zip(ps2d.columns(), expected):
         for key in y:
             assert_array_equal(x[key], y[key])
Example #2
0
 def test_columnwise_iteration_single_column(self):
     ps2d = ParameterSpace(
         {"a": [[2, 3, 5, 8, 13], [21, 34, 55, 89, 144]], "b": 7, "c": lambda i, j: 3 * i - 2 * j}, shape=(2, 5)
     )
     ps2d.evaluate(mask=(slice(None), 3))
     expected = [{"a": np.array([8, 89]), "b": np.array([7, 7]), "c": np.array([-6, -3])}]
     actual = list(ps2d.columns())
     for x, y in zip(actual, expected):
         for key in y:
             assert_array_equal(x[key], y[key])
 def test_columnwise_iteration_single_column(self):
     ps2d = ParameterSpace({'a': [[2, 3, 5, 8, 13], [21, 34, 55, 89, 144]],
                            'b': 7,
                            'c': lambda i, j: 3 * i - 2 * j}, shape=(2, 5))
     ps2d.evaluate(mask=(slice(None), 3))
     expected = [{'a': np.array([8, 89]), 'b': np.array([7, 7]), 'c': np.array([-6, -3])}]
     actual = list(ps2d.columns())
     for x, y in zip(actual, expected):
         for key in y:
             assert_array_equal(x[key], y[key])
Example #4
0
 def test_columnwise_iteration(self):
     ps2d = ParameterSpace({'a': [[2, 3, 5, 8, 13], [21, 34, 55, 89, 144]],
                            'b': 7,
                            'c': lambda i, j: 3*i-2*j}, shape=(2, 5))
     ps2d.evaluate(mask=(slice(None), [1, 3, 4]))
     expected = [{'a': np.array([3, 34]), 'b': np.array([7, 7]), 'c': np.array([-2, 1])},
                 {'a': np.array([8, 89]), 'b': np.array([7, 7]), 'c': np.array([-6, -3])},
                 {'a': np.array([13, 144]), 'b': np.array([7, 7]), 'c': np.array([-8, -5])}]
     for x, y in zip(ps2d.columns(), expected):
         for key in y:
             assert_array_equal(x[key], y[key])