示例#1
0
文件: daq.py 项目: KM3NeT/km3pipe
 def __init__(self, host, port=1302, base=""):
     self._host = host
     self._port = port
     self._base = base
     self._url = "http://{}:{}/mon/{}".format(self._host, self._port,
                                              self._base)
     self._available_parameters = []
     self.log = get_logger(self.__class__.__name__)
     self.cprint = get_printer(self.__class__.__name__)
示例#2
0
文件: daq.py 项目: tamasgal/km3pipe
 def __init__(self, host, port=1302, base=''):
     self._host = host
     self._port = port
     self._base = base
     self._url = "http://{}:{}/mon/{}".format(
         self._host, self._port, self._base
     )
     self._available_parameters = []
     self.log = get_logger(self.__class__.__name__)
     self.print = get_printer(self.__class__.__name__)
示例#3
0
文件: daq.py 项目: KM3NeT/km3pipe
import numpy as np

from thepipe import Module, Blob
from km3pipe.dataclasses import Table
from km3pipe.sys import ignored
from km3pipe.logger import get_logger, get_printer

__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration."
__credits__ = []
__license__ = "MIT"
__maintainer__ = "Tamas Gal"
__email__ = "*****@*****.**"
__status__ = "Development"

log = get_logger(__name__)  # pylint: disable=C0103

DATA_TYPES = {
    101: "DAQSuperFrame",
    201: "DAQSummaryFrame",
    # Using the same class for all timeslices since they are structurally
    # identical (until now)
    1001: "DAQTimeslice",  # Type of erroneous timeslice data
    1002: "DAQTimeslice",  # L0
    1003: "DAQTimeslice",  # L1
    1004: "DAQTimeslice",  # L2
    1005: "DAQTimeslice",  # SN
    2001: "DAQSummaryslice",
    10001: "DAQEvent",
}
MINIMAL_RATE_HZ = 2.0e3
示例#4
0
文件: physics.py 项目: KM3NeT/km3pipe
    TAN_CHERENKOV,
    V_LIGHT_WATER,
    C_LIGHT,
)
import km3pipe.math
import km3pipe.extras

__author__ = "Zineb ALY"
__copyright__ = "Copyright 2020, Tamas Gal and the KM3NeT collaboration."
__credits__ = []
__license__ = "MIT"
__maintainer__ = "Zineb ALY"
__email__ = "*****@*****.**"
__status__ = "Development"

log = get_logger(__name__)


def cherenkov(calib_hits, track):
    """Compute parameters of Cherenkov photons emitted from a track and hitting a PMT.
    calib_hits is the table of calibrated hits of the track.

    Parameters
    ----------
    calib_hits : kp Table or a DataFrame or a numpy recarray or a dict.
        Table of calibrated hits with the following parameters:
            - pos_x.
            - pos_y.
            - pos_z.
            - dir_x.
            - dir_y.
示例#5
0
文件: ch.py 项目: tamasgal/km3pipe
import numpy as np
from collections import deque
try:
    from Queue import Queue, Empty
except ImportError:
    from queue import Queue, Empty

__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration."
__credits__ = []
__license__ = "MIT"
__maintainer__ = "Tamas Gal"
__email__ = "*****@*****.**"
__status__ = "Development"

log = get_logger(__name__)    # pylint: disable=C0103


class CHPump(Pump):
    """A pump for ControlHost data."""

    def configure(self):
        self.host = self.get('host') or '127.0.0.1'
        self.port = self.get('port') or 5553
        self.tags = self.get('tags') or "MSG"
        self.timeout = self.get('timeout') or 60 * 60 * 24
        self.max_queue = self.get('max_queue') or 50
        self.key_for_data = self.get('key_for_data') or 'CHData'
        self.key_for_prefix = self.get('key_for_prefix') or 'CHPrefix'
        self.subscription_mode = self.get('subscription_mode', default='wait')
        self.cuckoo_warn = Cuckoo(60 * 5, log.warning)
示例#6
0
    'Floor': 20,
    'CLBUPI': '200',
    'DetOID': DET_ID
}, {
    'DOMId': 3,
    'Floor': 30,
    'CLBUPI': '300',
    'DetOID': DET_ID
}, {
    'DOMId': 4,
    'Floor': 40,
    'CLBUPI': '400',
    'DetOID': 'det_id2'
}]

log = get_logger('db')

TEST_DATA_DIR = join(dirname(__file__), '../kp-data/test_data')
STREAMDS_META = join(TEST_DATA_DIR, "db/streamds_output.txt")


class TestDBManager(TestCase):
    def test_login_called_on_init_when_credentials_are_provided(self):
        user = '******'
        pwd = 'god'

        DBManager.login = MagicMock()
        DBManager(username=user, password=pwd, temporary=True)
        self.assertEqual(1, DBManager.login.call_count)
        self.assertTupleEqual((user, pwd), DBManager.login.call_args[0])
示例#7
0
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')    # noqa
import matplotlib.pyplot as plt
import matplotlib.dates as md
import pandas as pd

from km3pipe import Pipeline, Module
from km3pipe.config import Config
from km3pipe.io import CHPump
from km3pipe.io.daq import (DAQPreamble, DAQEvent)
from km3pipe.logger import get_logger
import km3pipe.style

km3pipe.style.use('km3pipe')
log = get_logger("trigger_rate")

PLOTS_PATH = 'www/plots'

xfmt = md.DateFormatter('%Y-%m-%d %H:%M')
lock = threading.Lock()


def trigger_rate_sampling_period():
    try:
        return int(Config().get("Monitoring", "trigger_rate_sampling_period"))
    except (TypeError, ValueError):
        return 180


class TriggerRate(Module):
示例#8
0
Options:
    -h --help               Show this screen.
    --verbose               Print out more progress. [default: False].
    --debug                 Print out A LOT. [default: False].
    --overwrite             Overwrite output file [default: False].
"""

import os.path

import tables as tb

from km3pipe import version

from km3pipe.logger import get_logger
log = get_logger(__name__)

__author__ = "Moritz Lotze"
__copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration."
__credits__ = []
__license__ = "MIT"
__maintainer__ = "Tamas Gal and Moritz Lotze"
__email__ = "*****@*****.**"
__status__ = "Development"


def ptconcat(output_file, input_files, overwrite=False):
    """Concatenate HDF5 Files"""
    filt = tb.Filters(
        complevel=5, shuffle=True, fletcher32=True, complib='zlib'
    )
示例#9
0
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')  # noqa
import matplotlib.pyplot as plt
import matplotlib.dates as md
import pandas as pd

from km3pipe import Pipeline, Module
from km3pipe.config import Config
from km3pipe.io import CHPump
from km3pipe.io.daq import (DAQPreamble, DAQEvent)
from km3pipe.logger import get_logger
import km3pipe.style

km3pipe.style.use('km3pipe')
log = get_logger("trigger_rate")

PLOTS_PATH = 'www/plots'

xfmt = md.DateFormatter('%Y-%m-%d %H:%M')
lock = threading.Lock()


def trigger_rate_sampling_period():
    try:
        return int(Config().get("Monitoring", "trigger_rate_sampling_period"))
    except (TypeError, ValueError):
        return 180


class TriggerRate(Module):