Source code for km3dq_common.detector_fact_classes

#!/usr/bin/env python3
import re 


###############################################################################
[docs] class DetectorFact(dict): """ Detector fact classes inheriting from a dict https://realpython.com/inherit-python-dict/ """ def __init__(self): dict.__init__(self, hardware="", location="", coord_detx={"x":0., "y":0., "z":0.}, coord_utm={"x":0., "y":0., "z":0.}, position=0, status="", upi=0, site="", det="", time="", following_run=0, comment="", waveform="", emission_rate="", documentation="", author="")
[docs] def compute_utm_coord_from_detx(self): if self.site == "ARCA": self.coord_utm["x"] = self.coord_detx["x"] + 587600 self.coord_utm["y"] = self.coord_detx["y"] + 4016800 self.coord_utm["z"] = self.coord_detx["z"] else: self.coord_utm["x"] = self.coord_detx["x"] + 256500 self.coord_utm["y"] = self.coord_detx["y"] + 4743000 self.coord_utm["z"] = self.coord_detx["z"]
[docs] def compute_detx_coord_from_utm(self): if self.site == "ARCA": self.coord_detx["x"] = self.coord_utm["x"] - 587600 self.coord_detx["y"] = self.coord_utm["y"] - 4016800 self.coord_detx["z"] = self.coord_utm["z"] else: self.coord_detx["x"] = self.coord_utm["x"] - 256500 self.coord_detx["y"] = self.coord_utm["y"] - 4743000 self.coord_detx["z"] = self.coord_utm["z"]
[docs] def extract_coord_from_location(self): r = re.search( r"([du])\((-*\d+\.\d+)\,(-*\d+\.\d+)\,(-*\d+\.\d+)\)", self.location ) if r.group(1) == "d": # detx coordinates in detector fact file self.coord_detx["x"] = float(r.group(2)) self.coord_detx["y"] = float(r.group(3)) self.coord_detx["z"] = float(r.group(4)) self.compute_utm_coord_from_detx() elif r.group(1) == "u": # utm coordinates in detector fact file self.coord_utm["x"] = float(r.group(2)) self.coord_utm["y"] = float(r.group(3)) self.coord_utm["z"] = float(r.group(4)) self.compute_detx_coord_from_utm()