km3pipe.db

Database utilities.

Module Contents

Classes

DBManager(username=None, password=None, url=None, temporary=False) A wrapper for the KM3NeT Web DB
StreamDS(username=None, password=None, url=None, temporary=False) Access to the streamds data stored in the KM3NeT database.
ParametersContainer(parameters) Provides easy access to parameters
DOMContainer(doms) Provides easy access to DOM parameters stored in the DB.
DOM(clb_upi, dom_id, dom_upi, du, det_oid, floor) Represents a DOM
TriggerSetup(runsetup_oid, name, det_id, description, optical_df, acoustic_df)
CLBMap(det_oid)

Functions

we_are_in_lyon() Check if we are on a Lyon machine
read_csv(text, sep=’\t’) Create a DataFrame from CSV text
make_empty_dataset() Create an empty dataset
add_datetime(dataframe, timestamp_key=’UNIXTIME’) Add an additional DATETIME column with standar datetime format.
clbupi2ahrsupi(clb_upi) Generate AHRS UPI from CLB UPI.
show_ahrs_calibration(clb_upi, version=‘3’) Show AHRS calibration data for given clb_upi.
km3pipe.db.SKIP_SIGNATURE_HINTS = False[source]
km3pipe.db.input[source]
km3pipe.db.log[source]
km3pipe.db.UTC_TZ[source]
km3pipe.db.BASE_URL = https://km3netdbweb.in2p3.fr[source]
km3pipe.db.we_are_in_lyon()[source]

Check if we are on a Lyon machine

km3pipe.db.read_csv(text, sep='t')[source]

Create a DataFrame from CSV text

km3pipe.db.make_empty_dataset()[source]

Create an empty dataset

class km3pipe.db.DBManager(username=None, password=None, url=None, temporary=False)[source]

Bases:object

A wrapper for the KM3NeT Web DB

detectors[source]
parameters[source]

Return the parameters container for quick access to their details

doms[source]
opener[source]

A reusable connection manager

datalog(self, parameter, run, maxrun=None, det_id='D_ARCA001')[source]

Retrieve datalogs for given parameter, run(s) and detector

run_table(self, det_id='D_ARCA001')[source]
get_det_id(self, det_oid)[source]

Convert detector string representation (OID) to serialnumber

get_det_oid(self, det_id)[source]

Convert detector serialnumber to string representation (OID)

to_det_id(self, det_id_or_det_oid)[source]

Convert det ID or OID to det ID

to_det_oid(self, det_id_or_det_oid)[source]

Convert det OID or ID to det OID

trigger_setup(self, runsetup_oid)[source]

Retrieve the trigger setup for a given runsetup OID

detx(self, det_id, t0set=None, calibration=None)[source]

Retrieve the detector file for given detector id

If t0set is given, append the calibration data.

ahrs(self, run, maxrun=None, clbupi=None, det_id='D_ARCA001')[source]

Retrieve AHRS values for given run(s) (optionally CLBs) and detector

Request cookie for permanent session token.

restore_session(self, cookie)[source]

Establish databse connection using permanent session cookie

request_permanent_session(self, username=None, password=None)[source]
login(self, username, password)[source]

Login to the database and store cookies for upcoming requests.

km3pipe.db.add_datetime(dataframe, timestamp_key='UNIXTIME')[source]

Add an additional DATETIME column with standar datetime format.

This currently manipulates the incoming DataFrame!

class km3pipe.db.StreamDS(username=None, password=None, url=None, temporary=False)[source]

Bases:object

Access to the streamds data stored in the KM3NeT database.

streams[source]

A list of available streams

mandatory_selectors(self, stream)[source]

A list of mandatory selectors for a given stream

optional_selectors(self, stream)[source]

A list of optional selectors for a given stream

help(self, stream)[source]

Show the help for a given stream.

print_streams(self)[source]

Print a coloured list of streams and its parameters

get(self, stream, fmt='txt', **kwargs)[source]

Get the data for a given stream manually

class km3pipe.db.ParametersContainer(parameters)[source]

Bases:object

Provides easy access to parameters

names[source]

A list of parameter names

get_parameter(self, parameter)[source]

Return a dict for given parameter

get_converter(self, parameter)[source]

Generate unit conversion function for given parameter

unit(self, parameter)[source]

Get the unit for given parameter

oid2name(self, oid)[source]

Look up the parameter name for a given OID

class km3pipe.db.DOMContainer(doms)[source]

Bases:object

Provides easy access to DOM parameters stored in the DB.

ids(self, det_id)[source]

Return a list of DOM IDs for given detector

clbupi2domid(self, clb_upi, det_id)[source]

Return DOM ID for given CLB UPI and detector

clbupi2floor(self, clb_upi, det_id)[source]

Return Floor ID for given CLB UPI and detector

domid2floor(self, dom_id, det_id)[source]

Return Floor ID for given DOM ID and detector

via_omkey(self, omkey, det_id)[source]

Return DOM for given OMkey (DU, floor)

via_dom_id(self, dom_id, det_id)[source]

Return DOM for given dom_id

via_clb_upi(self, clb_upi, det_id)[source]

return DOM for given CLB UPI

class km3pipe.db.DOM(clb_upi, dom_id, dom_upi, du, det_oid, floor)[source]

Bases:object

Represents a DOM

omkey[source]
classmethod from_json(cls, json)[source]
class km3pipe.db.TriggerSetup(runsetup_oid, name, det_id, description, optical_df, acoustic_df)[source]

Bases:object

km3pipe.db.clbupi2ahrsupi(clb_upi)[source]

Generate AHRS UPI from CLB UPI.

km3pipe.db.show_ahrs_calibration(clb_upi, version='3')[source]

Show AHRS calibration data for given clb_upi.

class km3pipe.db.CLBMap(det_oid)[source]

Bases:object

par_map[source]
upi[source]

A dict of CLBs with UPI as key

dom_id[source]

A dict of CLBs with DOM ID as key

base(self, du)[source]

Return the base CLB for a given DU

km3pipe.db.CLB[source]