Example #1
0
 def test_lazy_complex(self):
     raw_points = np.arange(12).reshape(4, 3)
     points = as_lazy_data(raw_points, raw_points.shape)
     coord = AuxCoord(points)
     self.assertTrue(is_lazy_data(coord.core_points()))
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     # Check we haven't triggered the loading of the coordinate values.
     self.assertTrue(is_lazy_data(coord.core_points()))
     self.assertTrue(is_lazy_data(result))
     expected = raw_points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
Example #2
0
 def test_lazy_complex(self):
     raw_points = np.arange(12).reshape(4, 3)
     points = as_lazy_data(raw_points, raw_points.shape)
     coord = AuxCoord(points)
     self.assertTrue(is_lazy_data(coord.core_points()))
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     # Check we haven't triggered the loading of the coordinate values.
     self.assertTrue(is_lazy_data(coord.core_points()))
     self.assertTrue(is_lazy_data(result))
     expected = raw_points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
Example #3
0
 def test_real_set_lazy(self):
     # Setting new lazy points does not make a copy.
     coord = AuxCoord(self.pts_real)
     new_pts = self.pts_lazy + 102.3
     coord.points = new_pts
     result = coord.core_points()
     self.assertEqualLazyArraysAndDtypes(result, new_pts)
Example #4
0
 def test_real_set_lazy(self):
     # Setting new lazy points does not make a copy.
     coord = AuxCoord(self.pts_real)
     new_pts = self.pts_lazy + 102.3
     coord.points = new_pts
     result = coord.core_points()
     self.assertEqualLazyArraysAndDtypes(result, new_pts)
Example #5
0
 def test_real_points(self):
     coord = AuxCoord(self.pts_real)
     result = coord.core_points()
     self.assertArraysShareData(
         result,
         self.pts_real,
         "core_points() do not share data with the internal array.",
     )
Example #6
0
 def test_real_set_real(self):
     # Setting new real points does not make a copy.
     coord = AuxCoord(self.pts_real)
     new_pts = self.pts_real + 102.3
     coord.points = new_pts
     result = coord.core_points()
     self.assertArraysShareData(
         result, new_pts,
         'Points do not share data with the assigned array.')
Example #7
0
 def test_real_set_real(self):
     # Setting new real points does not make a copy.
     coord = AuxCoord(self.pts_real)
     new_pts = self.pts_real + 102.3
     coord.points = new_pts
     result = coord.core_points()
     self.assertArraysShareData(
         result, new_pts,
         'Points do not share data with the assigned array.')
Example #8
0
 def test_lazy_points_realise(self):
     coord = AuxCoord(self.pts_lazy)
     real_points = coord.points
     result = coord.core_points()
     self.assertEqualRealArraysAndDtypes(result, real_points)
Example #9
0
 def test_lazy_points(self):
     coord = AuxCoord(self.pts_lazy)
     result = coord.core_points()
     self.assertEqualLazyArraysAndDtypes(result, self.pts_lazy)
Example #10
0
 def test_lazy_points_realise(self):
     coord = AuxCoord(self.pts_lazy)
     real_points = coord.points
     result = coord.core_points()
     self.assertEqualRealArraysAndDtypes(result, real_points)
Example #11
0
 def test_lazy_points(self):
     coord = AuxCoord(self.pts_lazy)
     result = coord.core_points()
     self.assertEqualLazyArraysAndDtypes(result, self.pts_lazy)
Example #12
0
 def test_real_points(self):
     coord = AuxCoord(self.pts_real)
     result = coord.core_points()
     self.assertArraysShareData(
         result, self.pts_real,
         'core_points() do not share data with the internal array.')
Example #13
0
 def test_lazy_points_realise(self):
     coord = AuxCoord(self.pts_lazy)
     real_points = coord.points
     result = coord.core_points()
     self.assertIs(result, real_points)