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