-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaserShutter.py
68 lines (63 loc) · 2.15 KB
/
laserShutter.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from epics import caget, caput
import time
from sardana.macroserver.macro import Macro, macro, Type
@macro()
def laserOn(self):
"""Macro laserOn"""
pvPrefix = 'SHUTTER:NOPA:'
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Open":
self.output("Laser shutter already open")
else:
caput(pvPrefix + 'Flip', 3)
time.sleep(1)
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Open":
self.output("Laser shutter opened")
else:
self.output("Could not open Laser shutter")
@macro()
def laserOff(self):
"""Macro laserOn"""
pvPrefix = 'SHUTTER:NOPA:'
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Closed":
self.output("Laser shutter already closed")
else:
caput(pvPrefix + 'Flip', 3)
time.sleep(1)
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Closed":
self.output("Laser shutter closed")
else:
self.output("Could not close Laser shutter")
@macro()
def pumpOn(self):
"""Macro laserOn"""
pvPrefix = 'SHUTTER:MOKE:'
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Open":
self.output("Pump shutter already open")
else:
caput(pvPrefix + 'Flip', 3)
time.sleep(1)
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Open":
self.output("Pump shutter opened")
else:
self.output("Could not open Pump shutter")
@macro()
def pumpOff(self):
"""Macro laserOn"""
pvPrefix = 'SHUTTER:MOKE:'
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Closed":
self.output("Pump shutter already closed")
else:
caput(pvPrefix + 'Flip', 3)
time.sleep(1)
shutterState = caget(pvPrefix + 'Shutter_RBV', as_string=True)
if shutterState == "Closed":
self.output("Pump shutter closed")
else:
self.output("Could not close Pump shutter")