Package: wright_plans
wright-plansA set ofBluesky Planswith a focus on experimental orchestration within the Wright Group.installationInstall the latest released version from PyPI:$python3-mpipinstallwright-plansconda-forge coming soon!Useflitto install from source.$ git clone https://github.com/wright-group/wright-plans.git
$ cd wright-plans
$ flit install -susagewright-plans extends Bluesky in three major ways:support forWrightTools-style unitssupport for "constants", algebraic expressions for hardware relationships as described belowsupport for specialized tuning procecdures unique to Wright Group experimentsThe plans defined by this package all end in_wpso that their names never collide with plans defined within Bluesky itself or other Bluesky plan providers.
Feel free to mix these plans into an existing environment if that makes sense.
Refer to theBluesky documentationfor documentation on how to utilize these plans within a simple Python script or notebook environment.
A minimal example follows:>>>importyaqc_bluesky>>>motor1=yaqc_bluesky.Device(39000)>>>motor2=yaqc_bluesky.Device(39001)>>>sensor=yaqc_bluesky.Device(39002)>>>importbluesky>>>RE=bluesky.RunEngine()>>>importwright_plans>>>RE(wright_plans.grid_scan_wp([sensor],motor1,-1,1,11,"mm",motor2,-1,1,11,"mm")For usage within a bluesky-queueserver, considerbluesky-in-a-box.Note that the runs generated by these plans are guaranteed to be compatable with WrightTools via thefrom_databrokermethod.>>>importdatabroker>>>importWrightToolsaswt>>>mongo=databroker.catalog["mongo"]>>>run=mongo[-1]# get most recent run from catalog>>>wt.data.from_databroker(mongo)<WrightTools.Data>Plans from the broader Bluesky ecosystem may or may not be compatible withfrom_databroker.
Bluesky is capable of arbitrary orchestration, and some experiments violate the core assumptions of WrightTools.
Still, the rest of the Bluesky data processing ecosystem is avaliable for such plans.constantsConstants provide a tool for driving auxilliary hardware with algebraic expressions relating to the position of scanning hardware.For example, a scan involving two tunable light sources,w1andw2, might have the monochromator (wm) track the algebraic sum2 * w1 + w2.
This is an especially important capability for Coherent Multidimensional Spectroscopy as described inNeff-Mallon and Wright 2017.Constants inwright_plansallow for arbitray linear combinations of other hardware with compatible units.
Constants are units aware and do addition/multiplication in the specified units.Constants are defined using theConstantclass withConstantTermelements.An example of the scan described above:>>>importyaqc_bluesky>>>w1=yaqc_bluesky.Device(39000)>>>w2=yaqc_bluesky.Device(39001)>>>wm=yaqc_bluesky.Device(39002)>>>sensor=yaqc_bluesky.Device(39003)>>>>>>importbluesky>>>RE=bluesky.RunEngine()>>>>>>fromwright_plansimportConstant,ConstantTerm,gridscan_wp>>>constants={wm:Constant("wn",[...ConstantTerm(2,w1),...ConstantTerm(1,w2),...])}>>>RE(grid_scan_wp([sensor],motor1,-1,1,11,"mm",motor2,-1,1,11,"mm",constants=constants)constant dictionarydescriptionConstant("nm", [ConstantTerm(1300, None)])remain static at1300 nmConstant("ps", [ConstantTerm(1, d2)])}trackd2Constant("wn", [ConstantTerm(3, w1)])}triplew1(in wn)Constant("wn", [ConstantTerm(3, w1), ConstantTerm(-800, None)])}triplew1and subtract 800 wnConstant("wn", [ConstantTerm(1, w1), ConstantTerm(1, w2), ConstantTerm(1, w3)])}Constant for Triple Sum FrequencyEach entry in the constants dictionary describes the tracking behavior of one Movable, multiple devices can be set to track in a single scan by passing as a dictionary{motor1: constant1, motor2: constant2}.plansWright plans provides provides the following plans, plan signatures can be found by their docstrings:plan namedescriptionscan_wp"Inner product" scan of multiple motors with evenly spaced pointslist_scan_wp"Inner product" scan of multiple motors with listed positionsgrid_scan_wp"Outer product" scan of multiple axes with evenly spaced pointslist_grid_scan_wp"Outer product" scan of multiple axes with listed positionsscan_nd_wpGeneric N-Dimensional scan using Cycler objectsrel_scan_wp"Inner product" scan of multiple motors with evenly spaced points relative to initial conditionsrel_list_scan_wp"Inner product" scan of multiple motors with listed positions relative to initial conditionsrel_grid_scan_wp"Outer product" scan of multiple axes with evenly spaced points relative to initial conditionsrel_list_grid_scan_wp"Outer product" scan of multiple axes with listed positions relative to initial conditionsmotortuneScan individual motors of an OPAtune_testValidate the output of an OPAtune_intensityTune a motor of an opa to maximize intensitytune_setpointTune a motor of an opa to optimize output colortune_holisticTune two motors in an opa together to optimize color and intensity