Пример #1
0
    def test_wrong_type(self):
        e = Event.empty_event()

        with self.assertRaises(TypeError):
            e.event_number = "abc"

        with self.assertRaises(TypeError):
            e.event_number = 3.0
Пример #2
0
 def example_event(self, channels_with_something):
     channels = np.array(channels_with_something, dtype='float64')
     e = Event.empty_event()
     e.peaks.append(Peak({'left':  5,
                          'right': 9,
                          'type':  'S2',
                          'detector':  'tpc',
                          'area': 123,
                          'area_per_channel': channels}))
     return e
Пример #3
0
    def test_peaks(self):
        e = Event.empty_event()
        e.peaks = [Peak(
            area=0,
            index_of_maximum=0,
            detector='tpc')]

        self.assertEqual(len(e.peaks), 1)
        self.assertIsInstance(e.peaks[0], Peak)
        self.assertEqual(e.peaks[0].area, 0)
Пример #4
0
    def test_peaks_append(self):
        e = Event.empty_event()
        e.peaks.append(Peak({'area': 2.0,
                             'index_of_maximum': 0,
                             'type': 'S1',
                             'detector':         'tpc'}))

        self.assertEqual(len(e.peaks), 1)
        self.assertIsInstance(e.peaks[0], Peak)
        self.assertEqual(e.peaks[0].area, 2.0)
Пример #5
0
    def test_s1_helper_method(self):
        e = Event.empty_event()
        e.peaks.append(Peak({'area': 2.0,
                             'index_of_maximum': 0,
                             'type': 's1',
                             'detector':         'tpc', }))

        self.assertEqual(len(e.S1s()), 1)
        self.assertIsInstance(e.S1s()[0], Peak)
        self.assertEqual(e.S1s()[0].area, 2.0)
Пример #6
0
 def example_event(channels_with_something, area_per_channel=1):
     bla = np.zeros(243)
     bla[np.array(channels_with_something)] = area_per_channel
     e = Event.empty_event()
     e.peaks.append(Peak({'left':  5,
                          'right': 9,
                          'type':  'S2',
                          'detector':  'tpc',
                          'area_per_channel': bla}))
     return e
Пример #7
0
    def setUp(self):
        self.pax = core.Processor(config_names='XENON100',
                                  just_testing=True,
                                  config_dict={'pax': {'plugin_group_names': ['test'],
                                                       'test': ['WeightedSum.PosRecWeightedSum',
                                                                'TopPatternFit.PosRecTopPatternFit'],
                                                       'logging_level': 'debug'}})
        self.guess_plugin = self.pax.get_plugin_by_name('PosRecWeightedSum')
        self.plugin = self.pax.get_plugin_by_name('PosRecTopPatternFit')

        self.e = Event.empty_event()
Пример #8
0
    def setUp(self):  # noqa
        self.pax = core.Processor(config_names='XENON100', just_testing=True, config_dict={'pax': {
            'plugin_group_names': ['test'],
            'test':               'WeightedSum.PosRecWeightedSum'}})
        self.posrec_plugin = self.pax.get_plugin_by_name('PosRecWeightedSum')

        self.e = Event.empty_event()

        self.e.peaks.append(Peak({'left':  5,
                                  'right': 9,
                                  'type':  's2'}))
Пример #9
0
 def example_event(channels_with_something):
     bla = np.zeros(242)
     bla[np.array(channels_with_something)] = 1
     e = Event.empty_event()
     e.peaks.append(
         Peak({
             'left': 5,
             'right': 9,
             'type': 'unknown',
             'detector': 'tpc',
             'area_per_channel': bla,
         }))
     return e
