Commit 984ac854 authored by augustin_s's avatar augustin_s 🐍
Browse files

switched to new pgroup

parents de90deef 00da9d59
from time import sleep
from types import SimpleNamespace
from slic.utils import typename
from slic.core.task import Task
import epics
class PV(epics.PV):
def put(self, *args, wait=True, **kwargs):
super().put(*args, wait=wait, **kwargs)
class Attenuator:
def __init__(self, name, n_motors=6):
if not name.endswith(":"):
name += ":"
self.name = name
self.pvs = SimpleNamespace(
energy = PV(name + "ENERGY"),
transmission = PV(name + "TRANS_SP"),
motors_done_moving = [PV(name + "MOTOR_{}.DMOV".format(i+1)) for i in range(n_motors)]
)
def get_current_value(self):
return self.get_transmission()
def set_target_value(self, value):
def changer():
self.set_transmission(value)
return Task(changer)
def set_transmission(self, value):
self.pvs.transmission.put(value)
self.wait_for_motors()
def get_transmission(self):
return self.pvs.transmission.get()
transmission = property(get_transmission, set_transmission)
def set_energy(self, value):
self.pvs.energy.put(value)
def get_energy(self):
return self.pvs.energy.get()
energy = property(get_energy, set_energy)
def motors_are_moving(self):
is_moving = lambda dmov: not bool(dmov.get())
return any(is_moving(dmov) for dmov in self.pvs.motors_done_moving)
def wait_for_motors(self):
while self.motors_are_moving():
sleep(0.01)
def __repr__(self):
tn = typename(self)
trans = self.get_transmission() * 100
energ = self.get_energy()
return "{}(\"{}\") at {}% transmission for {} eV".format(tn, self.name, trans, energ)
#!/usr/bin/env python
from slic.core.acquisition import NuDIArAcquisition
from slic.core.acquisition import SFAcquisition
from slic.core.scanner import Scanner
#from slic.utils import Channels, Config, Elog, Screenshot, PV
#from slic.core.condition import PVCondition
......@@ -8,6 +8,12 @@ from slic.core.scanner import Scanner
#from slic.utils import devices
from devices.attenuator import Attenuator
att = Attenuator("SATFE10-OATT064")
channels_inten = [
# "SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG"
"SATFE10-PEPG046-EVR0:CALCI",
......@@ -20,22 +26,26 @@ channels_inten = [
"SLAAR11-LTIM01-EVR0:DUMMY_PV5_NBS"
]
channels_ks = channels_inten + [
channels_ks = [
"SATES21-GES1:A1_VALUES",
]
channels_cam = channels_inten + [
"SATES21-CAMS154-M1:FPICTURE"
channels_cam = [
"SATES21-CAMS154-M1:FPICTURE",
"SATES24-CAMS161-M1:FPICTURE"
]
channels = channels_inten + channels_ks + channels_cam
instrument = "maloja"
pgroup = "p18493" # commissioning june 2020
pgroup = "p18722" # commissioning sept 2020
daq = NuDIArAcquisition("maloja", pgroup, default_channels=channels_ks, rate_multiplicator=40)
scan = Scanner(scan_info_dir="/sf/maloja/data/p18493/res/scan_info", default_acquisitions=[daq], make_scan_sub_dir=False)
daq = SFAcquisition(instrument, pgroup, default_channels=channels, rate_multiplicator=40)
scan = Scanner(scan_info_dir=f"/sf/{instrument}/data/{pgroup}/res/scan_info", default_acquisitions=[daq])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment