| 43 | self.assertEqual(Sphere(x=4, radius=1), sphere['x']) |
| 44 | |
| 45 | def test_reshaping(self): |
| 46 | s = stack([Sphere(vec(x=0, y=0), radius=1)] * 50, instance('points')) |
| 47 | s = expand(s, batch(b=100)) |
| 48 | s = rename_dims(s, 'b', 'bat') |
| 49 | s = unpack_dim(s, 'points', spatial(x=10, y=5)) |
| 50 | assert batch(bat=100) & spatial(x=10, y=5) & channel(vector='x,y') == s.shape |
| 51 | s = pack_dims(s, 'x,y', instance('particles')) |
| 52 | assert batch(bat=100) & instance(particles=50) & channel(vector='x,y') == s.shape |
| 53 | s = flatten(s) |
| 54 | assert batch(bat=100) & instance(flat=50) & channel(vector='x,y') == s.shape |
| 55 | |
| 56 | def test_reshaping_const_radius(self): |
| 57 | s = Sphere(stack([vec(x=0, y=0)] * 50, instance('points')), radius=1) |