Added ParkableMotor class

This commit is contained in:
gac-furka
2023-07-24 11:55:55 +02:00
parent 4f3e750e01
commit b6746d317a
11 changed files with 333 additions and 95 deletions

138
furka.py
View File

@ -18,13 +18,17 @@ from spreadsheet import overview, print_overview, print_line_for_spreadsheet
from channels import channels, pvs
from sensors import *
from undulator import Undulators
from undulator import Mono
from undulator import Coupled_MonoUnd
#from undulator import Undulators
#from undulator import Mono
#from undulator import Coupled_MonoUnd
mono_new = PVAdjustable("SATOP11-OSGM087:SetEnergy", "SATOP11-OSGM087:photonenergy", accuracy=0.1, process_time=10, name="Mono new")
from tth import Coupled_tth
from tth import LakeShore
from tth import Coupled_THzGate
from tth import Coupled_THzGate_fixedDelta
from qspace import QSpace3D
from qspace import Wavelength
@ -32,6 +36,18 @@ from qspace import HistoryDummy
from constraints import ExtraConstraint
from epics import caput
class ParkableMotor(Motor):
def park(self):
kill_pvname = self.pvname[:-4] + "_KILL"
caput(kill_pvname, 1)
dummy = DummyAdjustable(units="au")
@ -68,30 +84,30 @@ OAPU085_vert = PVAdjustable("SATOP11-OAPU085:MOTOR_Y.VAL", process_time=1, name=
##mono_slits = PVAdjustable("SATOP11-OSGM087:EXITSLIT",pvname_done_moving="SATOP31-OEXS132:MOT_H.DMOV", name = "Mono_Slits" )
#undulators set-up
n_und_ref = 13
n_unds = [
6, 7, 8, 9, 10, 11, 12, 13, # 14 is the CHIC
15, 16, 17, 18, 19, 20, 21, 22
]
chic_fudge_offset = 0
Mon2Unds_offset = 3.0
##undulators set-up
#n_und_ref = 13
#n_unds = [
# 6, 7, 8, 9, 10, 11, 12, 13, # 14 is the CHIC
# 15, 16, 17, 18, 19, 20, 21, 22
#]
#chic_fudge_offset = 0
#Mon2Unds_offset = 3.0
und = Undulators(n_unds, n_und_ref, chic_fudge_offset, name="z Athos Undulators")
#und = Undulators(name="Undulators")
#und = Undulators(n_unds, n_und_ref, chic_fudge_offset, name="z Athos Undulators")
##und = Undulators(name="Undulators")
#Mono set up
mono_name = "Athos_mono"
pv_mono_name="SATOP11-OSGM087"
##Mono set up
#mono_name = "Athos_mono"
#pv_mono_name="SATOP11-OSGM087"
#Mon = PVAdjustable("SATOP11-OSGM087:SetEnergy", pvname_done_moving="SATOP11-OSGM087:MOVING", name="MONO")
Mon = Mono(pv_mono_name=pv_mono_name, mono_name=mono_name)
MonUnd = Coupled_MonoUnd(
n_unds, n_und_ref, chic_fudge_offset, unds_name="z Athos Undulators",
pv_mono_name=pv_mono_name, mono_name=mono_name, delta=Mon2Unds_offset,
name="Mono+Und"
)
##Mon = PVAdjustable("SATOP11-OSGM087:SetEnergy", pvname_done_moving="SATOP11-OSGM087:MOVING", name="MONO")
#Mon = Mono(pv_mono_name=pv_mono_name, mono_name=mono_name)
#MonUnd = Coupled_MonoUnd(
# n_unds, n_und_ref, chic_fudge_offset, unds_name="z Athos Undulators",
# pv_mono_name=pv_mono_name, mono_name=mono_name, delta=Mon2Unds_offset,
# name="Mono+Und"
#)
Mon_ES = PVAdjustable("SATOP11-OSGM087:EXITSLIT", pvname_done_moving="SATOP31-OEXS132:MOT_H.DMOV", name = "Mono ES")
gas_attenuator_trans = PVAdjustable("SATFE10-OGAT053:TRANSMISSION", process_time=20, name="Gas Attenuator Transmission")
@ -108,25 +124,28 @@ lakeshore = PVAdjustable("SATES30-LS336:LOOP1_SP", "SATES30-LS336:A_RBV", accura
#lakeshore = LakeShore(name="Temperature")
wl = Wavelength(Mon)
#wl = Wavelength(Mon)
wl = Wavelength(mono_new)
#Diffractometer motions
mu = Motor("SATES30-ARES:MOT_SRY.VAL", name = "Diff RY")
chi = Motor("SATES30-ARES:MOT_SRZ.VAL", name = "Diff RZ")
phi = Motor("SATES30-ARES:MOT_SRX.VAL", name = "Diff RX")
nu = Motor("SATES30-ARES:MOT_DRY.VAL", name = "Diff DRY")
mu = ParkableMotor("SATES30-ARES:MOT_SRY.VAL", name = "Diff RY")
chi = ParkableMotor("SATES30-ARES:MOT_SRZ.VAL", name = "Diff RZ")
phi = ParkableMotor("SATES30-ARES:MOT_SRX.VAL", name = "Diff RX")
nu = ParkableMotor("SATES30-ARES:MOT_DRY.VAL", name = "Diff DRY")
q = QSpace3D("SOMETHING:Q", mu, chi, phi, nu, wl)
TX = Motor("SATES30-ARES:MOT_STX.VAL", name = "Diff TX")
TY = Motor("SATES30-ARES:MOT_STY.VAL", name = "Diff TY")
TZ = Motor("SATES30-ARES:MOT_STZ.VAL", name = "Diff TZ")
TwoTRY=Motor("SATES30-ARES:MOT_2TRY.VAL", name = "Diff 2TRY")
TX = ParkableMotor("SATES30-ARES:MOT_STX.VAL", name = "Diff TX")
TY = ParkableMotor("SATES30-ARES:MOT_STY.VAL", name = "Diff TY")
TZ = ParkableMotor("SATES30-ARES:MOT_STZ.VAL", name = "Diff TZ")
TwoTRY=ParkableMotor("SATES30-ARES:MOT_2TRY.VAL", name = "Diff 2TRY")
tth_scan = Coupled_tth(delta=0.3885, name="theta 2theta")
tth_scan = Coupled_tth(delta=0, name="theta 2theta")
Thz_Gate_scan = Coupled_THzGate( name = "THz Gate coupled ")
Thz_Gate_scan_fixedD = Coupled_THzGate_fixedDelta(delta=36.932, name = "Thz Gate fix Delta")
GRX = Motor("SATES30-RIXS:MOT_GRX.VAL", name = "Pitch grating")
DTZ = Motor("SATES30-RIXS:MOT_DTZ.VAL", name = "DTZ (r2)")
@ -150,6 +169,7 @@ PICO_Y1 = PVAdjustable("SLAAT31-LMNP-PICO12:DRIVE", name="PICO Y1")
Thz_delay = Motor("SLAAT31-LMOT-M806:MOT", name="Thz Delay")
WL_delay = Motor("SLAAT31-LMOT-M807:MOT", name="WL Delay")
gate_delay = Motor("SLAAT31-LMOT-M808:MOT", name="Gate Delay")
twomicron_delay = Motor("SLAAT31-LMOT-M813:MOT", name="2um Delay")
laser_WP = Motor("SLAAT31-LMOT-M801:MOT", name="Laser WavePlate")
@ -167,7 +187,7 @@ spreadsheet = Spreadsheet(spreadsheet_info, placeholders=["comment", "sample"],
instrument = "furka"
pgroup = "p21162" #Commissioning p group
pgroup = "p21266" #Commissioning p group
#check_intensity = PVCondition("SATFE10-PEPG046:FCUP-INTENSITY-CAL", vmin=5, vmax=None, wait_time=3, required_fraction=0.8)
check_intensity = PVCondition("SATBD01-DBPM060:Q2", vmin=5, vmax=None, wait_time=1, required_fraction=0.8)
@ -188,14 +208,23 @@ gui = GUI(scan, show_goto=True, show_spec=True, show_run=True)
#scanPV = Scanner(default_acquisitions=[daqPV], condition=check_intensity)
# Test park function motor
'''
Button that runs a function
'''
@as_shortcut
def test():
def test(name="TEST"):
print("test")
# use marker() to go to a marker position
@as_shortcut
def dump_status_to_stand():
daq.spreadsheet.add(None, None, None)
'''
Single marker
'''
@ -203,6 +232,45 @@ m1 = Marker(dummy,value=25,name='Normal IN')
def Diffr_pos(TRYv, DRYv, TXv , TYv, TZv, RXv, RYv, RZv):
print(f"2TRY = {TRYv}, DRY = {DRYv}, TX = {TXv} , TY = {TYv}, TZ = {TZv}, RX = {RXv}, RY = {RYv}, RZ = {RZv}")
t1 = TwoTRY.set_target_value(TRYv)
t2 = nu.set_target_value(DRYv)
t3 = TX.set_target_value(TXv)
t4 = TY.set_target_value(TYv)
t5 = TZ.set_target_value(TZv)
t6 = phi.set_target_value(RXv)
t7 = mu.set_target_value(RYv)
t8 = chi.set_target_value(RZv)
ts = [t1, t2, t3, t4, t5, t6, t7, t8]
for t in ts:
t.wait()
print("moving done")
for t in ts:
t.park()
print("done")
@as_shortcut
def EOS_pos(name = "EOS Positions"):
Diffr_pos(149.440, 29.5, 3.5, 1.6, -0.7, 0, 82, 0)
@as_shortcut
def Sample_position_45deg(name = "Sample Positions (45 deg)"):
Diffr_pos(65.0, 29.5, 2, -3.6, -0.9, 0, 45, 0)
@as_shortcut
def EOS_LV_pos(name = "EOS LV Positions"):
Diffr_pos(149.440, 29.5, 3.0, 2.5, -0.69, 15, 82, 0)
@as_shortcut
def Transfer_pos(name = "Transfer Positions"):
Diffr_pos(148.40, 80.5, 4.21, -3.5, -10.93, 0, 50, -1.95)
print("To start the GUI, run: gui()")