Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 29

...

Running Scans with Hutch Python

...

An example hutch-python scan session in RIX:

Code Block
rix-daq:~> rix3
Loading local disk python env pcds-4.1.4
      _      _____       _   _                 
     (_)    |  __ \     | | | |                
 _ __ ___  _| |__) |   _| |_| |__   ___  _ __  
| '__| \ \/ /  ___/ | | | __| '_ \ / _ \| '_ \ 
| |  | |>  <| |   | |_| | |_| | | | (_) | | | |
|_|  |_/_/\_\_|    \__, |\__|_| |_|\___/|_| |_|
                    __/ |                      
                   |___/                       

INFO     Selected default hutch-python daq platform: 0
INFO     Loading debug tools...

(lines removed for brevity)

In [1]: daq = get_daq() # in tmo this requires a "bluesky=True" kwarg

In [2]: dets = [daq]

In [3]: daq.configure(motors=[sim.fast_motor1, sim.fast_motor2])
INFO     configure: 2 motors
Out[3]: ({}, {})

In [4]: RE(bp.scan(dets, sim.fast_motor1, 1, 10, sim.fast_motor2, 1, 10, 5))


Transient Scan ID: 1     Time: 2021-07-07 17:00:30
Persistent Unique Scan ID: 'e1a966bd-c12d-429d-95ed-ea73f7dd7211'
New stream: 'primary'
+-----------+------------+-------------+-------------+
|   seq_num |       time | fast_motor1 | fast_motor2 |
+-----------+------------+-------------+-------------+
|         1 | 17:00:46.3 |           1 |           1 |
|         2 | 17:00:59.1 |        3.25 |        3.25 |
|         3 | 17:01:08.3 |         5.5 |         5.5 |
|         4 | 17:01:18.3 |        7.75 |        7.75 |
|         5 | 17:01:28.3 |          10 |          10 |
+-----------+------------+-------------+-------------+
generator scan ['e1a966bd'] (scan num: 1)



Out[4]: ('e1a966bd-c12d-429d-95ed-ea73f7dd7211',)

In [5]: daq.push_socket.send_string('shutdown')

In [6]: daq.comm_thread.join()

In [7]: quit
rix-daq:~> 

If the "shutdown" and "join" commands are not issued then the "quit" command will hang, and you will have to control-C to end the program.

Arguments to get_daq() in rix (these are set by modifying daq.args.<attribute>, e.g. daq.args.c):

Code Block
def get_daq():
    # Construct the args that DaqScan is looking for
    args = SimpleNamespace(
        C='drp-neh-ctl001', # DRP host for control
        v=True,             # Verbosity
        B='DAQ:NEH',        # PV Base
        detname='scan',     # Detector name
        scantype='scan',    # scan type
        g=36,               # Bit mask of readout groups
        c=10,               # Events per step
        p=2,                # Platform
        x=0,                # Master XPM
        t=1000,             # Connection timeout
        )