Commit 4174e63b authored by bliss administrator's avatar bliss administrator
Browse files

Add part to convert encoder motor position to user position +

launch a second scan in parallel
parent 48e349a6
......@@ -10,6 +10,7 @@ from bliss import setup_globals
from bliss.controllers.ct2.device import AcqMode as P201AcqMode
from bliss.data.node import is_zerod
from bliss.common import session, scans
from bliss.scanning.acquisition.calc import CalcAcquisitionDevice
import sys
import gevent
import numpy as np
......@@ -20,7 +21,7 @@ from bliss.common import event
from bliss import setup_globals
def motor_scan_cont(mode, motor, start, end, images, ctime, readout_time, latency_time=None):
def motor_scan_cont(mode, motor, start, end, images, ctime=0.05, readout_time=0.05, latency_time=None):
if latency_time is None:
calc_readout_time= (images*ctime)/60.0
......@@ -38,6 +39,8 @@ def motor_scan_cont(mode, motor, start, end, images, ctime, readout_time, latenc
print("scan speed: %.2f" % scan_speed)
print("scan step acquisition time: %.2f" % scan_point_time)
measurement = setup_globals.ACTIVE_MG
enabled_counters = measurement.enabled
musst_card = setup_globals.config.get("musst")
......@@ -95,11 +98,24 @@ def motor_scan_cont(mode, motor, start, end, images, ctime, readout_time, latenc
store_list = store_list,
vars=musst_vars)
chain = AcquisitionChain()
# Continuous scan
motor_master = MotorMaster(motor, start, end, time=images*scan_point_time)
chain = AcquisitionChain()
def enc_to_user(sender, channel_data):
calc_data = dict()
if sender.name == 'CH3':
enc_pos = channel_data.get(sender.name)
mot_pos = enc_pos / motor.steps_per_unit
calc_data[motor.name.upper()] = mot_pos
return calc_data
calc_pos_device = CalcAcquisitionDevice('calc_user_pos',(musst_device,),enc_to_user,
(AcquisitionChannel(motor.name.upper(),np.float,(1,)),))
chain.add(motor_master,calc_pos_device)
chain.add(motor_master,musst_device)
detector = setup_globals.config.get("pcoedge64")
......@@ -114,8 +130,26 @@ def motor_scan_cont(mode, motor, start, end, images, ctime, readout_time, latenc
lima_master.add_counter(detector.image)
chain.add(motor_master,lima_master)
if enabled_counters:
scan_params = {'npoints': 0, 'count_time': 1 }
counters_left = [getattr(setup_globals,name) for name in enabled_counters]
chain.append(scans.DEFAULT_CHAIN.get(scan_params, counters_left))
#scan_info = {
#"type": "scan",
#"title": "continuous scan",
#"motors": ["hrsrot"],
#"counters": ["timer","ch3"],
#"npoints": images,
#"root_path": "/tmp_14_days/id19test/visualtomo"
#}
setup_globals.SCAN_SAVING.base_path = '/tmp_14_days/id19test'
scan = Scan(chain, data_watch_callback=ScanDisplayData(motor))
#scan = Scan(chain, scan_info=scan_info, data_watch_callback=ScanDisplayData(motor))
scan = Scan(chain), data_watch_callback=ScanDisplayData(motor))
with MultiplexerManager("HR_FTOMO_PCO"):
scan.run()
......
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