def test_global_to_beam_G0_C90(self): """ Test at G0, C90 """ source = Source("varian_clinac_6MV") source.gantry(0) source.collimator(90) global_coords = np.array([.1, .2, .3]) transform = Transform(source.position, source.rotation) beam_coords = transform.global_to_beam(global_coords) correct = np.array([.2, -.1, -99.7]) np.testing.assert_array_almost_equal(correct, beam_coords, decimal=5)
def test_beam_to_global_G270_C270(self): """ Test at G270, C270 """ source = Source("varian_clinac_6MV") source.gantry(270) source.collimator(270) beam_coords = np.array([.1, .2, .3]) transform = Transform(source.position, source.rotation) global_coords = transform.beam_to_global(beam_coords) correct = np.array([-100.3, -.1, .2]) np.testing.assert_array_almost_equal(correct, global_coords, decimal=5)