278 lines
8.8 KiB
Python
278 lines
8.8 KiB
Python
#!/usr/bin/env python
|
|
|
|
from slic.core.acquisition import SFAcquisition
|
|
from slic.core.acquisition import PVAcquisition
|
|
#from slic.core.acquisition import FakeAcquisition
|
|
from slic.core.adjustable import PVAdjustable, DummyAdjustable
|
|
from slic.core.condition import PVCondition
|
|
from slic.core.device import SimpleDevice
|
|
from slic.core.scanner import Scanner
|
|
from slic.devices.general.delay_stage import DelayStage
|
|
from slic.devices.general.motor import Motor
|
|
from slic.devices.general.smaract import SmarActAxis
|
|
from slic.gui import GUI
|
|
from slic.utils import devices
|
|
from slic.utils import as_shortcut, Marker
|
|
|
|
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
|
|
|
|
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
|
|
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")
|
|
|
|
|
|
from slic.devices.general.smaract import SmarActAxis
|
|
parab_RY = SmarActAxis("SATES30-XSMA182:MOT4", name="Parab RY")
|
|
parab_RX = SmarActAxis("SATES30-XSMA182:MOT7", name="Parab RX")
|
|
taget_along_beam = SmarActAxis("SATES30-XSMA184:MOT6", name="Target along beam")
|
|
|
|
|
|
#Retro Chamber Motors
|
|
#mot_x = Motor("SATES30-RETRO:MOT_X", name="Retro X")
|
|
#mot_y = Motor("SATES30-RETRO:MOT_Y", name="Retro Y")
|
|
#mot_z = Motor("SATES30-RETRO:MOT_Z", name="Retro Z")
|
|
#mot_theta = Motor("SATES30-RETRO:MOT_RY", name="Retro Theta")
|
|
#retro = SimpleDevice("Retro Stages", x=mot_x, y=mot_y, z=mot_z, theta=mot_theta)
|
|
|
|
|
|
#Furka Kbs motors
|
|
KBV_RX = PVAdjustable("SATOP31-OKBV178:W_RX.VAL", pvname_moving="SATOP31-OKBV178:MOVING", name = "KB Ver RX")
|
|
KBH_RY = PVAdjustable("SATOP31-OKBH179:W_RY.VAL", pvname_moving="SATOP31-OKBH179:MOVING", name = "KB Horiz RY")
|
|
|
|
|
|
|
|
## PMOS adjustables
|
|
PMOS127_FOCUS = PVAdjustable("SLAAT-GSLENS0:SET_CTS_POWER", process_time=1, name="PMOS127_FOCUS")
|
|
PMOS132_FOCUS = PVAdjustable("SLAAT-GSLENS1:SET_CTS_POWER", process_time=1, name="PMOS132_FOCUS")
|
|
#PMOS_FOCUS = PVAdjustable("SLAAT-GSLENS1:SET_CTS_POWER", process_time=1, name="PMOS_FOCUS")
|
|
MONO_G_rad = PVAdjustable("SATOP11-OSGM087:G_RADIUS", pvname_moving="SATOP11-OSGM087:MONO_STATUS", name="MONO_G_rad")
|
|
MONO_M_rad = PVAdjustable("SATOP11-OSGM087:M_RADIUS", pvname_moving="SATOP11-OSGM087:MONO_STATUS", name="MONO_M_rad")
|
|
MONO_M_curv = PVAdjustable("SATOP11-OSGM087:M_CURVATURE", pvname_moving="SATOP11-OSGM087:MONO_STATUS", name="MONO_M_curv")
|
|
|
|
## OAPU085
|
|
OAPU085_vert = PVAdjustable("SATOP11-OAPU085:MOTOR_Y.VAL", process_time=1, name="OAPU085_vert")
|
|
|
|
##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
|
|
|
|
#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"
|
|
|
|
##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")
|
|
|
|
|
|
lakeshore = PVAdjustable("SATES30-LS336:LOOP1_SP", "SATES30-LS336:A_RBV", accuracy=0.25, name="Lakeshore Temp")
|
|
|
|
|
|
#att = Attenuator("SATFE10-OATT064")
|
|
#shutter = Shutter("SATOP31-OPSH138")
|
|
|
|
|
|
|
|
|
|
#lakeshore = LakeShore(name="Temperature")
|
|
|
|
|
|
#wl = Wavelength(Mon)
|
|
wl = Wavelength(mono_new)
|
|
|
|
|
|
|
|
#Diffractometer motions
|
|
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 = 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, 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)")
|
|
|
|
#fake_mu = HistoryDummy.init_from(mu)
|
|
#fake_chi = HistoryDummy.init_from(chi)
|
|
#fake_phi = HistoryDummy.init_from(phi)
|
|
#fake_nu = HistoryDummy.init_from(nu)
|
|
#fake_q = QSpace3D("FAKE:Q", fake_mu, fake_chi, fake_phi, fake_nu, wl)
|
|
##fake_q.set_lattice("FAKE:Q", fake_mu, fake_chi, fake_phi, fake_nu, wl)
|
|
|
|
|
|
|
|
#Laser motors
|
|
|
|
lxt = PVAdjustable("SLAAT01-LTIM-PDLY:DELAY", pvname_done_moving="SLAAT01-LTIM-PDLY:WAITING", name="LXT")
|
|
|
|
PICO_X1 = PVAdjustable("SLAAT31-LMNP-PICO11:DRIVE", name="PICO X1")
|
|
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")
|
|
|
|
|
|
|
|
#overview.Thz_delay = Thz_delay
|
|
|
|
|
|
from spreadsheet import overview, print_overview, print_line_for_spreadsheet, spreadsheet_info
|
|
from slic.core.acquisition.spreadsheet import Spreadsheet
|
|
|
|
spreadsheet = Spreadsheet(spreadsheet_info, placeholders=["comment", "sample"], host="satesf-cons-03", port=9090)
|
|
|
|
|
|
|
|
|
|
instrument = "furka"
|
|
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)
|
|
#check_intensity = None
|
|
|
|
|
|
daq = SFAcquisition(instrument, pgroup, default_channels=channels, default_pvs=pvs, rate_multiplicator=1, spreadsheet=spreadsheet)
|
|
daq.update_config_pvs()
|
|
#daq = FakeAcquisition(instrument, pgroup, default_channels=channels, default_pvs=pvs, rate_multiplicator=1)
|
|
#daq = BSAcquisition .... TBI
|
|
|
|
#daqPV = PVAcquisition(instrument, pgroup, default_channels=live_channels)
|
|
scan = Scanner(default_acquisitions=[daq], condition=check_intensity, default_sensor=s3)
|
|
|
|
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(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
|
|
'''
|
|
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()")
|
|
|
|
|
|
|