Source code for NuRadioReco.framework.hybrid_shower

import NuRadioReco.framework.base_shower
import pickle


[docs]class HybridShower(NuRadioReco.framework.base_shower.BaseShower): def __init__(self, name): self.__name = name self.__hybrid_detector = None super().__init__()
[docs] def get_name(self): return self.__name
[docs] def set_hybrid_detector(self, hybrid_detector): self.__hybrid_detector = hybrid_detector
[docs] def get_hybrid_detector(self): return self.__hybrid_detector
[docs] def serialize(self): base_shower_pickle = NuRadioReco.framework.base_shower.BaseShower.serialize(self) if self.__hybrid_detector is not None: det_pickle = self.__hybrid_detector.serialize() det_class = self.__hybrid_detector.__class__ detector_info = { 'data': det_pickle, 'class': det_class } else: detector_info = None data = { 'base_shower': base_shower_pickle, 'name': self.__name, 'detector': detector_info } return pickle.dumps(data, protocol=4)
[docs] def deserialize(self, data_pkl): data = pickle.loads(data_pkl) NuRadioReco.framework.base_shower.BaseShower.deserialize(self, data['base_shower']) self.__name = data['name'] if data['detector'] is not None: det = data['detector']['class']() det.deserialize(data['detector']['data']) self.set_hybrid_detector(det)