Commit b916d755 authored by Emmanuel Papillon's avatar Emmanuel Papillon
Browse files

prepare set_accumulation/unset_accumulation for all detectors

added frelon16 on same trigger as frelon1
parent f802c780
...@@ -27,9 +27,15 @@ def init(motor,offset,gain): ...@@ -27,9 +27,15 @@ def init(motor,offset,gain):
ctrl.command(f"SPA 2 0x02000300 {gain}") ctrl.command(f"SPA 2 0x02000300 {gain}")
ctrl.command(f"SPA 2 0x02000200 {offset}") ctrl.command(f"SPA 2 0x02000200 {offset}")
class Fake:
name='Analog_input'
channel = 2
fake = Fake()
motor.controller.axes[fake.name] = fake
#Record the axis position #Record the axis position
motor.controller.set_recorder_data_type(motor, motor.controller.set_recorder_data_type(motor,motor.VOLTAGE_OF_OUTPUT_CHAN,fake,
motor.CONTROL_VOLTAGE_OF_OUTPUT_CHAN)#CURRENT_POSITION_OF_AXIS) motor.SENSOR_MECHLINEAR_OF_INPUT_CHAN)
#motor.CONTROL_VOLTAGE_OF_OUTPUT_CHAN)#CURRENT_POSITION_OF_AXIS)
def stress_run_display(wavetype,offset,amplitude,nb_cycles,wavelen,recorder_rate=None): def stress_run_display(wavetype,offset,amplitude,nb_cycles,wavelen,recorder_rate=None):
if STRESS_RIG_MOTOR is None: if STRESS_RIG_MOTOR is None:
...@@ -48,9 +54,10 @@ def stress_run_display(wavetype,offset,amplitude,nb_cycles,wavelen,recorder_rate ...@@ -48,9 +54,10 @@ def stress_run_display(wavetype,offset,amplitude,nb_cycles,wavelen,recorder_rate
data = numpy.append(data,ldata) data = numpy.append(data,ldata)
else: else:
data = ldata data = ldata
x,y = (data[name] for name in data.dtype.names) x,y,y2 = (data[name] for name in data.dtype.names)
p.plot(data=y,x=x) #p.plot(data=y,x=x)
p.plot(data={'target':y,'current':y2},x=x)
return data return data
# Get flint # Get flint
......
...@@ -4,42 +4,47 @@ from bliss.scanning.chain import ChainPreset ...@@ -4,42 +4,47 @@ from bliss.scanning.chain import ChainPreset
from bliss.scanning.scan import ScanPreset from bliss.scanning.scan import ScanPreset
def _get_tdxrd_chain(): def _get_chain_config(name):
config = get_config() config = get_config()
chaincfg = config.get("chain_tdxrd_gate") chain_config = config.get(name)
return chaincfg["chain_config"] return chain_config["chain_config"]
def set_tdxrd_chain(): def _get_chain_device_config(name, dev):
DEFAULT_CHAIN.set_settings(_get_tdxrd_chain()) config = _get_chain_config(name)
found_config = None
def unset_tdxrd_chain(): for dev_config in config:
DEFAULT_CHAIN.set_settings({}) device = dev_config["device"]
if device == dev:
def set_marana_accumulation(acc_max_expo_time=0.0005): found_config = {
set_tdxrd_chain() "acquisition_settings": dev_config.get("acquisition_settings", {}),
"master": dev_config.get("master"),
found = False }
for dev in DEFAULT_CHAIN._settings: return found_config
if dev.name == "marana":
found = True def set_default_chain():
# -- for scans DEFAULT_CHAIN.set_settings(_get_chain_config("chain_tdxrd_gate"))
DEFAULT_CHAIN._settings[dev]["acquisition_settings"] = {
"acq_mode": "ACCUMULATION", def set_accumulation(limadev, acc_max_expo_time=None):
"acq_trigger_mode": "INTERNAL_TRIGGER", dev_config = _get_chain_device_config("chain_tdxrd_acc", limadev)
"acc_max_expo_time": acc_max_expo_time, if dev_config is not None:
} DEFAULT_CHAIN._settings[limadev] = dev_config
# -- for tomo limadev.acquisition.mode = "ACCUMULATION"
dev.acquisition.mode = "ACCUMULATION" if acc_max_expo_time is not None:
dev.accumulation.max_expo_time = acc_max_expo_time limadev.accumulation.max_expo_time = acc_max_expo_time
if not found: else:
raise RuntimeError("No marana device in default chain !!") acc_max_expo_time = limadev.accumulation.max_expo_time
print(f"{limadev.name} set in ACCUMULATION mode (acc_max_expo_time= {acc_max_expo_time} sec)")
def unset_marana_accumulation(): else:
set_tdxrd_chain() raise RuntimeError(f"Detector {limadev.name} not configured in accumulation chain")
for dev in DEFAULT_CHAIN._settings:
if dev.name == "marana": def unset_accumulation(limadev):
dev.acquisition.mode = "SINGLE" dev_config = _get_chain_device_config("chain_tdxrd_gate", limadev)
if dev_config is not None:
DEFAULT_CHAIN._settings[limadev] = dev_config
elif limadev in DEFAULT_CHAIN._settings:
DEFAULT_CHAIN._settings.pop(limadev)
limadev.acquisition.mode = "SINGLE"
class CountMuxPreset(ChainPreset): class CountMuxPreset(ChainPreset):
def __init__(self, opmux, fsh): def __init__(self, opmux, fsh):
self.opmux = opmux self.opmux = opmux
...@@ -51,7 +56,12 @@ class CountMuxPreset(ChainPreset): ...@@ -51,7 +56,12 @@ class CountMuxPreset(ChainPreset):
frelonnodes = [ frelonnodes = [
node for node in chain.nodes_list if node.name.startswith("frelon") node for node in chain.nodes_list if node.name.startswith("frelon")
] ]
frelon2shutter = {"frelon1": "CAM1", "frelon2": "CAM2", "frelon3": "CAM3"} frelon2shutter = {
"frelon1": "CAM1",
"frelon2": "CAM2",
"frelon3": "CAM3",
"frelon16": "CAM1",
}
for node in frelonnodes: for node in frelonnodes:
dev = node.device dev = node.device
if dev.name in frelon2shutter: if dev.name in frelon2shutter:
...@@ -94,6 +104,7 @@ CAM2MUX = { ...@@ -94,6 +104,7 @@ CAM2MUX = {
"frelon2": "CAM2", "frelon2": "CAM2",
"frelon3": "CAM3", "frelon3": "CAM3",
"marana": "MARANA", "marana": "MARANA",
"frelon16": "CAM1",
} }
class FScanMuxPreset(ScanPreset): class FScanMuxPreset(ScanPreset):
......
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