Commit 695530b1 authored by bliss administrator's avatar bliss administrator
Browse files

change/restore vel only when necessary to save some time (up to 600ms per scan ...)

parent cbbedad3
......@@ -354,8 +354,10 @@ class ID26FScanController:
f"FSCAN: move to {energy_end} keV would exceed high limit on {self.mono.name} ({self.mono.limits[1]} deg.)"
)
self.mono.velocity = self.fscan_par["mono_move_back_speed_steps"] / self.mono.steps_per_unit
self.energy.move(energy_start, wait=False)
if abs(self.energy.position-energy_start)>self.energy.tolerance:
with cleanup (self.mono, restore_list=(cleanup_axis.VEL,)):
self.mono.velocity = self.fscan_par["mono_move_back_speed_steps"] / self.mono.steps_per_unit
self.energy.move(energy_start, wait=False)
#ID
......@@ -1169,7 +1171,8 @@ class ID26FScanController:
self.energy.sync_hard()
#MCL 20210325 - that takes about 160ms
self.mono.velocity = self.mono.config_velocity
if self.fscan_par['mono_move_back'] == 0 or not self.event_trajectory_started.is_set() or self.event_runtime_error.is_set():
self.mono.velocity = self.mono.config_velocity
#MCL 20210325 - that s only for u35a variable speed trajectories
if self.fscan_par["id_linked"] == 2:
......
......@@ -102,37 +102,35 @@ def fscan(
if FSCAN_PAR["id_linked"] == 2:
FSCAN_PAR["id_sync"] = 0
with cleanup (FSCAN.mono, restore_list=(cleanup_axis.VEL,)):
log_debug(
log_debug(
FSCAN,
"mono is {0}".format(FSCAN.mono.state)
)
)
nbpoints, exp_time, duration, id_parameters = FSCAN.prepare (
nbpoints, exp_time, duration, id_parameters = FSCAN.prepare (
energy_start, energy_end, duration, energy_step
)
print('Starting here.')
print(f"@{time.time()-time0:.3f}s")
)
print('Starting here.')
print(f"@{time.time()-time0:.3f}s")
log_debug(
log_debug(
FSCAN,
"mono is {0}".format(FSCAN.mono.state)
)
)
group = FSCAN.program_trajectories(
group = FSCAN.program_trajectories(
energy_start,
energy_end,
duration,
energy_step,
) # from 600us to some seconds for PM600
print('after programming of trajetory.')
print(f"@{time.time()-time0:.3f}s")
) # from 600us to some seconds for PM600
print('after programming of trajetory.')
print(f"@{time.time()-time0:.3f}s")
# the data acquisition takes longer because of delay (0.5s) between MUSST start and actual motion of mono:
nbpoints_musst = int(nbpoints + 0.7 / exp_time)
# the data acquisition takes longer because of delay (0.5s) between MUSST start and actual motion of mono:
nbpoints_musst = int(nbpoints + 0.7 / exp_time)
chain = FSCAN.acquisition_chain(
chain = FSCAN.acquisition_chain(
exp_time,
0,
nbpoints_musst,
......@@ -140,44 +138,44 @@ def fscan(
*counters,
id_speed_dict=id_parameters,
id_sync=FSCAN_PAR["id_sync"],
)
print('after aqcuisition chain definition.')
print(f"@{time.time()-time0:.3f}s")
)
print('after aqcuisition chain definition.')
print(f"@{time.time()-time0:.3f}s")
scan_info_dict = {
scan_info_dict = {
"title": f"fscan {energy_start} {energy_end} {duration} {energy_step}",
"start": energy_start,
"stop": energy_end,
"npoints": nbpoints,
"type": "fscan",
"count_time": exp_time,
}
}
scan_info = ScanInfo()
scan_info.update(scan_info_dict)
xname = 'hdh_energy'
scan_info.add_curve_plot( x=xname )
scan_info = ScanInfo()
scan_info.update(scan_info_dict)
scan_info.set_channel_meta(
xname = 'hdh_energy'
scan_info.add_curve_plot( x=xname )
scan_info.set_channel_meta(
xname,
start=energy_start,
stop=energy_end,
points=nbpoints,
)
)
#============================
#============================
scan = Scan(
scan = Scan(
chain,
name="fscan",
scan_info=scan_info,
save=save,
data_watch_callback=FScanDisplay("elapsed_time"),
)
)
print(f"Ready to run scan @{time.time()-time0:.3f}s")
print(f"Ready to run scan @{time.time()-time0:.3f}s")
with cleanup(FSCAN._cleanup):
with cleanup(FSCAN._error_cleanup, error_cleanup=True):
......
Supports Markdown
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