N-Dimensional Scan

Helper that creates commands for an N-dimensional scan.

Example

>>> from __future__ import print_function
>>> from scan import *

>>> class MyScanSettings(ScanSettings):
...     def __init__(self):
...         super(MyScanSettings, self).__init__()
...         self.defineDeviceClass(".pos", completion=True)
... 
>>> setScanSettings(MyScanSettings())
 
>>> print(CommandSequence(createNDimScan(('xpos', 1, 10))))
[
    Loop('xpos', 1, 10, 1,
    [
        Log('xpos')
    ], completion=True)
]
>>> 


>>> print(CommandSequence(createNDimScan(('xpos', 1, 10), 'readback')))
[
    Loop('xpos', 1, 10, 1,
    [
        Log('xpos', 'readback')
    ], completion=True)
]
   
>>> print(CommandSequence(createNDimScan(('xpos', 1, 10),
...                                      ('ypos', 1, 5, 0.2), 'readback')))
[
    Loop('xpos', 1, 10, 1,
    [
        Loop('ypos', 1, 5, 0.2,
        [
            Log('xpos', 'ypos', 'readback')
        ], completion=True)
    ], completion=True)
]

>>> print(CommandSequence(createNDimScan(
...          ('xpos', 1, 10),
...              ('ypos', 1, 5, 0.2),
...                   Set('xyz', 1), Set('xyz', 0))))
[
    Loop('xpos', 1, 10, 1,
    [
        Loop('ypos', 1, 5, 0.2,
        [
            Set('xyz', 1),
            Set('xyz', 0),
            Log('xpos', 'ypos')
        ], completion=True)
    ], completion=True)
]
                        
                          

API

scan.ndim.createNDimScan(*parameters)

N-dimensional scan

Creates nested Loop commands for N-dimensional scan. Logs arbitrary number of reading.

Parameters

parameters – One or more parameters

Parameters include:

  • Individual Set, Wait, … command or list of commands

  • Loop specification (‘device’, start, end) or (‘device’, start, end, step) to create a loop

  • Names of device to log in addition to loop’ed devices

All the devices used in loops or mentioned as device names will be logged in the innermost loop.

Example for scanning ‘xpos’ from 1 to 10, stepping 1. ‘xpos’ will be logged:

>>> cmds = createNDimScan( ('xpos', 1, 10) )

Log the ‘readback’ together with ‘xpos’ from the loop:

>>> cmds =  createNDimScan( ('xpos', 1, 10), 'readback')

Scan ‘xpos’, with an inside loop for ‘ypos’, logging ‘readback’ in addition to ‘xpos’ and ‘ypos’:

>>> cmds =  createNDimScan( ('xpos', 1, 10), ('ypos', 1, 5, 0.2), 'readback')

Scan ‘xpos’ and ‘ypos’, toggling something to 1 and then 0 in the inner loop:

>>> cmds = createNDimScan(('xpos', 1, 10), ('ypos', 1, 5, 0.2), Set('xyz', 1), Set('xyz', 0))