:mod:`km3pipe.db` ================= .. py:module:: km3pipe.db .. autoapi-nested-parse:: Database utilities. .. !! processed by numpydoc !! Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: km3pipe.db.DBManager km3pipe.db.StreamDS km3pipe.db.ParametersContainer km3pipe.db.DOMContainer km3pipe.db.DOM km3pipe.db.TriggerSetup km3pipe.db.CLBMap Functions ~~~~~~~~~ .. autoapisummary:: km3pipe.db.we_are_in_lyon km3pipe.db.read_csv km3pipe.db.make_empty_dataset km3pipe.db.add_datetime km3pipe.db.clbupi2ahrsupi km3pipe.db.show_ahrs_calibration .. data:: SKIP_SIGNATURE_HINTS :annotation: = False .. data:: input .. data:: log .. data:: UTC_TZ .. data:: BASE_URL :annotation: = https://km3netdbweb.in2p3.fr .. function:: we_are_in_lyon() Check if we are on a Lyon machine .. !! processed by numpydoc !! .. function:: read_csv(text, sep='\t') Create a DataFrame from CSV text .. !! processed by numpydoc !! .. function:: make_empty_dataset() Create an empty dataset .. !! processed by numpydoc !! .. py:class:: DBManager(username=None, password=None, url=None, temporary=False) Bases::class:`object` A wrapper for the KM3NeT Web DB .. !! processed by numpydoc !! .. attribute:: detectors .. attribute:: parameters Return the parameters container for quick access to their details .. !! processed by numpydoc !! .. attribute:: doms .. attribute:: opener A reusable connection manager .. !! processed by numpydoc !! .. method:: datalog(self, parameter, run, maxrun=None, det_id='D_ARCA001') Retrieve datalogs for given parameter, run(s) and detector .. !! processed by numpydoc !! .. method:: run_table(self, det_id='D_ARCA001') .. method:: get_det_id(self, det_oid) Convert detector string representation (OID) to serialnumber .. !! processed by numpydoc !! .. method:: get_det_oid(self, det_id) Convert detector serialnumber to string representation (OID) .. !! processed by numpydoc !! .. method:: to_det_id(self, det_id_or_det_oid) Convert det ID or OID to det ID .. !! processed by numpydoc !! .. method:: to_det_oid(self, det_id_or_det_oid) Convert det OID or ID to det OID .. !! processed by numpydoc !! .. method:: trigger_setup(self, runsetup_oid) Retrieve the trigger setup for a given runsetup OID .. !! processed by numpydoc !! .. method:: detx(self, det_id, t0set=None, calibration=None) Retrieve the detector file for given detector id If t0set is given, append the calibration data. .. !! processed by numpydoc !! .. method:: ahrs(self, run, maxrun=None, clbupi=None, det_id='D_ARCA001') Retrieve AHRS values for given run(s) (optionally CLBs) and detector .. !! processed by numpydoc !! .. method:: request_sid_cookie(self, username, password) Request cookie for permanent session token. .. !! processed by numpydoc !! .. method:: restore_session(self, cookie) Establish databse connection using permanent session cookie .. !! processed by numpydoc !! .. method:: request_permanent_session(self, username=None, password=None) .. method:: login(self, username, password) Login to the database and store cookies for upcoming requests. .. !! processed by numpydoc !! .. function:: add_datetime(dataframe, timestamp_key='UNIXTIME') Add an additional DATETIME column with standar datetime format. This currently manipulates the incoming DataFrame! .. !! processed by numpydoc !! .. py:class:: StreamDS(username=None, password=None, url=None, temporary=False) Bases::class:`object` Access to the streamds data stored in the KM3NeT database. .. !! processed by numpydoc !! .. attribute:: streams A list of available streams .. !! processed by numpydoc !! .. method:: mandatory_selectors(self, stream) A list of mandatory selectors for a given stream .. !! processed by numpydoc !! .. method:: optional_selectors(self, stream) A list of optional selectors for a given stream .. !! processed by numpydoc !! .. method:: help(self, stream) Show the help for a given stream. .. !! processed by numpydoc !! .. method:: print_streams(self) Print a coloured list of streams and its parameters .. !! processed by numpydoc !! .. method:: get(self, stream, fmt='txt', **kwargs) Get the data for a given stream manually .. !! processed by numpydoc !! .. py:class:: ParametersContainer(parameters) Bases::class:`object` Provides easy access to parameters .. !! processed by numpydoc !! .. attribute:: names A list of parameter names .. !! processed by numpydoc !! .. method:: get_parameter(self, parameter) Return a dict for given parameter .. !! processed by numpydoc !! .. method:: get_converter(self, parameter) Generate unit conversion function for given parameter .. !! processed by numpydoc !! .. method:: unit(self, parameter) Get the unit for given parameter .. !! processed by numpydoc !! .. method:: oid2name(self, oid) Look up the parameter name for a given OID .. !! processed by numpydoc !! .. py:class:: DOMContainer(doms) Bases::class:`object` Provides easy access to DOM parameters stored in the DB. .. !! processed by numpydoc !! .. method:: ids(self, det_id) Return a list of DOM IDs for given detector .. !! processed by numpydoc !! .. method:: clbupi2domid(self, clb_upi, det_id) Return DOM ID for given CLB UPI and detector .. !! processed by numpydoc !! .. method:: clbupi2floor(self, clb_upi, det_id) Return Floor ID for given CLB UPI and detector .. !! processed by numpydoc !! .. method:: domid2floor(self, dom_id, det_id) Return Floor ID for given DOM ID and detector .. !! processed by numpydoc !! .. method:: via_omkey(self, omkey, det_id) Return DOM for given OMkey (DU, floor) .. !! processed by numpydoc !! .. method:: via_dom_id(self, dom_id, det_id) Return DOM for given dom_id .. !! processed by numpydoc !! .. method:: via_clb_upi(self, clb_upi, det_id) return DOM for given CLB UPI .. !! processed by numpydoc !! .. py:class:: DOM(clb_upi, dom_id, dom_upi, du, det_oid, floor) Bases::class:`object` Represents a DOM .. !! processed by numpydoc !! .. attribute:: omkey .. classmethod:: from_json(cls, json) .. py:class:: TriggerSetup(runsetup_oid, name, det_id, description, optical_df, acoustic_df) Bases::class:`object` .. function:: clbupi2ahrsupi(clb_upi) Generate AHRS UPI from CLB UPI. .. !! processed by numpydoc !! .. function:: show_ahrs_calibration(clb_upi, version='3') Show AHRS calibration data for given `clb_upi`. .. !! processed by numpydoc !! .. py:class:: CLBMap(det_oid) Bases::class:`object` .. attribute:: par_map .. attribute:: upi A dict of CLBs with UPI as key .. !! processed by numpydoc !! .. attribute:: dom_id A dict of CLBs with DOM ID as key .. !! processed by numpydoc !! .. method:: base(self, du) Return the base CLB for a given DU .. !! processed by numpydoc !! .. data:: CLB