def absolute_mesh(*args, time=None, md=None): if (len(args) % 4) == 1: if time is not None: raise ValueError('wrong number of positional arguments') args, time = args[:-1], args[-1] total_points = 1 for motor, start, stop, num in chunked(args, 4): total_points *= num yield from _pre_scan(total_points=total_points, count_time=time) yield from spec_api.mesh(*args, time=time, md=md)
def test_basic_usage(): try: import metadatastore except ImportError: raise nose.SkipTest from bluesky.global_state import gs from bluesky.spec_api import (ct, ascan, a2scan, a3scan, dscan, d2scan, d3scan, mesh, tscan, dtscan, th2th) gs.DETS = [det] with assert_raises(TraitError): gs.DETS = [det, det] # no duplicate data keys gs.TEMP_CONTROLLER = motor gs.TH_MOTOR = motor1 gs.TTH_MOTOR = motor2 gs.RE.md['owner'] = 'test' gs.RE.md['group'] = 'test' gs.RE.md['beamline_id'] = 'test' gs.RE.md['config'] = {} # without count time specified ct() ct(num=3) # passing kwargs through to scan ascan(motor, 1, 2, 2) a2scan(motor, 1, 2, 2) a3scan(motor, 1, 2, 2) dscan(motor, 1, 2, 2) d2scan(motor, 1, 2, 2) d3scan(motor, 1, 2, 2) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3) tscan(1, 2, 2) dtscan(1, 2, 2) th2th(1, 2, 2) # with count time specified as positional arg ct() ascan(motor, 1, 2, 2, 0.1) a2scan(motor, 1, 2, 2, 0.1) a3scan(motor, 1, 2, 2, 0.1) dscan(motor, 1, 2, 2, 0.1) d2scan(motor, 1, 2, 2, 0.1) d3scan(motor, 1, 2, 2, 0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, 0.1) tscan(1, 2, 2, 0.1) dtscan(1, 2, 2, 0.1) th2th(1, 2, 2, 0.1) # with count time specified as keyword arg ct() ascan(motor, 1, 2, 2, time=0.1) a2scan(motor, 1, 2, 2, time=0.1) a3scan(motor, 1, 2, 2, time=0.1) dscan(motor, 1, 2, 2, time=0.1) d2scan(motor, 1, 2, 2, time=0.1) d3scan(motor, 1, 2, 2, time=0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, time=0.1) tscan(1, 2, 2, time=0.1) dtscan(1, 2, 2, time=0.1) th2th(1, 2, 2, time=0.1) flyer = FlyMagic('wheee', motor, det1, det2) gs.FLYERS = [flyer] ct()
def test_basic_usage(): try: import metadatastore except ImportError: raise nose.SkipTest from bluesky.global_state import gs from bluesky.spec_api import (ct, ascan, a2scan, a3scan, dscan, d2scan, d3scan, mesh, tscan, dtscan, th2th) gs.DETS = [det] with assert_raises(TraitError): gs.DETS = [det, det] # no duplicate data keys gs.TEMP_CONTROLLER = motor gs.TH_MOTOR = motor1 gs.TTH_MOTOR = motor2 gs.RE.md['owner'] = 'test' gs.RE.md['group'] = 'test' gs.RE.md['beamline_id'] = 'test' gs.RE.md['config'] = {} # without count time specified ct() ct(num=3) # passing kwargs through to scan ascan(motor, 1, 2, 2) a2scan(motor, 1, 2, 2) a3scan(motor, 1, 2, 2) dscan(motor, 1, 2, 2) d2scan(motor, 1, 2, 2) d3scan(motor, 1, 2, 2) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3) tscan(1, 2, 2) dtscan(1, 2, 2) th2th(1, 2, 2) # with count time specified as positional arg ct() ascan(motor, 1, 2, 2, 0.1) a2scan(motor, 1, 2, 2, 0.1) a3scan(motor, 1, 2, 2, 0.1) dscan(motor, 1, 2, 2, 0.1) d2scan(motor, 1, 2, 2, 0.1) d3scan(motor, 1, 2, 2, 0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, 0.1) tscan(1, 2, 2, 0.1) dtscan(1, 2, 2, 0.1) th2th(1, 2, 2, 0.1) # with count time specified as keyword arg ct() ascan(motor, 1, 2, 2, time=0.1) a2scan(motor, 1, 2, 2, time=0.1) a3scan(motor, 1, 2, 2, time=0.1) dscan(motor, 1, 2, 2, time=0.1) d2scan(motor, 1, 2, 2, time=0.1) d3scan(motor, 1, 2, 2, time=0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, time=0.1) tscan(1, 2, 2, time=0.1) dtscan(1, 2, 2, time=0.1) th2th(1, 2, 2, time=0.1)
def test_basic_usage(): gs.DETS = [det] with assert_raises(TraitError): gs.DETS = [det, det] # no duplicate data keys gs.TEMP_CONTROLLER = motor gs.TH_MOTOR = motor1 gs.TTH_MOTOR = motor2 gs.RE.md["group"] = "test" gs.RE.md["beamline_id"] = "test" gs.RE.md["config"] = {} # without count time specified ct() ascan(motor, 1, 2, 2) a2scan(motor, 1, 2, 2) a3scan(motor, 1, 2, 2) dscan(motor, 1, 2, 2) d2scan(motor, 1, 2, 2) d3scan(motor, 1, 2, 2) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3) tscan(1, 2, 2) dtscan(1, 2, 2) th2th(1, 2, 2) # with count time specified as positional arg ct() ascan(motor, 1, 2, 2, 0.1) a2scan(motor, 1, 2, 2, 0.1) a3scan(motor, 1, 2, 2, 0.1) dscan(motor, 1, 2, 2, 0.1) d2scan(motor, 1, 2, 2, 0.1) d3scan(motor, 1, 2, 2, 0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, 0.1) tscan(1, 2, 2, 0.1) dtscan(1, 2, 2, 0.1) th2th(1, 2, 2, 0.1) # with count time specified as keyword arg ct() ascan(motor, 1, 2, 2, time=0.1) a2scan(motor, 1, 2, 2, time=0.1) a3scan(motor, 1, 2, 2, time=0.1) dscan(motor, 1, 2, 2, time=0.1) d2scan(motor, 1, 2, 2, time=0.1) d3scan(motor, 1, 2, 2, time=0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, time=0.1) tscan(1, 2, 2, time=0.1) dtscan(1, 2, 2, time=0.1) th2th(1, 2, 2, time=0.1)
def test_basic_usage(): gs.DETS = [det] with assert_raises(TraitError): gs.DETS = [det, det] # no duplicate data keys gs.TEMP_CONTROLLER = motor gs.TH_MOTOR = motor1 gs.TTH_MOTOR = motor2 gs.RE.md['group'] = 'test' gs.RE.md['beamline_id'] = 'test' gs.RE.md['config'] = {} # without count time specified ct() ascan(motor, 1, 2, 2) a2scan(motor, 1, 2, 2) a3scan(motor, 1, 2, 2) dscan(motor, 1, 2, 2) d2scan(motor, 1, 2, 2) d3scan(motor, 1, 2, 2) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3) tscan(1, 2, 2) dtscan(1, 2, 2) th2th(1, 2, 2) # with count time specified as positional arg ct() ascan(motor, 1, 2, 2, 0.1) a2scan(motor, 1, 2, 2, 0.1) a3scan(motor, 1, 2, 2, 0.1) dscan(motor, 1, 2, 2, 0.1) d2scan(motor, 1, 2, 2, 0.1) d3scan(motor, 1, 2, 2, 0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, 0.1) tscan(1, 2, 2, 0.1) dtscan(1, 2, 2, 0.1) th2th(1, 2, 2, 0.1) # with count time specified as keyword arg ct() ascan(motor, 1, 2, 2, time=0.1) a2scan(motor, 1, 2, 2, time=0.1) a3scan(motor, 1, 2, 2, time=0.1) dscan(motor, 1, 2, 2, time=0.1) d2scan(motor, 1, 2, 2, time=0.1) d3scan(motor, 1, 2, 2, time=0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, time=0.1) tscan(1, 2, 2, time=0.1) dtscan(1, 2, 2, time=0.1) th2th(1, 2, 2, time=0.1)
def test_basic_usage(): gs.DETS = [det] gs.TEMP_CONTROLLER = motor gs.TH_MOTOR = motor1 gs.TTH_MOTOR = motor2 gs.RE.md['group'] = 'test' gs.RE.md['beamline_id'] = 'test' gs.RE.md['config'] = {} # without count time specified ct() ascan(motor, 1, 2, 2) a2scan(motor, 1, 2, 2) a3scan(motor, 1, 2, 2) dscan(motor, 1, 2, 2) d2scan(motor, 1, 2, 2) d3scan(motor, 1, 2, 2) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3) tscan(1, 2, 2) dtscan(1, 2, 2) th2th(1, 2, 2) # with count time specified as positional arg ct() ascan(motor, 1, 2, 2, 0.1) a2scan(motor, 1, 2, 2, 0.1) a3scan(motor, 1, 2, 2, 0.1) dscan(motor, 1, 2, 2, 0.1) d2scan(motor, 1, 2, 2, 0.1) d3scan(motor, 1, 2, 2, 0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, 0.1) tscan(1, 2, 2, 0.1) dtscan(1, 2, 2, 0.1) th2th(1, 2, 2, 0.1) # with count time specified as keyword arg ct() ascan(motor, 1, 2, 2, time=0.1) a2scan(motor, 1, 2, 2, time=0.1) a3scan(motor, 1, 2, 2, time=0.1) dscan(motor, 1, 2, 2, time=0.1) d2scan(motor, 1, 2, 2, time=0.1) d3scan(motor, 1, 2, 2, time=0.1) mesh(motor1, 1, 2, 2, motor2, 1, 2, 3, time=0.1) tscan(1, 2, 2, time=0.1) dtscan(1, 2, 2, time=0.1) th2th(1, 2, 2, time=0.1)
# motors theta = Mover('theta', ['theta']) gamma = Mover('gamma', ['gamma']) # synthetic detectors coupled to one motor theta_det = SynGauss('theta_det', theta, 'theta', center=0, Imax=1, sigma=1) gamma_det = SynGauss('gamma_det', gamma, 'gamma', center=0, Imax=1, sigma=1) # synthetic detector coupled to two detectors tgd = Syn2DGauss('theta_gamma_det', theta, 'theta', gamma, 'gamma', center=(0, 0), Imax=1) # set up the default detectors gs.DETS = [theta_det, gamma_det, tgd] ysteps = 25 xsteps = 20 # hook up the live raster callback #cb = bluesky.callbacks.LiveRaster((ysteps + 1, xsteps + 1), # 'theta_gamma_det', clim=[0, 1]) mesha = bss.OuterProductAbsScan() # run a mesh scan gs.MASTER_DET_FIELD = 'theta_gamma_det' bsa.mesh(theta, -2.5, 2.5, ysteps, gamma, -2, 2, xsteps, False)
import bluesky.spec_api as bsa import bluesky.callbacks from bluesky.standard_config import gs import bluesky.qt_kicker # motors theta = Mover('theta', ['theta']) gamma = Mover('gamma', ['gamma']) # synthetic detectors coupled to one motor theta_det = SynGauss('theta_det', theta, 'theta', center=0, Imax=1, sigma=1) gamma_det = SynGauss('gamma_det', gamma, 'gamma', center=0, Imax=1, sigma=1) # synthetic detector coupled to two detectors tgd = Syn2DGauss('theta_gamma_det', theta, 'theta', gamma, 'gamma', center=(0, 0), Imax=1) # set up the default detectors gs.DETS = [theta_det, gamma_det, tgd] ysteps = 25 xsteps = 20 # hook up the live raster callback #cb = bluesky.callbacks.LiveRaster((ysteps + 1, xsteps + 1), # 'theta_gamma_det', clim=[0, 1]) mesha = bss.OuterProductAbsScan() # run a mesh scan gs.MASTER_DET_FIELD = 'theta_gamma_det' bsa.mesh(theta, -2.5, 2.5, ysteps, gamma, -2, 2, xsteps, False)