Examples

Example: plan_catalog()

The apstools 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:

apstools_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                                                           
=================== ========= == ======================== ===============================================================
2019-02-19 17:04:56 f1caf5aa  1  scan                     detectors=['scaler'], num=15, args=['m1', -5, 5], per_step=None
2019-02-19 17:09:23 adbfd046  1  scan                     detectors=['scaler'], num=15, args=['m1', -5, 5], per_step=None
2019-02-19 17:10:38 481a04b2  1  TuneAxis.multi_pass_tune                                                                
2019-02-19 17:10:45 0d45103a  2  TuneAxis.multi_pass_tune                                                                
2019-02-19 17:10:49 30d80cb1  3  TuneAxis.multi_pass_tune                                                                
2019-02-19 17:10:52 c354fe37  4  TuneAxis.tune                                                                           
2019-02-19 17:11:20 225eef4b  1  scan                     detectors=['scaler'], num=15, args=['m1', -5, 5], 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/apstools/blob/master/docs/source/resources/demo_specfile_example.ipynb

Example: Create a SPEC file from databroker

We’ll use a Jupyter notebook to demonstrate the how to get a scan from the databroker and write it to a spec data file. Follow here: https://github.com/BCDA-APS/apstools/blob/master/docs/source/resources/demo_specfile_databroker.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/apstools/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/apstools/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

apstools.examples.main()[source]

summary list of all scans in the databroker

apstools_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.

apstools.examples.plan_catalog(db)[source]

make a table of all scans known in the databroker

Example:

from apstools.examples import plan_catalog
plan_catalog(db)
apstools.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.