Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

EPICS PV step scans use the BlueSky software from BNL (https://nsls-ii.github.io/bluesky/).  In this mode one or more PV's are modified while the DAQ is paused, then data is acquired (, either for a :

  1.  a fixed number of shots,
  2.  a fixed time, or
  3.  until the event code sequencer completes.

Then or a fixed time) then the DAQ is paused again and the PV is modified again for the next "step".  BlueSky supports complex coordinated motion of multiple PV's.

An example python script has been created to demonstrate support for PV scans with the RIX instrument.

...

Code Block
languagetext
titlerix_bluesky_scan.py help
usage: rix_bluesky_scan.py [-h] [-p {0,1,2,3,4,5,6,7}] [-C COLLECT_HOST]
                           [-t TIMEOUT] [-c READOUT_COUNT] [-g GROUP_MASK] [--config ALIAS]
                             [--config ALIAS] [--detname DETNAME]
                          [--detname DETNAME] [--scantype SCANTYPE] [--scantype SCANTYPEseqctl SEQCTL [SEQCTL ...]] [--record] [-v]

optional arguments:
   -h, --help           help            show this help message and exit
   -p {0,1,2,3,4,5,6,7}   platform (default 2)
   -C COLLECT_HOST          collection host (default drp-neh-ctl001)
   -t TIMEOUT            TIMEOUT            timeout msec (default 10000)
   -c READOUT_COUNT COUNT        # of events to aquire at each step (default 120)
   -g GROUP_MASK             bit mask of readout groups (default 36)
   --config ALIAS  ALIAS          configuration alias (default BEAM)
   --detname DETNAME       detector name (default 'scan')
   --scantype SCANTYPE    scan type (default 'scan')
   --record seqctl  SEQCTL           enable recording of data
  -v                    be verbose

step_value Handling

PV scans automatically generate a 1-based step counter named "step_value" and record it alongside motor positions, like so:

Code Block
languagetext
titlestep_value demo
$ xtcreader -f /cds/data/psdm/rix/rixx43518/xtc/rixx43518-r0518-s007-c000.xtc2 -d
  ...
event 3,   BeginStep transition: time 1003603961.730737554, env 0x06040024, payloadSize 147 extent 159
Found 4 names
0: 'step_value' rank 0, type 7
'step_value': 1
1: 'step_docstring' rank 1, type 10
'step_docstring': "{"detname": "scan", "scantype": "scan", "step": 1}"
2: 'fast_motor1' rank 0, type 9
'fast_motor1': 1.000000
3: 'fast_motor2' rank 0, type 9
'fast_motor2': 1.000000
  ...
event 8,   BeginStep transition: time 1003603961.964178292, env 0x060e0024, payloadSize 147 extent 159
Found 4 names
0: 'step_value' rank 0, type 7
'step_value': 2
1: 'step_docstring' rank 1, type 10
'step_docstring': "{"detname": "scan", "scantype": "scan", "step": 2}"
2: 'fast_motor1' rank 0, type 9
'fast_motor1': 3.250000
3: 'fast_motor2' rank 0, type 9
'fast_motor2': 3.250000
  ...

One can override "step_value" by creating a motor named "step_value" and including it among other motors in the scan. This step count also appears in the JSON formatted "step_docstring" automatically.

Detector Configuration Scans

[SEQCTL ...]
                        sequence control (e.g. DAQ:NEH:XPM:0:SeqReset 4 [DAQ:NEH:XPM:0:SeqDone])
  --record              enable recording of data
  -v                    be verbose

The optional "seqctl" argument is sent to the DAQ on the configure transition.  The optional "detname" argument is used by the DAQ to determine which readout group to use to count events.

  • The first argument to "seqctl" is the PV to restart the sequence
  • The second argument is a bit mask of sequence engines to restart
  • The third (optional) argument is which variable to use to detect that the sequence is complete.  It defaults to "StepDone" in the daq code (control.py) when using "number of counts" to end the step.  One uses "SeqDone" when using an XPM sequence, and the third case is when we're using the accelerator to burst, and this is set to listen to a variable from them telling them that the burst is complete.

step_value Handling

PV scans automatically generate a 1-based step counter named "step_value" and record it alongside motor positions, like so:

Code Block
languagetext
titlestep_value demo
$ xtcreader -f /cds/data/psdm/rix/rixx43518/xtc/rixx43518-r0518-s007-c000.xtc2 -d
  ...
