Skip to content

Commit e912ca5

Browse files
committed
DOC #223
1 parent 3bb3db5 commit e912ca5

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

docs/source/applications/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Applications
88
:glob:
99

1010
snapshot
11+
spec2ophyd
1112

1213
There are two command-line applications provided by apstools:
1314

@@ -16,4 +17,5 @@ application purpose
1617
===================================================== =================================
1718
:ref:`apstools_plan_catalog <example_plan_catalog>` summary list of all scans in the databroker
1819
:ref:`bluesky_snapshot` Take a snapshot of a list of EPICS PVs and record it in the databroker.
20+
:ref:`spec2ophyd` read SPEC config file and convert to ophyd setup commands
1921
===================================================== =================================
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
2+
3+
.. index:: !spec2ophyd
4+
5+
.. _spec2ophyd:
6+
7+
spec2ophyd
8+
----------
9+
10+
Read SPEC config file and convert to ophyd setup commands.
11+
12+
This is a tool to help migration from SPEC to bluesky. It reads
13+
a SPEC configuration file named `config`
14+
*in the present working directory*
15+
and converts the lines it recognizes into ophyd
16+
commands which create ophyd objects. These commands are printed
17+
to `sys.stdout`. The output can be copied into a setup file for ophyd.
18+
19+
Example
20+
++++++++++++++++++++++
21+
22+
SPEC config file
23+
~~~~~~~~~~~~~~~~
24+
25+
.. code-block:: text
26+
27+
# ID @(#)getinfo.c 6.6 01/15/16 CSS
28+
# Device nodes
29+
SDEV_0 = /dev/ttyUSB0 19200 raw
30+
SDEV_1 = /dev/ttyUSB2 19200 raw
31+
#SDEV_2 = /dev/ttyUSB2 19200 raw
32+
VM_EPICS_M1 = 9idcLAX:m58:c0: 8
33+
VM_EPICS_M1 = 9idcLAX:m58:c1: 8
34+
VM_EPICS_M1 = 9idcLAX:m58:c2: 8
35+
VM_EPICS_M1 = 9idcLAX:mxv:c0: 8
36+
VM_EPICS_M1 = 9idcLAX:pi:c0: 4
37+
VM_EPICS_M1 = 9idcLAX:xps:c0: 8
38+
VM_EPICS_M1 = 9idcLAX:aero:c0: 1
39+
VM_EPICS_M1 = 9idcLAX:mxv:c1: 8
40+
VM_EPICS_M1 = 9idcLAX:aero:c1: 1
41+
VM_EPICS_M1 = 9idcLAX:aero:c2: 1
42+
PSE_MAC_MOT = kohzuE 1
43+
VM_EPICS_M1 = 9ida: 60
44+
VM_EPICS_M1 = 9idcLAX:aero:c3: 1
45+
VM_EPICS_SC = 9idcLAX:vsc:c0 16
46+
# CAMAC Slot Assignments
47+
# CA_name_unit = slot [crate_number]
48+
# Motor cntrl steps sign slew base backl accel nada flags mne name
49+
MOT000 = EPICS_M2:0/2 2000 1 2000 200 50 125 0 0x003 mx mx
50+
MOT001 = EPICS_M2:0/3 2000 1 2000 200 50 125 0 0x003 my my
51+
MOT002 = EPICS_M2:1/1 2000 1 2000 200 50 125 0 0x003 msx msx
52+
MOT003 = EPICS_M2:1/2 2000 1 2000 200 50 125 0 0x003 msy msy
53+
MOT004 = EPICS_M2:1/3 2000 1 2000 200 50 125 0 0x003 art ART50-100
54+
MOT005 = EPICS_M2:2/5 2000 1 2000 200 50 125 0 0x003 uslvcen uslitvercen
55+
MOT006 = EPICS_M2:2/6 2000 1 2000 200 50 125 0 0x003 uslhcen uslithorcen
56+
MOT007 = EPICS_M2:3/3 2000 1 2000 200 50 125 0 0x003 gslout GSlit_outb
57+
MOTPAR:read_mode = 7
58+
MOT008 = EPICS_M2:3/4 2000 1 2000 200 50 125 0 0x003 gslinb GSlit_inb
59+
MOTPAR:read_mode = 7
60+
MOT009 = EPICS_M2:3/5 2000 1 2000 200 50 125 0 0x003 gsltop GSlit_top
61+
MOTPAR:read_mode = 7
62+
MOT010 = EPICS_M2:3/6 2000 1 2000 200 50 125 0 0x003 gslbot GSlit_bot
63+
MOTPAR:read_mode = 7
64+
MOT011 = MAC_MOT:0/0 2000 1 2000 200 50 125 0 0x003 en en
65+
MOTPAR:read_mode = 7
66+
MOT012 = EPICS_M2:10/43 2000 1 2000 200 50 125 0 0x003 InbMS MonoSl_inb
67+
# Counter ctrl unit chan scale flags mne name
68+
CNT000 = EPICS_SC 0 0 10000000 0x001 sec seconds
69+
CNT001 = EPICS_SC 0 1 1 0x002 I0 I0
70+
CNT002 = EPICS_SC 0 2 1 0x000 I00 I00
71+
CNT003 = EPICS_SC 0 3 1 0x000 upd2 photodiode
72+
CNT004 = EPICS_SC 0 4 1 0x000 trd TR_diode
73+
CNT005 = EPICS_SC 0 5 1 0x000 I000 I000
74+
75+
command line
76+
~~~~~~~~~~~~
77+
78+
.. code-block:: bash
79+
80+
spec2ophyd
81+
82+
83+
output
84+
~~~~~~
85+
86+
.. code-block:: text
87+
88+
mx = EpicsMotor('9idcLAX:m58:c0:m2', name='mx', labels=('motor',))
89+
my = EpicsMotor('9idcLAX:m58:c0:m3', name='my', labels=('motor',))
90+
msx = EpicsMotor('9idcLAX:m58:c1:m1', name='msx', labels=('motor',))
91+
msy = EpicsMotor('9idcLAX:m58:c1:m2', name='msy', labels=('motor',))
92+
art = EpicsMotor('9idcLAX:m58:c1:m3', name='art', labels=('motor',)) # ART50-100
93+
uslvcen = EpicsMotor('9idcLAX:m58:c2:m5', name='uslvcen', labels=('motor',)) # uslitvercen
94+
uslhcen = EpicsMotor('9idcLAX:m58:c2:m6', name='uslhcen', labels=('motor',)) # uslithorcen
95+
gslout = EpicsMotor('9idcLAX:mxv:c0:m3', name='gslout', labels=('motor',)) # GSlit_outb # read_mode=7
96+
gslinb = EpicsMotor('9idcLAX:mxv:c0:m4', name='gslinb', labels=('motor',)) # GSlit_inb # read_mode=7
97+
gsltop = EpicsMotor('9idcLAX:mxv:c0:m5', name='gsltop', labels=('motor',)) # GSlit_top # read_mode=7
98+
gslbot = EpicsMotor('9idcLAX:mxv:c0:m6', name='gslbot', labels=('motor',)) # GSlit_bot # read_mode=7
99+
# Macro Motor: SpecMotor(mne='en', config_line='11', macro_prefix='kohzuE') # read_mode=7
100+
InbMS = EpicsMotor('9ida:m43', name='InbMS', labels=('motor',)) # MonoSl_inb
101+
c0 = ScalerCH('9idcLAX:vsc:c0', name='c0', labels=('detectors',))
102+
# counter: sec = SpecCounter(mne='sec', config_line='0', name='seconds', unit='0', chan='0', pvname=9idcLAX:vsc:c0.S1)
103+
# counter: I0 = SpecCounter(mne='I0', config_line='1', unit='0', chan='1', pvname=9idcLAX:vsc:c0.S2)
104+
# counter: I00 = SpecCounter(mne='I00', config_line='2', unit='0', chan='2', pvname=9idcLAX:vsc:c0.S3)
105+
# counter: upd2 = SpecCounter(mne='upd2', config_line='3', name='photodiode', unit='0', chan='3', pvname=9idcLAX:vsc:c0.S4)
106+
# counter: trd = SpecCounter(mne='trd', config_line='4', name='TR_diode', unit='0', chan='4', pvname=9idcLAX:vsc:c0.S5)
107+
# counter: I000 = SpecCounter(mne='I000', config_line='5', unit='0', chan='5', pvname=9idcLAX:vsc:c0.S6)
108+
109+
Cautions
110+
++++++++++++++++++++++
111+
112+
* *spec2ophyd* is a work-in-progress.
113+
* *spec2ophyd* does not rely on any libraries of *apstools*
114+
* It is not necessarily robust
115+
* There is no command line help for this utility.
116+
* It is not packaged or installed with the apstools.
117+
* It is only available from the source code repository.
118+
* It may be refactored or removed at any time.
119+
* Check the *apstools* Change History for more updates (https://github.com/BCDA-APS/apstools/blob/master/CHANGES.rst)

0 commit comments

Comments
 (0)