km3pipe.calib

Calibration.

Module Contents

Classes

Calibration

A module which applies time, position and rotation corrections to hits.

CalibrationService

A service which provides calibration routines for hits

Functions

apply_t0_nb(times, dom_ids, channel_ids, lookup_tables)

Apply t0s using a lookup table of tuples (dom_id, calib)

slew(tot[, variant])

Calculate the time slewing of a PMT response for a given ToT

Attributes

log

km3pipe.calib.log[source]
class km3pipe.calib.Calibration(name=None, **parameters)[source]

A module which applies time, position and rotation corrections to hits.

This module also calibrates MC hits, but be aware, t0s are not appended to the MC hit times. Additionally, the global PMT ID is added to regular hits as pmt_id and in case of MC hits, the dom_id and channel_id (DAQ) are set.

Parameters:
apply: bool, optional [default=True]

Apply the calibration to the hits (add position/direction/t0)?

filename: str, optional [default=None]

DetX file with detector description.

det_id: int, optional

.detx ID of detector (when retrieving from database).

t0set: optional

t0set (when retrieving from database).

calibset: optional

calibset (when retrieving from database).

key: str, optional [default=”Hits”]

the blob key of the hits

outkey: str, optional [default=”CalibHits”]

the output blob key of the calibrated hits

key_mc: str, optional [default=”McHits”]

the blob key of the MC hits (if present)

outkey_mc: str, optional [default=”CalibMcHits”]

the output blob key of the calibrated MC hits

name = 'Calibration'[source]
configure()[source]

Configure module, like instance variables etc.

process(blob)[source]

Knead the blob and return it

get_detector()[source]

Return the detector

dus(hits)[source]

Return the DUs for given hits

floors(hits)[source]

Return the floors for given hits

apply_t0(hits)[source]

Apply only t0s

apply(hits, no_copy=False, correct_slewing=True, slewing_variant=3)[source]

Add x, y, z, t0 (and du, floor if DataFrame) columns to the hits.

km3pipe.calib.apply_t0_nb(times, dom_ids, channel_ids, lookup_tables)[source]

Apply t0s using a lookup table of tuples (dom_id, calib)

class km3pipe.calib.CalibrationService(name=None, **parameters)[source]

A service which provides calibration routines for hits

Parameters:
filename: str, optional [default=None]

DetX file with detector description.

det_id: int, optional

.detx ID of detector (when retrieving from database).

t0set: optional

t0set (when retrieving from database).

calibset: optional

calibset (when retrieving from database).

detector: kp.hardware.Detector, optional
property detector[source]
property calibration[source]
name = 'Calibration'[source]
configure()[source]

Configure module, like instance variables etc.

load_calibration(filename=None, det_id=None, t0set=None, calibset=None)[source]

Load another calibration

calibrate(hits, correct_slewing=True)[source]
get_detector()[source]

Extra getter to be as lazy as possible (expose triggers otherwise

get_calibration()[source]

Extra getter to be as lazy as possible (expose triggers otherwise

correct_slewing(hits)[source]

Apply time slewing correction to the hit times

km3pipe.calib.slew(tot, variant=3)[source]

Calculate the time slewing of a PMT response for a given ToT

Parameters:
tot: int or np.array(int)

Time over threshold value of a hit

variant: int, optional

The variant of the slew calculation. 1: The first parametrisation approach 2: Jannik’s improvement of the parametrisation 3: The latest lookup table approach based on lab measurements.

Returns:
time: int

Time slewing, which has to be subtracted from the original hit time.