Examples

Example: plan_catalog()

The APS_BlueSky_tools package provides an executable that can be used to display a summary of all the scans in the database. The executable wraps the demo function: plan_catalog(). It is for demonstration purposes only (since it does not filter the output to any specific subset of scans).

The output is a table, formatted as restructured text, with these columns:

date/time:The date and time the scan was started.
short_uid:The first characters of the scan’s UUID (unique identifier).
id:The scan number. (User has control of this and could reset the counter for the next scan.)
plan:Name of the plan that initiated this scan.
args:Arguments to the plan that initiated this scan.

This is run as a linux console command:

aps_bluesky_tools_plan_catalog | tee out.txt

The full output is almost a thousand lines. Here are the first few lines:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
=================== ========= ==== ======================== ===========================================================================================================================================================
date/time           short_uid id   plan                     args                                                                                                                                                       
=================== ========= ==== ======================== ===========================================================================================================================================================
2017-10-26 11:21:28 3fe59011  1    scan                     detectors=['noisy'], num=219, motor=['m1'], start=-1.5, stop=-0.5, per_step=None                                                                           
2017-10-26 11:21:42 25b4c903  2    scan                     detectors=['noisy'], num=219, motor=['m1'], start=-1.5, stop=-0.5, per_step=None                                                                           
2017-10-26 11:22:08 3953e8e0  3    scan                     detectors=['noisy'], num=219, motor=['m1'], start=-1.5, stop=-0.5, per_step=None                                                                           
2017-10-26 11:22:22 f24bf2cc  4    scan                     detectors=['noisy'], num=219, motor=['m1'], start=-1.5, stop=-0.5, per_step=None                                                                           
2017-10-26 11:22:37 44b751d2  5    scan                     detectors=['noisy'], num=219, motor=['m1'], start=-1.5, stop=-0.5, per_step=None                                                                           
2017-10-26 11:22:50 4e3741f5  6    scan                     detectors=['noisy'], num=219, motor=['m1'], start=-1.5, stop=-0.5, per_step=None                                                                           
2017-10-26 11:24:33 a83df5d4  7    scan                     detectors=['synthetic_pseudovoigt'], num=219, motor=['m1'], start=-2, stop=0, per_step=None                                                                

Example: specfile_example()

We’ll use a Jupyter notebook to demonstrate the specfile_example() that writes one or more scans to a SPEC data file. Follow here: https://github.com/BCDA-APS/APS_BlueSky_tools/blob/master/docs/source/resources/demo_specfile_example.ipynb

Example: nscan()

We’ll use a Jupyter notebook to demonstrate the nscan() plan. An nscan is used to scan two or more axes together, such as a \(\theta\)-\(2\theta\) diffractometer scan. Follow here: https://github.com/BCDA-APS/APS_BlueSky_tools/blob/master/docs/source/resources/demo_nscan.ipynb

Example: TuneAxis()

We’ll use a Jupyter notebook to demonstrate the TuneAxis() support that provides custom alignment of a signal against an axis. Follow here: https://github.com/BCDA-APS/APS_BlueSky_tools/blob/master/docs/source/resources/demo_tuneaxis.ipynb

Source Code Documentation

demonstrate BlueSky callbacks

plan_catalog(db) make a table of all scans known in the databroker
specfile_example(headers[, filename]) write one or more headers (scans) to a SPEC data file
APS_BlueSky_tools.examples.main()[source]

summary list of all scans in the databroker

aps_bluesky_tools_plan_catalog command-line application

This can be unwieldy if there are many scans in the databroker. Consider it as a demo program rather than for general, long-term use.

APS_BlueSky_tools.examples.plan_catalog(db)[source]

make a table of all scans known in the databroker

Example:

from APS_BlueSky_tools.examples import plan_catalog
plan_catalog(db)
APS_BlueSky_tools.examples.specfile_example(headers, filename='test_specdata.txt')[source]

write one or more headers (scans) to a SPEC data file

Downloads

The jupyter notebook and files related to this section may be downloaded from the following table.