Scans API for ophyd

Hi,

Here is the first cut again for scans using the class concept. This is tested with the xf23id1 config. 

Generic N x M scans are possible. 

Needs work on type checking and exception handling. 

Comments?
S
I will have to check with this … I spend some time testing the code as it stands. Can we proceed with the PR as it stands and implement this next round?

S
On Dec 8, 2014, at 12:06 AM, Thomas A Caswell <notifications@github.com<mailto:notifications@github.com>> wrote:


In ophyd/userapi/scan_api.py:

> +
> +        npts = ensure_iterator(npts)
> +        positioners = ensure_iterator(positioners)
> +        start = ensure_iterator(start)
> +        stop = ensure_iterator(stop)
> +
> +        dimension = len(npts)
> +        pos = list()
> +        paths = list()
> +
> +        npts = np.asarray(npts) + 1
> +
> +        start = ensure_iterator(start)
> +        stop = ensure_iterator(stop)
> +
> +        for b, e, d in zip(start, stop, range(dimension)):


I think something like

edges = [np.linspace(strt, stp, pts) in zip(start, stop, npts)]
paths = [np.array(_) for _ in zip(*product(*edges))]

simplifies this code.

paths is a list of arrays which are the paths for each positioner to follow.

import numpy as np
from itertools import product

start = (0, 0, 0)
stop = (1, 1, 1)
npts = (2, 2, 2)

edges = [np.linspace(strt, stp, pts) for strt, stp, pts in zip(start, stop, npts)]
paths = zip(*product(*edges))
print paths[0]
print paths[1]
print paths[2]

In [31]: (0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0)
(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)
(0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)


—
Reply to this email directly or view it on GitHub<https://github.com/NSLS-II/ophyd/pull/26/files#r21435005>.