This commit is contained in:
gac-x06da
2025-03-11 12:10:55 +01:00
committed by mohacsi_i
parent e64b5b2c3d
commit 3b9a86c8c8
4 changed files with 50 additions and 33 deletions

View File

@@ -19,9 +19,11 @@ from bec_lib import bec_logger
logger = bec_logger.logger
class SilentNDDerivedSignal(NDDerivedSignal):
"""Silent version of NDDerivedSignal, it does not spam the terminal on
every defective frame (shit happens, ok?)."""
def _array_shape_callback(self, **kwargs):
try:
super()._array_shape_callback(**kwargs)
@@ -46,7 +48,8 @@ class NDArrayPreview(Device):
# Status attributes
min_callback_time = Component(
EpicsSignalWithRBV, "MinCallbackTime", kind=Kind.config, put_complete=True)
EpicsSignalWithRBV, "MinCallbackTime", kind=Kind.config, put_complete=True
)
array_size_x = Component(EpicsSignal, "ArraySize0_RBV", kind=Kind.config)
array_size_y = Component(EpicsSignal, "ArraySize1_RBV", kind=Kind.config)
array_size_z = Component(EpicsSignal, "ArraySize2_RBV", kind=Kind.config)

View File

@@ -1,4 +1,4 @@
""" MX measurements module
"""MX measurements module
Scan primitives for standard BEC scans at the PX beamlines at SLS.
Theese scans define the event model and can be called from higher levels.
@@ -123,15 +123,6 @@ class AerotechFlyscanBase(AsyncFlyScanBase):
return super().cleanup()
class MeasureStandardWedge(AerotechFlyscanBase):
"""Standard wedge scan using the OMEGA motor
@@ -280,18 +271,16 @@ class MeasureHelical(AerotechFlyscanBase):
ready_rate : float, optional
No clue what is this... (default=500)
sg_start : (float, float, float, float, float)
Complete SmarGon coordinate in tuple form.
Complete SmarGon coordinate in tuple form.
sg_end : (float, float, float, float, float)
Complete SmarGon coordinate in tuple form.
sg_steps : int
Number of steps with SmarGon.
Number of steps with SmarGon.
"""
scan_name = "helicalscan"
required_kwargs = ["start", "range", "move_time", "sg_start", "sg_end", "sg_steps"]
def pre_scan(self):
"""Mostly just checking if ABR stage is ok..."""
@@ -310,7 +299,7 @@ class MeasureHelical(AerotechFlyscanBase):
logger.info(f"StepSize:\t{self.smargon_step_size}")
logger.info(f"StepTime:\t{self.smargon_step_time}")
# TODO: Move roughly to start position???
# TODO: Move roughly to start position???
st0 = yield from self.stubs.send_rpc("shx", "omove", self.smargon_start[0])
st1 = yield from self.stubs.send_rpc("shy", "omove", self.smargon_start[1])
st2 = yield from self.stubs.send_rpc("shz", "omove", self.smargon_start[2])
@@ -347,8 +336,8 @@ class MeasureHelical(AerotechFlyscanBase):
st3.wait()
st4.wait()
t_end = time.time()
t_elapsed = t_end-t_start
time.sleep(max(self.smargon_step_time-t_elapsed, 0))
t_elapsed = t_end - t_start
time.sleep(max(self.smargon_step_time - t_elapsed, 0))
# Wait for scan task to finish
if self.abr_complete:
@@ -384,11 +373,11 @@ class MeasureHelical2(AerotechFlyscanBase):
ready_rate : float, optional
No clue what is this... (default=500)
sg_start : (float, float, float, float, float)
Complete SmarGon coordinate in tuple form.
Complete SmarGon coordinate in tuple form.
sg_end : (float, float, float, float, float)
Complete SmarGon coordinate in tuple form.
sg_steps : int
Number of steps with SmarGon.
Number of steps with SmarGon.
"""
scan_name = "helicalscan2"
@@ -469,8 +458,8 @@ class MeasureHelical2(AerotechFlyscanBase):
st3.wait()
st4.wait()
t_end = time.time()
t_elapsed = t_end-t_start
time.sleep(max(self.smargon_step_time-t_elapsed, 0))
t_elapsed = t_end - t_start
time.sleep(max(self.smargon_step_time - t_elapsed, 0))
yield from self.stubs.read(group="monitored", point_id=self.point_id)
self.point_id += 1

View File

@@ -1,6 +1,4 @@
def rock(steps, exp_time, scan_start=None, scan_end=None,datasource=None, visual=True, **kwargs):
def rock(steps, exp_time, scan_start=None, scan_end=None, datasource=None, visual=True, **kwargs):
"""Demo step scan with plotting
This is a simple user-space demo step scan with the BEC. It be a
@@ -16,10 +14,9 @@ def rock(steps, exp_time, scan_start=None, scan_end=None,datasource=None, visual
motor = dev.dccm_theta2
if scan_start is None:
scan_start = -0.05/dev.dccm_energy.user_readback.get()
scan_start = -0.05 / dev.dccm_energy.user_readback.get()
if scan_end is None:
scan_end = 0.05/dev.dccm_energy.user_readback.get()
scan_end = 0.05 / dev.dccm_energy.user_readback.get()
if visual:
# Get or create scan specific window
@@ -42,7 +39,14 @@ def rock(steps, exp_time, scan_start=None, scan_end=None,datasource=None, visual
print("Handing over to 'scans.line_scan'")
s = scans.line_scan(
motor, scan_start, scan_end, steps=steps, exp_time=exp_time, datasource=datasource, relative=True, **kwargs
motor,
scan_start,
scan_end,
steps=steps,
exp_time=exp_time,
datasource=datasource,
relative=True,
**kwargs,
)
if visual:
@@ -50,7 +54,9 @@ def rock(steps, exp_time, scan_start=None, scan_end=None,datasource=None, visual
firt_par = plt1.get_dap_params()
else:
# Without GUI
firt_par = bec.dap.LinearModel.fit(s, motor.name, motor.name, datasource.name, datasource.name)
firt_par = bec.dap.LinearModel.fit(
s, motor.name, motor.name, datasource.name, datasource.name
)
# Move to fitted maximum

View File

@@ -3,7 +3,17 @@ def bl_check_beam():
return True
def ascan(motor, scan_start, scan_end, steps, exp_time, datasource=None, visual=True, relative=False, **kwargs):
def ascan(
motor,
scan_start,
scan_end,
steps,
exp_time,
datasource=None,
visual=True,
relative=False,
**kwargs,
):
"""Demo step scan with plotting
This is a simple user-space demo step scan with the BEC. It be a
@@ -38,7 +48,14 @@ def ascan(motor, scan_start, scan_end, steps, exp_time, datasource=None, visual=
print("Handing over to 'scans.line_scan'")
s = scans.line_scan(
motor, scan_start, scan_end, steps=steps, exp_time=exp_time, datasource=datasource, relative=relative, **kwargs
motor,
scan_start,
scan_end,
steps=steps,
exp_time=exp_time,
datasource=datasource,
relative=relative,
**kwargs,
)
if visual:
@@ -46,7 +63,9 @@ def ascan(motor, scan_start, scan_end, steps, exp_time, datasource=None, visual=
firt_par = plt1.get_dap_params()
return s, firt_par
else:
firt_par = bec.dap.LinearModel.fit(s, motor.name, motor.name, datasource.name, datasource.name)
firt_par = bec.dap.LinearModel.fit(
s, motor.name, motor.name, datasource.name, datasource.name
)
return s, firt_par
# fit = bec.dap.LinearModel(motor, datasource)