def test_dom_table_with_another_detx(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse_doms() dt = det.dom_table assert 4 == len(dt) assert np.allclose([1, 2, 3, 4], dt.dom_id) assert np.allclose([1, 1, 1, 2], dt.du) assert np.allclose([1, 2, 3, 1], dt.floor) assert np.allclose([0, 0, 0, 0], dt.pos_x) assert np.allclose([0, 0, 0, 0], dt.pos_y) assert np.allclose([0, 0, 0, 0], dt.pos_z)
def test_dom_table_with_another_detx(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse() dt = det.dom_table assert 4 == len(dt) assert np.allclose([1, 2, 3, 4], dt.dom_id) assert np.allclose([1, 1, 1, 2], dt.du) assert np.allclose([1, 2, 3, 1], dt.floor) assert np.allclose([0, 0, 0, 0], dt.pos_x) assert np.allclose([0, 0, 0, 0], dt.pos_y) assert np.allclose([0, 0, 0, 0], dt.pos_z)
def test_rotate_dom_set_by_step_by_360_degrees(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse_doms() dom_id = 1 channel_id = 0 pmt_dir = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id].copy() pmt_pos = det.pmts[det.pmts.dom_id == dom_id].pos[channel_id].copy() for i in range(36): det.rotate_dom_by_yaw(dom_id, 10) pmt_dir_rot = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id] assert np.allclose(pmt_dir, pmt_dir_rot) pmt_pos_rot = det.pmts[det.pmts.dom_id == dom_id].pos[channel_id] assert np.allclose(pmt_pos, pmt_pos_rot)
def test_rotate_dom_set_by_step_by_360_degrees(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse() dom_id = 1 channel_id = 0 pmt_dir = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id].copy() pmt_pos = det.pmts[det.pmts.dom_id == dom_id].pos[channel_id].copy() for i in range(36): det.rotate_dom_by_yaw(dom_id, 10) pmt_dir_rot = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id] assert np.allclose(pmt_dir, pmt_dir_rot) pmt_pos_rot = det.pmts[det.pmts.dom_id == dom_id].pos[channel_id] assert np.allclose(pmt_pos, pmt_pos_rot)
def test_rotate_dom_by_yaw(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse_doms() # here, only one PMT is checked dom_id = 1 heading = 23 channel_id = 0 pmt_dir = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id].copy() pmt_dir_rot = qrot_yaw(pmt_dir, heading) det.rotate_dom_by_yaw(dom_id, heading) assert np.allclose( pmt_dir_rot, det.pmts[det.pmts.dom_id == dom_id].dir[channel_id] ) assert np.allclose([0.92050485, 0.39073113, 0], det.pmts[det.pmts.dom_id == dom_id].pos[channel_id])
def test_rotate_du_by_yaw_step_by_step_360_degrees(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse_doms() du = 2 pmt_dir = det.pmts[det.pmts.du == du].dir.copy() pmt_pos = det.pmts[det.pmts.du == du].pos.copy() pmt_dir_other_dus = det.pmts[det.pmts.du != du].dir.copy() pmt_pos_other_dus = det.pmts[det.pmts.du != du].pos.copy() for i in range(36): det.rotate_du_by_yaw(du, 10) pmt_dir_rot = det.pmts[det.pmts.du == du].dir pmt_pos_rot = det.pmts[det.pmts.du == du].pos assert np.allclose(pmt_dir, pmt_dir_rot) assert np.allclose(pmt_pos, pmt_pos_rot) assert np.allclose(pmt_dir_other_dus, det.pmts[det.pmts.du != du].dir) assert np.allclose(pmt_pos_other_dus, det.pmts[det.pmts.du != du].pos)
def test_rotate_du_by_yaw_step_by_step_360_degrees(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse() du = 2 pmt_dir = det.pmts[det.pmts.du == du].dir.copy() pmt_pos = det.pmts[det.pmts.du == du].pos.copy() pmt_dir_other_dus = det.pmts[det.pmts.du != du].dir.copy() pmt_pos_other_dus = det.pmts[det.pmts.du != du].pos.copy() for i in range(36): det.rotate_du_by_yaw(du, 10) pmt_dir_rot = det.pmts[det.pmts.du == du].dir pmt_pos_rot = det.pmts[det.pmts.du == du].pos assert np.allclose(pmt_dir, pmt_dir_rot) assert np.allclose(pmt_pos, pmt_pos_rot) assert np.allclose(pmt_dir_other_dus, det.pmts[det.pmts.du != du].dir) assert np.allclose(pmt_pos_other_dus, det.pmts[det.pmts.du != du].pos)
def test_rotate_dom_by_yaw(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse() # here, only one PMT is checked dom_id = 1 heading = 23 channel_id = 0 pmt_dir = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id].copy() pmt_dir_rot = qrot_yaw(pmt_dir, heading) det.rotate_dom_by_yaw(dom_id, heading) assert np.allclose(pmt_dir_rot, det.pmts[det.pmts.dom_id == dom_id].dir[channel_id]) assert np.allclose( [0.92050485, 0.39073113, 0], det.pmts[det.pmts.dom_id == dom_id].pos[channel_id], )
def test_center_of_mass_with_another_detx(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse_doms() assert np.allclose([-0.2, 0., 0.2], det.com)
def test_center_of_mass(self): det = Detector() det._det_file = EXAMPLE_DETX det._parse_doms() assert np.allclose([2.4, 2.5, 2.6], det.com)
def test_center_of_mass_with_another_detx(self): det = Detector() det._det_file = EXAMPLE_DETX_RADIAL det._parse() assert np.allclose([-0.2, 0.0, 0.2], det.com)
def test_center_of_mass(self): det = Detector() det._det_file = EXAMPLE_DETX det._parse() assert np.allclose([2.4, 2.5, 2.6], det.com)