forked from NSLS-II/lsdc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lsdcOlog.py
executable file
·49 lines (37 loc) · 1.45 KB
/
lsdcOlog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
from pyOlog import OlogClient
from pyOlog.OlogDataTypes import *
import os
global client
client = None
logbook = "Operations"
url = os.environ["OLOG_URL"]
username = os.environ["OLOG_USER"]
password = os.environ["OLOG_PASS"]
default_owner="olog_logs"
owner = default_owner
def toOlog(imagePath,comment,omega_pv=None):
global client
if (client==None):
client = OlogClient(url, username, password)
att = Attachment(open(imagePath,"rb"))
if (omega_pv==None):
propOmega = Property(name='motorPosition', attributes={'id':'XF:AMXFMX{MC-Goni}Omega.RBV', 'name':'Omega', 'value':'offline', 'unit':'deg'})
else:
propOmega = Property(name='motorPosition', attributes={'id':'XF:AMXFMX{MC-Goni}Omega.RBV', 'name':'Omega', 'value':str(omega_pv.get()), 'unit':'deg'})
client.createProperty(propOmega)
entry = LogEntry(text=comment, owner="HHS", logbooks=[Logbook("raster")], properties=[propOmega], attachments=[att])
client.log(entry)
def toOlogComment(comment):
global client
if (client==None):
client = OlogClient(url, username, password)
entry = LogEntry(text=comment, owner=owner, logbooks=[Logbook(logbook)])
client.log(entry)
def toOlogPicture(imagePath,comment):
global client
if (client==None):
client = OlogClient(url, username, password)
att = Attachment(open(imagePath,"rb"))
entry = LogEntry(text=comment, owner=owner, logbooks=[Logbook(logbook)], attachments=[att])
client.log(entry)