Project

General

Profile

Feature #993 » calibration.py

Wilson, Antony, 12 July 2012 13:50

 
1
#!/usr/bin/env python
2
""" Calibration """
3

    
4
from cdb import Calibration
5

    
6
_TEST_SERVER = 'http://rgma19.pp.rl.ac.uk:8080'
7
_CALI = Calibration(_TEST_SERVER)
8

    
9
print "API Version: " + _CALI.get_version()
10
print "Server name: " + _CALI.get_name()
11

    
12
print _CALI
13

    
14
print "Devices:" + str(_CALI.list_devices())
15

    
16
_DEVICE = 'EMR'
17
_TYPE = 'test'
18
_TS = '2012-05-27 12:00:00.0'
19
_TS_END = '2012-06-27 12:00:00.0'
20
_ID = 1
21

    
22
_CURRENT_CALI = _CALI.get_current_calibration(_DEVICE, _TYPE)
23
print "Current calibration for detector"
24
print _CURRENT_CALI 
25

    
26
_RUN_CALI = _CALI.get_calibration_for_run(_DEVICE, 4161, _TYPE)
27
print "Calibration for run"
28
print _RUN_CALI
29

    
30
_DATE_CALI = _CALI.get_calibration_for_date(_DEVICE, _TS, _TYPE)
31
print "Calibration for date"
32
print _DATE_CALI
33

    
34
_ID_CALI = _CALI.get_calibration_for_id(_ID)
35
print "Calibration for id"
36
print _ID_CALI
37

    
38
_IDS = _CALI.get_ids(_TS, _TS_END) 
39
print "Calibration ids"
40
for _id in _IDS:
41
    print "id:" + _id
42
    print _IDS.get(_id)
43
    print
44

    
(1-1/2)