event 3,   BeginStep transition: time 1003603961.730737554, env 0x06040024, payloadSize 147 extent 159
Found 4 names
0: 'step_value' rank 0, type 7
'step_value': 1
1: 'step_docstring' rank 1, type 10
'step_docstring': "{"detname": "scan", "scantype": "scan", "step": 1}"
2: 'fast_motor1' rank 0, type 9
'fast_motor1': 1.000000
3: 'fast_motor2' rank 0, type 9
'fast_motor2': 1.000000
  ...
event 8,   BeginStep transition: time 1003603961.964178292, env 0x060e0024, payloadSize 147 extent 159
Found 4 names
0: 'step_value' rank 0, type 7
'step_value': 2
1: 'step_docstring' rank 1, type 10
'step_docstring': "{"detname": "scan", "scantype": "scan", "step": 2}"
2: 'fast_motor1' rank 0, type 9
'fast_motor1': 3.250000
3: 'fast_motor2' rank 0, type 9
'fast_motor2': 3.250000
  ...

One can override "step_value" by creating a motor named "step_value" and including it among other motors in the scan. This step count also appears in the JSON formatted "step_docstring" automatically.

Group Mask Parameter

We believe the group mask parameter to daq.configure() is passed to control.py and then given to the enable transition.  This programs the xpm's StepGroups PV so the xpm knows which readout group to disable when the sequence completes.  We can't disable all readout groups because another partition may use different readout groups on the same xpm.  It's possible control.py already knows this information, so conceivable we could eliminate this parameter and so reduce complexity, but we're not sure at the time of this writing. - weaver/cpo Feb. 8, 2024.

Detector Configuration Scans

These scans use the same "step" idea described above for EPICS PV step-scans, but instead alter a detector configuration object on each step.  Currently this has been done for the EPIX area detector to take data in the various gain ranges. Python code for this can be found here: https://github.com/slac-lcls/lcls2/blob/master/psdaq/psdaq/app/epixhr_pedestal_scan.py

BebDetector Timing Scan

  • works with any BebDetector
  • there is a control script "generic_timing_scan" in the daq environment in psdaq/psdaq/cas/generic_timing_scan.py.  assumes name "start_ns".  does not use bluesky.  could be changed to any valid config variable in a BebDetector's configuration object, but the "dictionary" variable name must be written correctly in generic_timing_scan.py (e.g. for start_ns it is [f'{args.detname}:user.start_ns']).
  • each step completes when this xpm variable DAQ:NEH:XPM:2:PART:0:StepDone goes to one.  This variable DAQ:NEH:XPM:2:PART:0:StepGroups says which readout groups to enable/disable.
  • start_ns has a minimum value determined by the L0Delay setting for the readout group.
    • L0Delay is in units of 14/13us has a range of 0-100 (there's an off-by-one somewhere).  We get notification of beam ~95us early (ideally 100us, but the beam is faster than the timing packet) so for fast detectors we want to set L0Delay to about 95:  having a larger number reduces the need for DAQ buffering (front end, kcu card, but NOT cpu buffering since we can't guarantee that DMA happens promptly)
  • generic_timing_scan -p 0 -C drp-srcf-mon001 --detname tmo_fzppiranha_0 --events 71000 --linear 108000 112000 1000 --record 0 -v
    • note that the start of the timing scan must respect the L0Delay setting for the readout group
  • We analyzed in ami with a graph like this.  If steps were too short and the detector rates too high it was possible for ami to miss all the data for a step:

Image AddedThese scans use the same "step" idea described above for EPICS PV step-scans, but instead alter a detector configuration object on each step.  Currently this has been done for the EPIX area detector to take data in the various gain ranges. Python code for this can be found here: https://github.com/slac-lcls/lcls2/blob/master/psdaq/psdaq/app/epixhr_pedestal_scan.py

Script Control of Run Stop/Start

...

Running Scans with Hutch Python

UED hutch python logs are here:  /cds/group/pcds/pyps/apps/hutch-python/ued/logs/2022_04
GUI version logs: /cds/data/iocData/ioc-ued-bsgui-qs/iocInfo

An example hutch-python scan session in RIX.  "rix3" also takes a "--debug" option to increase verbosity.  TMO has a similar "tmo3" command.

...