Skip to content

Draft: Added default chain with tag

Valentin Valls requested to merge default-chain-with-tag into master

Closes #4025

This PR provides tags for default qcauisition chain settings

  • A ControllerSettingsObj was added to hold the settings and the tag
  • This object can be used with DEFAULT_CHAIN

Example

With such configuration

- name: lima_with_slow_scans
  plugin: bliss
  class: ControllerSettingsObj
  package: bliss.common.controller_settings

  tags: ["lima-slow"]
  chain_config:
    - device: $pco10
      acquisition_settings:
        acq_trigger_mode: INTERNAL_TRIGGER

- name: lima_with_external_trigger
  plugin: bliss
  class: ControllerSettingsObj
  package: bliss.common.controller_settings

  tags: ["lima-external"]
  chain_config:
    - device: $pco10
      acquisition_settings:
        acq_trigger_mode: EXTERNAL_TRIGGER_MULTI
        acq_mode: ACCUMULATION
      master: $musst_acc
    - device: $frelon
      acquisition_settings:
        acq_trigger_mode: EXTERNAL_TRIGGER_MULTI
        acq_mode: ACCUMULATION
      master: $musst_acc

It can be used this way

# setup.py

# Setup the known settings
DEFAULT_CHAIN.add_settings(lima_with_slow_scans)
DEFAULT_CHAIN.add_settings(lima_with_external_trigger)
DEFAULT_CHAIN.set_settings(default_chain)               # <- for compatibility (its tag is "default"

# The we can use it this way
DEFAULT_CHAIN.set_tags(["lima-external", "default"])

We can define our user scans to deal with this tags

# The PCO will not timeout cause we will resetup it for every frames
# But the frelon will be setup in external trigger
def my_slow_scan(*detectors):
    with DEFAULT_CHAIN.tags_context("lima-slow", "lima-external", "default"):
        ascan(yrot, 0, 200, 2, *detectors)

# Here the PCO will use the external trigger multi
def my_other_scan(*detectors):
    with DEFAULT_CHAIN.tags_context("lima-external", "default"):
        ascan(srot, 0, 360, 3000, 0.1, *detectors)

I would prefer not to use context because it is not greenlet safe. But for now i think we dont really care, do we?

Edited by Valentin Valls

Merge request reports