예제 #1
0
파일: test_grids.py 프로젝트: rieder/amuse
    def test1(self):
        grid1 = datamodel.new_cartesian_grid((4, 5), 1.0 | units.m)
        grid2 = datamodel.new_regular_grid((4, 5), [4.0, 5.0] | units.m)
        grid3 = datamodel.new_rectilinear_grid((4, 5), [numpy.arange(5.0) | units.m, numpy.arange(6.0) | units.m])

        self.assertEqual(grid1.position, grid2.position)
        self.assertEqual(grid2.position, grid3.position)
예제 #2
0
    def test1(self):
        grid1 = datamodel.new_cartesian_grid((4, 5), 1.0 | units.m)
        grid2 = datamodel.new_regular_grid((4, 5), [4.0, 5.0] | units.m)
        grid3 = datamodel.new_rectilinear_grid(
            (4, 5), [numpy.arange(5.) | units.m,
                     numpy.arange(6.) | units.m])

        self.assertEqual(grid1.position, grid2.position)
        self.assertEqual(grid2.position, grid3.position)
예제 #3
0
파일: test_grids.py 프로젝트: rieder/amuse
 def test2(self):
     grid = datamodel.new_rectilinear_grid((10,), (1.0 * numpy.arange(11),))
     self.assertEqual(grid._axes_cell_boundaries, 1.0 * numpy.arange(11))
     grid = datamodel.new_regular_grid((10,), [10.0])
     self.assertEqual(grid._lengths, [10.0])
     grid = datamodel.new_cartesian_grid((10,), 1.0)
     self.assertEqual(grid._cellsize, 1.0)
     grid = datamodel.new_regular_grid((10, 20), [10.0, 15.0])
     self.assertEquals(grid._lengths, [10.0, 15.0])
예제 #4
0
 def test2(self):
     grid = datamodel.new_rectilinear_grid((10, ),
                                           (1. * numpy.arange(11), ))
     self.assertEqual(grid._axes_cell_boundaries, 1. * numpy.arange(11))
     grid = datamodel.new_regular_grid((10, ), [10.])
     self.assertEqual(grid._lengths, [10.])
     grid = datamodel.new_cartesian_grid((10, ), 1.)
     self.assertEqual(grid._cellsize, 1.)
     grid = datamodel.new_regular_grid((
         10,
         20,
     ), [10., 15.])
     self.assertEquals(grid._lengths, [10., 15.])