Пример #10
0
 def example_event(self, channels_with_something):
     channels = np.array(channels_with_something, dtype='float64')
     e = Event.empty_event()
     e.peaks.append(
         Peak({
             'left': 5,
             'right': 9,
             'type': 'S2',
             'detector': 'tpc',
             'area': 123,
             'area_per_channel': channels
         }))
     return e
 def example_event():
     top_hits = [7, 8, 8, 5, 8, 10, 6, 9, 3, 7, 6, 4, 5, 2, 1, 0, 7, 1, 3, 1, 4, 2, 5, 1, 4, 3,
                 1, 3, 2, 4, 3, 0, 4, 4, 1, 6, 2, 4, 9, 12, 8, 10, 9, 6, 9, 1, 2, 1, 2, 1, 4, 10,
                 0, 0, 1, 2, 1, 0, 2, 3, 6, 1, 3, 2, 3, 5, 2, 6, 30, 18, 24, 10, 8, 3, 4, 2, 4, 2,
                 1, 4, 3, 4, 5, 5, 2, 1, 2, 2, 2, 4, 12, 48, 139, 89, 19, 9, 3, 4, 2, 3, 1, 1, 6,
                 0, 3, 1, 2, 4, 12, 97, 87, 15, 6, 3, 4, 4, 0, 2, 3, 6, 13, 21, 3, 4, 3, 1, 7]
     hits = np.append(top_hits, np.zeros(254 - 127))
     e = Event.empty_event()
     e.peaks.append(Peak({'left':  5,
                          'right': 9,
                          'type':  'S2',
                          'detector':  'tpc',
                          'area': 123,
                          'area_per_channel': hits}))
     return e
Пример #12
0
    def setUp(self):  # noqa
        self.pax = core.Processor(config_names='XENON100',
                                  just_testing=True,
                                  config_dict={
                                      'pax': {
                                          'plugin_group_names': ['test'],
                                          'test':
                                          'WeightedSum.PosRecWeightedSum'
                                      }
                                  })
        self.posrec_plugin = self.pax.get_plugin_by_name('PosRecWeightedSum')

        self.e = Event.empty_event()

        self.e.peaks.append(Peak({'left': 5, 'right': 9, 'type': 's2'}))
Пример #13
0
    def test_s1_helper_method_sort(self):
        areas = [3.0, 1.0, 2.0, 1.2]

        e = Event.empty_event()
        for area in areas:
            e.peaks.append(Peak({'area': area,
                                 'type': 's2',
                                 'detector': 'tpc'}))

        s2s = e.S2s()
        self.assertEqual(len(s2s), len(areas))

        # Please note the areas should come out in reverse order (largest first)
        areas = sorted(areas, reverse=True)

        for i, area in enumerate(areas):
            self.assertIsInstance(s2s[i], Peak)
            self.assertEqual(s2s[i].area, area)
Пример #14
0
 def example_event():
     # Hitpattern taken from "S2_5e3Phts_1e5Evts.root"
     # MC truth (x,y) = (100.833, 177.593) [mm]
     # Recontructed by Yuehuans c++/ROOT code at (102.581, 177.855) [mm]
     # Reconstucted by the PAX implementation at (10.258076101568305 17.785535721706857) [cm]
     top_hits = [7, 8, 8, 5, 8, 10, 6, 9, 3, 7, 6, 4, 5, 2, 1, 0, 7, 1, 3, 1, 4, 2, 5, 1, 4, 3,
                 1, 3, 2, 4, 3, 0, 4, 4, 1, 6, 2, 4, 9, 12, 8, 10, 9, 6, 9, 1, 2, 1, 2, 1, 4, 10,
                 0, 0, 1, 2, 1, 0, 2, 3, 6, 1, 3, 2, 3, 5, 2, 6, 30, 18, 24, 10, 8, 3, 4, 2, 4, 2,
                 1, 4, 3, 4, 5, 5, 2, 1, 2, 2, 2, 4, 12, 48, 139, 89, 19, 9, 3, 4, 2, 3, 1, 1, 6,
                 0, 3, 1, 2, 4, 12, 97, 87, 15, 6, 3, 4, 4, 0, 2, 3, 6, 13, 21, 3, 4, 3, 1, 7]
     hits = np.append(top_hits, np.zeros(254 - 127))
     e = Event.empty_event()
     e.peaks.append(Peak({'left':  5,
                          'right': 9,
                          'type':  'S2',
                          'detector':  'tpc',
                          'area_per_channel': hits}))
     return e
