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
Yes I know, for example strings are itterable as well (for example)

I was concerned about that, but we also need very strong type-checking on the input for users. However having said that, numpy arrays don’t have __itter__ so perhaps this is too fragile. We could check for __getitem__ as well?

Struggling to make this generic enough but still check that it is itterable.

S
On Dec 8, 2014, at 12:30 AM, Thomas A Caswell <notifications@github.com<mailto:notifications@github.com>> wrote:


In ophyd/userapi/scan_api.py:

> @@ -0,0 +1,259 @@
> +from __future__ import print_function
> +import numpy as np
> +from time import sleep, strftime
> +
> +from ophyd.runengine import RunEngine
> +from ophyd.controls import EpicsMotor, PVPositioner
> +
> +from pyOlog import SimpleOlogClient
> +
> +__all__ = ['AScan', 'DScan']
> +
> +
> +def ensure_iterator(i):
> +    """Check if i is an iterator. If not return length-1 iterator"""


This isn't strictly true, if an object has a __getitem__ but not a __itter__ it will still be interable (it will just try x[n] for n in itertools.count() ).

—
Reply to this email directly or view it on GitHub<https://github.com/NSLS-II/ophyd/pull/26/files#r21435606>.