def setUp(self): self.mock_station = Mock() self.detector_1 = clusters.Detector(self.mock_station, (1, 0, 0), 'LR') self.detector_2 = clusters.Detector(self.mock_station, (-1, 2, 1), 'UD') self.detector_s = clusters.Detector(self.mock_station, (sentinel.x, sentinel.y, sentinel.z), sentinel.orientation) self.detector_4d = clusters.Detector(station=self.mock_station, position=([0, 5], [0, 5], [0, 5]), detector_timestamps=[0, 5])
def test_get_detector_particles_with_real_data(self): simulation = self.setup_simulation_with_real_data() station = Mock() detector = clusters.Detector(station, 0, 0, 'UD') station.get_xyalpha_coordinates.return_value = (0, 0, 0) particles = simulation.get_detector_particles(detector) ids = [x['id'] for x in particles] self.assertEqual(ids, [0, 1, 2, 5]) station.get_xyalpha_coordinates.return_value = (.2, 0, 0) particles = simulation.get_detector_particles(detector) ids = [x['id'] for x in particles] self.assertEqual(ids, [0, 1, 3, 5]) station.get_xyalpha_coordinates.return_value = (.2, 0, -pi / 4) particles = simulation.get_detector_particles(detector) ids = [x['id'] for x in particles] self.assertEqual(ids, [0, 3, 5]) simulation.data.close()
def setUp(self): self.mock_station = Mock() self.detector_1 = clusters.Detector(self.mock_station, 1, 0, 'LR') self.detector_2 = clusters.Detector(self.mock_station, -1, 2, 'UD')