km3dq_common.common_library

Functions

get_det_id(dataset)

Return the detector id

get_current_detector(site)

Extract the current detector names from the database

get_file_paths(dataset, qaqc_name)

For a given dataset / detector, returns the path for QAQC files

get_run_properties_from_db(det[, filt])

Retrieve run properties from the database with the km3db package

get_run_properties_from_qaqc(dataset, dq_tag[, ...])

For a given dataset/detector, returns the run numbers, their lengths,

get_run_timerange(det[, filt])

Retrieve the run start/stop by combining db and QAQC quantities to get the

get_last_n_weeks_runs_qaqc(det[, nweeks])

Extract the all runs acquired in the last nweeks of running

get_site(det)

Returns the site (ORCA or ARCA)

get_active_dus_range(det)

Retrieve the range of DU active

get_nb_qaqc_variables(qaqc_vers)

Retrieve the number of variables in the QAQC file

create_ttree_from_qaqc(det, var_to_fill, source, tag)

Create a ttree from qaqc sftp file and defect variables stored on git

compute_veto_qscore(var_prop, var_val)

Computes the veto/Q-score for a detector/tag using a QAQC source.

log_run_range(det, run_0, run_1, log_file)

Write the run range and run list on disk

read_qaqc_file(det, source, qaqc_name, run_range)

sftp QAQC file reading

decode_source_byte(value, v_prop)

Decode the source of degradation stored in the TTree

Module Contents

km3dq_common.common_library.get_det_id(dataset)[source]

Return the detector id

km3dq_common.common_library.get_current_detector(site)[source]

Extract the current detector names from the database

km3dq_common.common_library.get_file_paths(dataset, qaqc_name)[source]

For a given dataset / detector, returns the path for QAQC files

km3dq_common.common_library.get_run_properties_from_db(det, filt='PHYS')[source]

Retrieve run properties from the database with the km3db package Inputs: - det: string like (e.g: D0ARCA030, D1ORCA024…) - filt: string containing the accepted run type (PHYS, COMM…) separated by a space

km3dq_common.common_library.get_run_properties_from_qaqc(dataset, dq_tag, origin='qaqc_sftp', startrun=0, endrun=1000000000.0)[source]

For a given dataset/detector, returns the run numbers, their lengths, time counter… A dataset may be restricted to a user-defined run range Source: QAQC file

km3dq_common.common_library.get_run_timerange(det, filt='PHYS')[source]

Retrieve the run start/stop by combining db and QAQC quantities to get the most accurate timing. If QAQC data exist (normally for all PHYS runs), use them, otherwise use the DB ones So far used only in km3net_lw_db_interface

Inputs: - det: string like (e.g: D0ARCA030, D1ORCA024…) - filt: string containing the accepted run type (PHYS, COMM…) separated by a space

Outputs: - dictionary with run as key and a list of [run_start, run_stop, source, runtype] with source = 0 (QAQC) or 1 (DB only)

km3dq_common.common_library.get_last_n_weeks_runs_qaqc(det, nweeks=2)[source]

Extract the all runs acquired in the last nweeks of running

km3dq_common.common_library.get_site(det)[source]

Returns the site (ORCA or ARCA)

km3dq_common.common_library.get_active_dus_range(det)[source]

Retrieve the range of DU active To be improved with database information

km3dq_common.common_library.get_nb_qaqc_variables(qaqc_vers)[source]

Retrieve the number of variables in the QAQC file NB: in a near future, the det argument should be replaced by a Jpp version === Arguments === - det : detector name - [string] - Ex: “D0ARCA021”, “D0ORCA018”…

=== Output === - Number of QAQC variables

km3dq_common.common_library.create_ttree_from_qaqc(det, var_to_fill, source, tag, append_veto_qsco=False)[source]

Create a ttree from qaqc sftp file and defect variables stored on git It includes some advanced check about the QAQC file integrity. === Arguments === - det : detector name - [string] - Ex: “D0ARCA021”, “D0ORCA018”… - var_to_fill : QAQC variables or defect to fill - [array of string] -

Ex: [‘run’, ‘timestampdiff’, ‘def_operation’, ‘def_oos’]

  • source : QAQC source, a priori “qaqc_sftp” - [string]

  • tagdata-quality tag (not its name) as created by

    configure_dataquality_tag

  • append_veto_qsco: append the veto and Qscore - [boolean]

=== Output === - TTree - Error log

km3dq_common.common_library.compute_veto_qscore(var_prop, var_val)[source]

Computes the veto/Q-score for a detector/tag using a QAQC source.

km3dq_common.common_library.log_run_range(det, run_0, run_1, log_file)[source]

Write the run range and run list on disk

km3dq_common.common_library.read_qaqc_file(det, source, qaqc_name, run_range)[source]

sftp QAQC file reading === Arguments === - det : detector name - [string] - Ex: “D0ARCA021”, “D0ORCA018”… - source : QAQC source, a priori “qaqc_sftp” - [string] - qaqc_name : - run_range : string as defined in DQ tag “[min_run]-[max_run]” (inclusive)

=== Output === - TTree - Error log

km3dq_common.common_library.decode_source_byte(value, v_prop)[source]

Decode the source of degradation stored in the TTree NB: the source is either a QAQC variable either a defect type ((“daq”, “operation”…)