Пример #15
0
    def setUp(self):
        self.pax = core.Processor(
            config_names='XENON100',
            just_testing=True,
            config_dict={
                'pax': {
                    'plugin_group_names': ['test'],
                    'test': [
                        'WeightedSum.PosRecWeightedSum',
                        'TopPatternFit.PosRecTopPatternFit'
                    ],
                    'logging_level':
                    'debug'
                }
            })
        self.guess_plugin = self.pax.get_plugin_by_name('PosRecWeightedSum')
        self.plugin = self.pax.get_plugin_by_name('PosRecTopPatternFit')

        self.e = Event.empty_event()
Пример #16
0
 def example_event():
     top_hits = [
         7, 8, 8, 5, 8, 10, 6, 9, 3, 7, 6, 4, 5, 2, 1, 0, 7, 1, 3, 1, 4, 2,
         5, 1, 4, 3, 1, 3, 2, 4, 3, 0, 4, 4, 1, 6, 2, 4, 9, 12, 8, 10, 9, 6,
         9, 1, 2, 1, 2, 1, 4, 10, 0, 0, 1, 2, 1, 0, 2, 3, 6, 1, 3, 2, 3, 5,
         2, 6, 30, 18, 24, 10, 8, 3, 4, 2, 4, 2, 1, 4, 3, 4, 5, 5, 2, 1, 2,
         2, 2, 4, 12, 48, 139, 89, 19, 9, 3, 4, 2, 3, 1, 1, 6, 0, 3, 1, 2,
         4, 12, 97, 87, 15, 6, 3, 4, 4, 0, 2, 3, 6, 13, 21, 3, 4, 3, 1, 7
     ]
     hits = np.append(top_hits, np.zeros(254 - 127))
     e = Event.empty_event()
     e.peaks.append(
         Peak({
             'left': 5,
             'right': 9,
             'type': 'S2',
             'detector': 'tpc',
             'area': 123,
             'area_per_channel': hits
         }))
     return e
Пример #17
0
 def example_event():
     # Hitpattern taken from "S2_5e3Phts_1e5Evts.root"
     # MC truth (x,y) = (100.833, 177.593) [mm]
     # Recontructed by Yuehuans c++/ROOT code at (102.581, 177.855) [mm]
     # Reconstucted by the PAX implementation at (10.258076101568305 17.785535721706857) [cm]
     top_hits = [
         7, 8, 8, 5, 8, 10, 6, 9, 3, 7, 6, 4, 5, 2, 1, 0, 7, 1, 3, 1, 4, 2,
         5, 1, 4, 3, 1, 3, 2, 4, 3, 0, 4, 4, 1, 6, 2, 4, 9, 12, 8, 10, 9, 6,
         9, 1, 2, 1, 2, 1, 4, 10, 0, 0, 1, 2, 1, 0, 2, 3, 6, 1, 3, 2, 3, 5,
         2, 6, 30, 18, 24, 10, 8, 3, 4, 2, 4, 2, 1, 4, 3, 4, 5, 5, 2, 1, 2,
         2, 2, 4, 12, 48, 139, 89, 19, 9, 3, 4, 2, 3, 1, 1, 6, 0, 3, 1, 2,
         4, 12, 97, 87, 15, 6, 3, 4, 4, 0, 2, 3, 6, 13, 21, 3, 4, 3, 1, 7
     ]
     hits = np.append(top_hits, np.zeros(254 - 127))
     e = Event.empty_event()
     e.peaks.append(
         Peak({
             'left': 5,
             'right': 9,
             'type': 'S2',
             'detector': 'tpc',
             'area_per_channel': hits
         }))
     return e
Пример #18
0
 def test_does_not_exist(self):
     e = Event.empty_event()
     with self.assertRaises(AttributeError):
         e.does_not_exist = 3.0
Пример #19
0
 def test_defaults(self):
     e = Event.empty_event()
     self.assertEqual(e.event_number, 0)
     self.assertEqual(e.peaks, [])
Пример #20
0
 def test_to_dict(self):
     e = Event.empty_event()
     e.to_dict()
Пример #21
0
 def test_to_json(self):
     e = Event.empty_event()
     e.to_json()
Пример #22
0
 def test_good(self):
     e = Event.empty_event()
     e.event_number = 3
     self.assertEqual(e.event_number, 3)