def __init__(self): """ Initialise the evaluator with math functions and units """ self._current_cali = {} self.reset() cfg = Configuration() cfgdoc = cfg.getConfigJSON() cfgdoc_json = json.loads(cfgdoc) cdb_url = cfgdoc_json['cdb_download_url'] + 'calibration?wsdl' self.cdb_server = cdb.Calibration() self.cdb_server.set_url(cdb_url) #print 'Server: ', self.cdb_server.get_name(), \ # self.cdb_server.get_version() try: cdb.Calibration().get_status() except CdbPermanentError: raise CdbPermanentError("CDB error")
def test_read_access(cls): """Test that we can access the CDB with read access""" # throw exception if not available for url in READ_URL_LIST: cdb.AlarmHandler(url) cdb.Beamline(url) cdb.Cabling(url) cdb.Calibration(url) cdb.Geometry(url) cdb.PIDCtrl(url) cdb.StateMachine(url) cdb.Target(url)
def __init__(self): print "Init running" self.config = json.loads(\ Configuration().getConfigJSON(command_line_args = True)) calib_cdb_url = self.config['cdb_download_url'] + 'calibration?wsdl' self._calib = cdb.Calibration() self._calib.set_url(calib_cdb_url) print "Connected to calibration" cable_cdb_url = self.config['cdb_download_url'] + 'cabling?wsdl' self._cable = cdb.Cabling() self._cable.set_url(cable_cdb_url) self._method = None self._rnum = 0 print "Connected to cabling"
This is a script to list the existing list of calibrations in the CDB _tstart and _tend control the start/end dates between which we query the CDB _devicelist is a list of devices (detectors) queries All tracker calibrations are under the "TRACKERS" device TOF calibrations are under the name of the primary trigger detector .. i.e. the timewalk, trigger, t0 calibrations for TOF1-triggered data is under "TOF1" device """ import cdb _server = "http://cdb.mice.rl.ac.uk" _cali = cdb.Calibration(_server) _tstart = '2013-05-01 00:00:00' _tend = '2018-05-01 00:00:00' print 'LIST OF DEVICES: ', _cali.list_devices() ids = _cali.get_ids(_tstart, _tend) _devicelist = ['TOF1', 'TRACKERS'] print type(ids) #for k, v in sorted(ids.iteritems(), key=lambda x: int(x)): calidict = {} for _id, _vali in sorted(ids.iteritems()): thisDevice = _vali['device'] vFrom = _vali['valid_from'] if thisDevice not in _devicelist: