current state

This commit is contained in:
2022-07-06 20:39:47 +02:00
parent cd6bead403
commit 1cd23cd97d

View File

@ -11,17 +11,17 @@ from slic.core.adjustable import Adjustable, PVAdjustable, DummyAdjustable
from slic.core.acquisition import SFAcquisition#, PVAcquisition
from slic.core.condition import PVCondition
from slic.core.scanner import Scanner
from slic.devices.simpledevice import SimpleDevice
from slic.devices.general.motor import Motor
from slic.devices.general.delay_stage import DelayStage
from slic.devices.general.smaract import SmarActAxis
from slic.devices.general.shutter import Shutter
from slic.utils import devices, Marker, as_shortcut
#from slic.utils import Channels, Config, Elog, Screenshot, PV
#from slic.core.acquisition.fakeacquisition import FakeAcquisition
from devices.attenuator import Attenuator
from devices.undulator import Undulators, TwoColorChicane, Phases
from devices.magnet import Magnet
from devices.simone import Magnet, Frequency
from channels import channels, pvs, detectors
from spreadsheet import overview, print_overview, print_line_for_spreadsheet
@ -30,6 +30,10 @@ import colors
dummy = DummyAdjustable(units="au")
#gas_attenuator = PVAdjustable("SATFE10-VVRE054-A010:SET_VAL-UI", name="Gas Attenuator")
gas_attenuator = PVAdjustable("SATFE10-VVRE054-A010:SET_VAL-UI", process_time=20, name="Gas Attenuator")
#jet_delay = PVAdjustable("SATES20-CVME-EVR0:Pul6-Delay-SP", "SATES20-CVME-EVR0:Pul6-Delay-RB", accuracy=1, name="Jet Delay")
source_delay = PVAdjustable("SATES20-CVME-EVR0:Pul14-Delay-SP", "SATES20-CVME-EVR0:Pul14-Delay-RB", accuracy=1, name="Source Delay")
@ -64,11 +68,13 @@ xota_z_trans = Motor("SATES21-XOTA166:W_Z", name="Table 1: Z coordinated")
xota_y_trans = Motor("SATES21-XOTA166:W_Y", name="Table 1: Y coordinated")
#xota_hori_z = Motor("SATES21-XOTA166:MOTOR_Z", name="Table 1: Z raw")
mot1_x = SmarActAxis("SATES21-XSMA166:MOT4", name="Table 1: sma X")
mot1_y = SmarActAxis("SATES21-XSMA166:MOT5", name="Table 1: sma Y")
mot1_z = SmarActAxis("SATES21-XSMA166:MOT6", name="Table 1: sma Z")
#mot1_x = SmarActAxis("SATES21-XSMA166:MOT4", name="Table 1: sma X")
#mot1_y = SmarActAxis("SATES21-XSMA166:MOT5", name="Table 1: sma Y")
#mot1_z = SmarActAxis("SATES21-XSMA166:MOT6", name="Table 1: sma Z")
mot3_z = SmarActAxis("SATES23-XSMA169:MOT3", name="Table 3: sma Z")
#mot3_z = SmarActAxis("SATES23-XSMA169:MOT3", name="Table 3: sma Z")
mot3_x = SmarActAxis("SATES23-XSMA169:MOT7", name="Table 3: sma x")
mot3_y = SmarActAxis("SATES23-XSMA169:MOT8", name="Table 3: sma y")
standa = Motor("SLAAT21-LMOT-M707:MOT", name="Standa Motor")
@ -78,19 +84,19 @@ mark_gascell = Marker(standa, 88.334, "Gas Cell")
mark_tof = Marker(standa, 28.330, "TOF")
magn = PV("SATUN14-MBND100:CYCLE")
#magn = PV("SATUN14-MBND100:CYCLE")
@as_shortcut
def cycle_magnet():
magn.put(1, wait=True)
for _ in trange(250):
sleep(1)
# set the current to 1 and 5 consecutively,
# since the results after the first step always looks strange
chic_delay.set(1).wait()
sleep(1)
chic_delay.set(5).wait()
sleep(1)
#@as_shortcut
#def cycle_magnet():
# magn.put(1, wait=True)
# for _ in trange(250):
# sleep(1)
# # set the current to 1 and 5 consecutively,
# # since the results after the first step always looks strange
# chic_delay.set(1).wait()
# sleep(1)
# chic_delay.set(5).wait()
# sleep(1)
# add some more devices to the overview
@ -118,8 +124,10 @@ instrument = "maloja"
#pgroup = "p19509" # slic dev
#pgroup = "p19743" # Focus tests and timing tests
#pgroup = "p19582" # pilot 3 -- SPI
pgroup = "p19583" # permalloy 2.0
#pgroup = "p19583" # permalloy 2.0
#pgroup = "p20073" # alvise
#pgroup = "p20194" #TOF beamtime heated valve
pgroup = "p20276" #COLTRIMS commissioning
daq = SFAcquisition(instrument, pgroup, default_channels=channels, default_pvs=pvs, default_detectors=detectors, rate_multiplicator=1, append_user_tag_to_data_dir=True)
#daq = FakeAcquisition(instrument, pgroup)
@ -131,7 +139,58 @@ check_intensity = PVCondition("SATBD01-DBPM060:Q2", vmin=5, vmax=None, wait_time
scan = Scanner(scan_info_dir=f"/sf/{instrument}/data/{pgroup}/res/scan_info", default_acquisitions=[daq], condition=check_intensity)
gui = GUI(scan, show_goto=True, show_spec=True)
gui = GUI(scan, show_goto=True, show_spec=True, show_run=True)
from itertools import count
from time import sleep
magnet = Magnet()
freq = Frequency()
shutter = Shutter("SATOP21-OPSH138")
def overnight():
pos_ref = -0.30145 #-0.857
pos_sig = -0.9516
for ii in range(1,4):
freq.set(ii)
frequency = 6.2832+0.1428*ii #6.2832 #GHz
delays1 = [ 0, 5/8, 1/8, 7/8]
delays2 = [3/8, 2/8, 6/8, 4/8]
n_pulses = 1000
Emin, Emax, Edelta = 708, 720, 2
for i in range(12):
#for i in count():
shutter.close()
mot3_x.set(pos_ref)
sleep(1)
shutter.open()
sleep(1)
magnet.set(0)
print("delay:", magnet)
scan.scan1D(und, Emin, Emax, Edelta, n_pulses, f"evening02_ref_{frequency}_{i:04}", return_to_initial_values=False)
shutter.close()
mot3_x.set(pos_sig)
sleep(1)
shutter.open()
for delay in delays1:
magnet.set(delay/frequency*1000)
print("delay:", magnet)
scan.scan1D(und, Emin, Emax, Edelta, n_pulses, f"evening02_sig_{frequency}_{i:04}_{delay}", return_to_initial_values=False)
delays1, delays2 = delays2, delays1
#shutter.open()