1 | """ |
---|
2 | ############################################################################### |
---|
3 | User macros to configure spec with the Image Server program |
---|
4 | ############################################################################### |
---|
5 | |
---|
6 | * $Id: test-battery.mac 942 2012-06-18 23:19:12Z jemian $ |
---|
7 | * sample file to test sphinx documentation of SPEC macro files |
---|
8 | |
---|
9 | This file contains SPEC macro fragments to test various |
---|
10 | parts of the SPHINX documentation builder. |
---|
11 | """ |
---|
12 | |
---|
13 | def ccdhelp ' |
---|
14 | printf("\nUser macros for the BCDA ccd package\n") |
---|
15 | printf("\t%c%sccdsetup\n",27,"[1m") |
---|
16 | # ... |
---|
17 | ' |
---|
18 | |
---|
19 | local A2Rp0 |
---|
20 | A2Rp0 = 15.759 ;# A2Rp center |
---|
21 | |
---|
22 | |
---|
23 | #============================================================================== |
---|
24 | """ |
---|
25 | common/shutter |
---|
26 | ============== |
---|
27 | |
---|
28 | NAME |
---|
29 | shutter.mac |
---|
30 | |
---|
31 | SUMMARY |
---|
32 | Commands to control a fast photon shutter. |
---|
33 | |
---|
34 | DESCRIPTION |
---|
35 | The macro causes the fast photon shutter to be opened immediately prior to |
---|
36 | any count command, and closed again upon its completion. A configurable |
---|
37 | delay time assures that the shutter is fully open before issuing the |
---|
38 | count command. |
---|
39 | |
---|
40 | The photon shutter is controlled via an EPICS binary output channel, and |
---|
41 | the shutter status is optionally monitored via a binary input channel (in |
---|
42 | which case the delay time is not used, but the monitor signal is used to |
---|
43 | check for completion of the opening process). |
---|
44 | |
---|
45 | AUTHOR |
---|
46 | Christian M. Schlepuetz (CS, cschlep) |
---|
47 | |
---|
48 | CREATION DATE |
---|
49 | 2004/11/06 |
---|
50 | |
---|
51 | COPYRIGHT |
---|
52 | Copyright 2006-2011 by the above authors (see AUTHOR/AUTHORS) |
---|
53 | |
---|
54 | This program is free software: you can redistribute it and/or modify |
---|
55 | it under the terms of the GNU General Public License as published by |
---|
56 | the Free Software Foundation, either version 3 of the License, or |
---|
57 | (at your option) any later version. |
---|
58 | |
---|
59 | This program is distributed in the hope that it will be useful, |
---|
60 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
61 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
62 | GNU General Public License for more details. |
---|
63 | |
---|
64 | You should have received a copy of the GNU General Public License |
---|
65 | along with this program. If not, see http://www.gnu.org/licenses/. |
---|
66 | |
---|
67 | VERSION: |
---|
68 | |
---|
69 | * $. Date: 2010-11-04 19:06:06 -0400 (Thu, 04 Nov 2010) $ |
---|
70 | * $. Author: cschlep $ |
---|
71 | * $. URL: file:///data/svn/software/spec/trunk/common/shutter.mac $ |
---|
72 | * $. Revision: 17 $ |
---|
73 | |
---|
74 | DEPENDENCIES |
---|
75 | Chained macro definitions affected by this macro: |
---|
76 | - user_precount |
---|
77 | - user_getcounts |
---|
78 | - cleanup_always |
---|
79 | |
---|
80 | HISTORY |
---|
81 | 2004/11/06 (CS): |
---|
82 | |
---|
83 | - modified the first original version to comply with naming and format |
---|
84 | conventions |
---|
85 | - implemented help-file support and wrote help texts. |
---|
86 | 2010/03/30 (CS): |
---|
87 | - added the following global variables to make macro more easily portable:: |
---|
88 | |
---|
89 | SHUTTER_CONTROL_PV # EPICS PV name for the shutter control (bo) |
---|
90 | SHUTTER_CONTROL_OPEN # EPICS control value for open shutter |
---|
91 | SHUTTER_CONTROL_CLOSED # EPICS control value for closed shutter |
---|
92 | SHUTTER_STATUS_PV # EPICE PV name for the shutter status (bi) |
---|
93 | SHUTTER_STATUS_OPEN # EPICS status value for open shutter |
---|
94 | SHUTTER_STATUS_CLOSED # EPICS status value for closed shutter |
---|
95 | SHUTTER_IS_ON # flag for automatic shutter control |
---|
96 | SHUTTER_SLEEP_TIME # SPEC sleep time after opening shutter |
---|
97 | |
---|
98 | 2010/07/23 (CS): |
---|
99 | - added SVN keywords (replacing CVS keywords) |
---|
100 | |
---|
101 | 2011/12/19 (CS): |
---|
102 | - reformatted code documentation to work with ROBODoc |
---|
103 | - added shutter_setup with following internal macros: |
---|
104 | |
---|
105 | * _shutter_print_setup |
---|
106 | * _shutter_set_option |
---|
107 | * _clear_screen |
---|
108 | |
---|
109 | - replaced SHUTTER_STATUS* with SHUTTER_MONITOR* |
---|
110 | - replaced global variables _OPEN with _OPEN_VAL and |
---|
111 | _CLOSED with _CLOSED_VAL |
---|
112 | """ |
---|
113 | #============================================================================== |
---|
114 | |
---|
115 | #============================================================================== |
---|
116 | # Define some global variables |
---|
117 | # ---------------------------- |
---|
118 | |
---|
119 | global SHUTTER_MAC |
---|
120 | SHUTTER_MAC = DOFILE |
---|
121 | |
---|
122 | # EPICS PV of the binary output which controls the shutter |
---|
123 | # |
---|
124 | global SHUTTER_CONTROL_PV |
---|
125 | SHUTTER_CONTROL_PV = "X04SA-ES3-SC:FPS" |
---|
126 | |
---|
127 | global SHUTTER_CONTROL_OPEN_VAL |
---|
128 | SHUTTER_CONTROL_OPEN_VAL = "On" |
---|
129 | |
---|
130 | global SHUTTER_CONTROL_CLOSED_VAL |
---|
131 | SHUTTER_CONTROL_CLOSED_VAL = "Off" |
---|
132 | |
---|
133 | # EPICS PV of the binary input which monitors the state of the shutter |
---|
134 | # if SHUTTER_MONITOR_PV = "", no monitoring is performed |
---|
135 | # |
---|
136 | global SHUTTER_MONITOR_PV |
---|
137 | SHUTTER_MONITOR_PV = "" |
---|
138 | |
---|
139 | global SHUTTER_MONITOR_OPEN_VAL |
---|
140 | SHUTTER_MONITOR_OPEN_VAL = "open" |
---|
141 | |
---|
142 | global SHUTTER_MONITOR_CLOSED_VAL |
---|
143 | SHUTTER_MONITOR_CLOSED_VAL = "closed" |
---|
144 | |
---|
145 | global SHUTTER_IS_ON |
---|
146 | SHUTTER_IS_ON = 0 |
---|
147 | |
---|
148 | global SHUTTER_SLEEP_TIME |
---|
149 | SHUTTER_SLEEP_TIME = 0.1 |
---|
150 | |
---|
151 | |
---|
152 | #============================================================================== |
---|
153 | # This macro file contains the following commands: |
---|
154 | #============================================================================== |
---|
155 | |
---|
156 | #------------------------------------------------------------------------------ |
---|
157 | |
---|
158 | def shutter_help 'sh_help' |
---|
159 | |
---|
160 | def sh_help '{ |
---|
161 | """ |
---|
162 | .. spec:def:: sh_help, shutter_help |
---|
163 | |
---|
164 | sh_help, shutter_help |
---|
165 | ============================= |
---|
166 | |
---|
167 | Displays the shutter help text. |
---|
168 | |
---|
169 | usage:: |
---|
170 | |
---|
171 | > sh_help |
---|
172 | |
---|
173 | .. note:: |
---|
174 | The help text is generated by simply displaying the text file |
---|
175 | ``shutter_mac.txt``, which should reside in the same directory as ``shutter.mac``. |
---|
176 | If the file does not exist, a generic help text is shown. |
---|
177 | """ |
---|
178 | |
---|
179 | unix (sprintf ("dirname %s", SHUTTER_MAC), _1) |
---|
180 | ll = length (_1) |
---|
181 | if (substr (_1, ll, 1) == "\n") _1 = substr (_1, 1, (ll - 1)) |
---|
182 | file = sprintf ("%s/shutter_mac.txt", _1) |
---|
183 | if (file_info (file, "-e")) { |
---|
184 | unix (sprintf ("cat %s", file)) |
---|
185 | } else { |
---|
186 | printf("\n Macros available in file shutter.mac:\n") |
---|
187 | printf( " ===========\n") |
---|
188 | printf("\n") |
---|
189 | printf(" sh_help - creates this help text\n") |
---|
190 | printf(" shop - opens the fast shutter\n") |
---|
191 | printf("\n") |
---|
192 | } |
---|
193 | }' |
---|
194 | |
---|
195 | """there is more in shutter.mac""" |
---|
196 | |
---|
197 | #============================================================================== |
---|
198 | |
---|
199 | def _ascan '' |
---|
200 | |
---|
201 | kohzuMove_PV = "32ida:KohzuPutBO" |
---|
202 | Und_Delay = 0.1 |
---|
203 | |
---|
204 | def kohzuE_cmd(mne,key,p1) '{ |
---|
205 | if (key == "set_position") { |
---|
206 | return |
---|
207 | } |
---|
208 | }' |
---|
209 | |
---|
210 | def show_und' |
---|
211 | printf("\n%40.40s","Current Undulator Status") |
---|
212 | ' |
---|
213 | |
---|
214 | # cleanup macro for ^C usage |
---|
215 | rdef _cleanup3 \'resetUSAXS\' |
---|
216 | rdef _cleanup3 \'\' |
---|
217 | cdef("Fheader", fheader, "UCOL", 0x20) |
---|
218 | rdef Flabel \'""\' |
---|
219 | |
---|
220 | #============================================================================== |
---|
221 | |
---|
222 | global kohzu_PV kohzuMV_PV UND_PV Und_Off UNDE_TRACK_ON |
---|
223 | global kohzuStop_PV kohzuMode_PV kohzuMove_PV |
---|
224 | global CCD_PREFIX # EPICS PV for CCD server |
---|
225 | global CCD_OVERHEAD_SECS # readout time |
---|
226 | global CCD_OVERHEAD_SECS_MEASURED # measured readout time |
---|
227 | |
---|
228 | global @A_name[] @B_name[] |
---|
229 | unglobal @A_name |
---|
230 | unglobal @B_name |
---|
231 | global CCD_DARK_NUM CCDDARK CCD_THROW |
---|
232 | global MULTI_IMGS # useful 8-ID's imm fileformat; currently not used |
---|
233 | |
---|
234 | constant TWO_PI 6.283 |
---|
235 | local _newspaper |
---|
236 | |
---|
237 | #============================================================================== |
---|
238 | |
---|
239 | """ |
---|
240 | TODO: need some good test cases for arrays. |
---|
241 | But this is not the highest priority. |
---|
242 | |
---|
243 | [[extern] shared] [type] array var[cols] |
---|
244 | Declares a one-dimensional data array. |
---|
245 | |
---|
246 | [[extern] shared] [type] array var[rows][cols] |
---|
247 | Declares a two-dimensional data array. |
---|
248 | """ |
---|
249 | |
---|
250 | """End of $Id: test-battery.mac 942 2012-06-18 23:19:12Z jemian $""" |
---|