Beispiel #1
0
 def test5(self):
     dimension_values = [
         [0, 1, 2, 3, 4, 5, 6, 7, 8,9 ]
     ]
     split_dimension_values = indexing.split_numpy_index_over_dimensions(slice(-2,10), dimension_values)
     self.assertEquals(split_dimension_values[0], [8, 9])
     split_dimension_values = indexing.split_numpy_index_over_dimensions(slice(-3,3,-1), dimension_values)
     self.assertEquals(split_dimension_values[0], [7, 6, 5, 4])
Beispiel #2
0
 def test4(self):
     dimension_values = [
         [0, 1, 2, 3, 4, 5, 6, 7, 8, ]
     ]
     split_dimension_values = indexing.split_numpy_index_over_dimensions(slice(1,7,2), dimension_values)
     self.assertEquals(len(split_dimension_values) ,1)
     self.assertEquals(split_dimension_values[0], [1, 3, 5])
Beispiel #3
0
 def test7(self):
     dimension_values = [[0, 1], [0, 1, 2], [0]]
     split_dimension_values = indexing.split_numpy_index_over_dimensions(
         slice(1, 2), dimension_values)
     self.assertEqual(split_dimension_values[0], [1])
     self.assertEqual(split_dimension_values[1], [0, 1, 2])
     self.assertEqual(split_dimension_values[2], [0])
Beispiel #4
0
 def test3(self):
     dimension_values = [[3, 4, 5, 6], ['a', 'b', 'c']]
     split_dimension_values = indexing.split_numpy_index_over_dimensions(
         slice(0, 2), dimension_values)
     self.assertEqual(len(split_dimension_values), 2)
     self.assertEqual(split_dimension_values[0], [3, 4])
     self.assertEqual(split_dimension_values[1], ['a', 'b', 'c'])
Beispiel #5
0
 def test3(self):
     dimension_values = [
         [3,4,5,6],
         ['a','b','c']
     ]
     split_dimension_values = indexing.split_numpy_index_over_dimensions(slice(0,2), dimension_values)
     self.assertEquals(len(split_dimension_values) ,2)
     self.assertEquals(split_dimension_values[0], [3,4])
     self.assertEquals(split_dimension_values[1], ['a','b','c'])
Beispiel #6
0
 def test2(self):
     dimension_values = [
         [3,4,5,6],
         ['a','b','c']
     ]
     split_dimension_values = indexing.split_numpy_index_over_dimensions((1,2), dimension_values)
     self.assertEquals(len(split_dimension_values) ,2)
     self.assertEquals(split_dimension_values[0], 4)
     self.assertEquals(split_dimension_values[1], 'c')
Beispiel #7
0
 def test7(self):
     dimension_values = [
         [0, 1],
         [0, 1, 2],
         [0]
     ]
     split_dimension_values = indexing.split_numpy_index_over_dimensions(slice(1,2), dimension_values)
     self.assertEquals(split_dimension_values[0], [1])
     self.assertEquals(split_dimension_values[1], [0,1,2])
     self.assertEquals(split_dimension_values[2], [0])
Beispiel #8
0
    def test8(self):
        dimension_values = [[0, 1], [0, 1, 2], [0]]
        split_dimension_values = indexing.split_numpy_index_over_dimensions(
            (Ellipsis, 0), dimension_values)
        self.assertEqual(split_dimension_values[0], [0, 1])
        self.assertEqual(split_dimension_values[1], [0, 1, 2])
        self.assertEqual(split_dimension_values[2], 0)

        split_dimension_values = indexing.split_numpy_index_over_dimensions(
            (slice(None), slice(None), 0), dimension_values)
        self.assertEqual(split_dimension_values[0], [0, 1])
        self.assertEqual(split_dimension_values[1], [0, 1, 2])
        self.assertEqual(split_dimension_values[2], 0)

        split_dimension_values = indexing.split_numpy_index_over_dimensions(
            (Ellipsis, 0, Ellipsis), dimension_values)
        self.assertEqual(split_dimension_values[0], [0, 1])
        self.assertEqual(split_dimension_values[1], 0)
        self.assertEqual(split_dimension_values[2], [0])
Beispiel #9
0
 def test8(self):
     dimension_values = [
         [0, 1],
         [0, 1, 2],
         [0]
     ]
     split_dimension_values = indexing.split_numpy_index_over_dimensions((Ellipsis,0), dimension_values)
     self.assertEquals(split_dimension_values[0], [0,1])
     self.assertEquals(split_dimension_values[1], [0,1,2])
     self.assertEquals(split_dimension_values[2], 0)
     
     split_dimension_values = indexing.split_numpy_index_over_dimensions((slice(None),slice(None),0), dimension_values)
     self.assertEquals(split_dimension_values[0], [0,1])
     self.assertEquals(split_dimension_values[1], [0,1,2])
     self.assertEquals(split_dimension_values[2], 0)
 
     split_dimension_values = indexing.split_numpy_index_over_dimensions((Ellipsis,0, Ellipsis), dimension_values)
     self.assertEquals(split_dimension_values[0], [0,1])
     self.assertEquals(split_dimension_values[1], 0)
     self.assertEquals(split_dimension_values[2], [0])
Beispiel #10
0
 def test6(self):
     dimension_values = [
         [0, 1, 2, 3, 4, 5, 6, 7, 8,9 ]
     ]
     split_dimension_values = indexing.split_numpy_index_over_dimensions(slice(5,None), dimension_values)
     self.assertEquals(split_dimension_values[0], [5, 6, 7, 8, 9])