181 lines
5.2 KiB
Python
Executable File
181 lines
5.2 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
from slic.core.acquisition import SFAcquisition
|
|
#from slic.core.acquisition import BSAcquisition, DBAcquisition, DIAAcquisition, PVAcquisition, SFAcquisition
|
|
#from slic.core.acquisition.bschannels import BSChannels
|
|
from slic.core.scanner import Scanner
|
|
from slic.core.acquisition import BSChannels, PVChannels, DetectorConfig
|
|
from slic.core.adjustable import DummyAdjustable
|
|
from slic.utils import Config, Elog, Screenshot, load_channels
|
|
from slic.core.condition import PVCondition
|
|
from slic.gui import GUI
|
|
|
|
from slic.utils import devices
|
|
from slic.utils import Marker, as_shortcut
|
|
|
|
from devices import *
|
|
from adhoc import *
|
|
|
|
|
|
adhoc_lxt = PVAdjustable("SLAAR01-LTIM-PDLY:DELAYNS", pvname_done_moving="SLAAR01-LTIM-PDLY:WAITING", name="adhoc lxt")
|
|
|
|
|
|
#TODO: why do we need this suddenly?
|
|
try:
|
|
from IPython import get_ipython
|
|
get_ipython().Completer.use_jedi = False
|
|
except:
|
|
pass
|
|
|
|
|
|
#fn_cfg = "/sf/alvra/config/exp/current_experiment.json"
|
|
fn_cfg = "/sf/alvra/config/src/python/slic/alvra/config/config.json"
|
|
cfg = Config(fn_cfg)
|
|
|
|
elog = Elog(cfg.elog_url, cfg.screenshot_directory, user=cfg.user, password="supercorrect") #TODO: remove fake password
|
|
screenshot = Screenshot(cfg.screenshot_directory)
|
|
|
|
|
|
fn_channels = "/sf/alvra/config/com/channel_lists/default_channel_list"
|
|
fn_detectors = "/sf/alvra/config/com/detector_lists/default_detector_list"
|
|
fn_pvs = "/sf/alvra/config/com/channel_lists/PV_default_channel_list"
|
|
|
|
channels = BSChannels.from_file(fn_channels)
|
|
detectors = load_channels(fn_detectors)
|
|
pvs = PVChannels.from_file(fn_pvs)
|
|
|
|
|
|
## For Phil:
|
|
#fn_channels = "/sf/alvra/config/com/channel_lists/laser_channel_list_BS"
|
|
#fn_pvs = "/sf/alvra/config/com/channel_lists/laser_channel_list_PV"
|
|
#
|
|
#channels = Channels(fn_channels)
|
|
#detectors = None
|
|
#pvs = Channels(fn_pvs)
|
|
|
|
|
|
detectors_raw = DetectorConfig("JF06T32V02", "JF02T09V03")
|
|
|
|
detectors_config = DetectorConfig()
|
|
#detectors_config.add("JF06T32V02")
|
|
detectors_config.add("JF06T08V02")
|
|
#detectors_config.add("JF02T09V03", disabled_modules=[0, 1, 2, 3, 5, 6, 7], remove_raw_files=True)
|
|
|
|
|
|
detectors = None
|
|
#detectors = detectors_config
|
|
#detectors = detectors_raw
|
|
|
|
|
|
#check_intensity = PVCondition("SARFE10-PBPG050:HAMP-INTENSITY-CAL", vmin=0, vmax=1500, wait_time=0.25, required_fraction=0.8)
|
|
#check_intensity = PVCondition("SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US", vmin=0, vmax=2000, wait_time=0.5, required_fraction=0.8)
|
|
#check_intensity = PVCondition("SARFE10-PBPS053:INTENSITY", vmin=0.05,vmax=2, wait_time=0.5, required_fraction=0.8)
|
|
check_intensity = PVCondition("SAROP11-PBPS110:INTENSITY", vmin=0.05,vmax=5, wait_time=0.5, required_fraction=0.8)
|
|
#check_intensity = PVCondition("SAROP11-PBPS122:INTENSITY", vmin=0.1,vmax=10, wait_time=0.5, required_fraction=0.8)
|
|
|
|
daq = SFAcquisition(cfg.instrument, cfg.pgroup, default_channels=channels, default_pvs=list(pvs), default_detectors=detectors, append_user_tag_to_data_dir=True)
|
|
|
|
scan = Scanner(
|
|
scan_info_dir="/sf/alvra/data/{}/res/scan_info".format(cfg.pgroup),
|
|
# scan_info_dir="./",
|
|
default_acquisitions=[daq],
|
|
condition=check_intensity,
|
|
)
|
|
|
|
gui = GUI(scan, show_spec=True, show_goto=True, show_run=True)
|
|
|
|
|
|
bsdaqJF = Deprecator("bsdaqJF", "daq")
|
|
scansJF = Deprecator("scansJF", "scan")
|
|
|
|
|
|
#daqBS = BSAcquisition(cfg.instrument, cfg.pgroup, default_channels=channels)
|
|
#daqDB = DBAcquisition(cfg.instrument, cfg.pgroup, default_channels=channels)
|
|
#daqPV = PVAcquisition(cfg.instrument, cfg.pgroup, default_channels=channels)
|
|
|
|
#scanBS = Scanner(
|
|
## scan_info_dir="/sf/alvra/data/{}/res/scan_info".format(cfg.pgroup),
|
|
# scan_info_dir="./",
|
|
# default_acquisitions=[daqBS],
|
|
#)
|
|
|
|
|
|
dummy = DummyAdjustable("A Dummy Adjustable")
|
|
|
|
|
|
def huber_pos(x, y, z, att=None):
|
|
print(f"x = {x}, y = {y}, z = {z}, att = {att}")
|
|
XrayShutter.close()
|
|
t1 = primeSample.x.set(x)
|
|
t2 = primeSample.y.set(y)
|
|
t3 = primeSample.z.set(z)
|
|
ts = [t1, t2, t3]
|
|
if att is not None:
|
|
t4 = attExp.set(att)
|
|
ts.append(t4)
|
|
for t in ts:
|
|
t.wait()
|
|
print("moving done")
|
|
XrayShutter.open()
|
|
print("done")
|
|
|
|
|
|
@as_shortcut
|
|
def FrostedYAG():
|
|
huber_pos(-6, -8.6, 0)
|
|
|
|
@as_shortcut
|
|
def ThinYAG():
|
|
huber_pos(-6.6, -18.2, 0)
|
|
|
|
@as_shortcut
|
|
def KnifeEdgeX():
|
|
huber_pos(-9.3, 9, 2.5, att=1e-5)
|
|
|
|
@as_shortcut
|
|
def KnifeEdgeY():
|
|
huber_pos(-6, 14, 2.5, att=1e-5)
|
|
|
|
@as_shortcut
|
|
def SiN():
|
|
huber_pos(12.6, 10, -1.1)
|
|
|
|
@as_shortcut
|
|
def TimingDiode():
|
|
huber_pos(10.9, -15.1, 0)
|
|
|
|
#@as_shortcut
|
|
#def JetYAG():
|
|
# huber_pos(15.3, 2.2,0)
|
|
|
|
m1 = Marker(primeSample.x, name="Jet X")
|
|
m2 = Marker(primeSample.y, name="Jet Y")
|
|
m3 = Marker(primeSample.z, name="Jet Z")
|
|
|
|
m4 = Marker(primeSample.x, name="YAG Jet X")
|
|
m5 = Marker(primeSample.y, name="YAG Jet Y")
|
|
m6 = Marker(primeSample.z, name="YAG Jet Z")
|
|
|
|
m7 = Marker(primeSample.x, name="Solid Sample X")
|
|
m8 = Marker(primeSample.y, name="Solid Sample Y")
|
|
m9 = Marker(primeSample.z, name="Solid Sample Z")
|
|
|
|
t0_harmonics = None
|
|
t0_topas = None
|
|
|
|
@as_shortcut
|
|
def go_to_t0_harmonics():
|
|
if t0_harmonics is not None:
|
|
laser.pumpHarmonics_delay.motor.set(t0_harmonics)
|
|
else:
|
|
print("please define t0_harmonics")
|
|
|
|
@as_shortcut
|
|
def go_to_t0_topas():
|
|
if t0_topas is not None:
|
|
laser.pumpTopas_delay.motor.set(t0_topas)
|
|
else:
|
|
print("please define t0_topas")
|
|
|
|
|