source: specdomain/trunk/src/specdomain/macros/test-battery.mac @ 1006

Last change on this file since 1006 was 1006, checked in by jemian, 10 years ago

another case

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision URL Header
File size: 7.8 KB
Line 
1"""
2###############################################################################
3       User macros to configure spec with the Image Server program
4###############################################################################
5
6* $Id: test-battery.mac 1006 2012-07-12 15:34:33Z jemian $
7* sample file to test sphinx documentation of SPEC macro files
8
9This file contains SPEC macro fragments to test various
10parts of the SPHINX documentation builder.
11"""
12
13def ccdhelp '
14    printf("\nUser macros for the BCDA ccd package\n")
15    printf("\t%c%sccdsetup\n",27,"[1m")
16    # ...
17'
18
19local A2Rp0
20      A2Rp0 = 15.759                    ;#  A2Rp center
21
22
23#==============================================================================
24"""
25common/shutter
26==============
27 
28NAME
29   shutter.mac
30 
31SUMMARY
32   Commands to control a fast photon shutter.
33 
34DESCRIPTION
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 
45AUTHOR
46   Christian M. Schlepuetz (CS, cschlep)
47 
48CREATION DATE
49   2004/11/06
50 
51COPYRIGHT
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 
67VERSION::
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 
74DEPENDENCIES
75   Chained macro definitions affected by this macro:
76   
77   - user_precount
78   - user_getcounts
79   - cleanup_always
80 
81HISTORY
82   2004/11/06 (CS):
83   
84           - modified the first original version to comply with naming and format
85             conventions
86           - implemented help-file support and wrote help texts.
87             2010/03/30 (CS):
88           - added the following global variables to make macro more easily portable::
89         
90                    SHUTTER_CONTROL_PV      # EPICS PV name for the shutter control (bo)
91                    SHUTTER_CONTROL_OPEN    # EPICS control value for open shutter
92                    SHUTTER_CONTROL_CLOSED  # EPICS control value for closed shutter
93                    SHUTTER_STATUS_PV       # EPICE PV name for the shutter status (bi)
94                    SHUTTER_STATUS_OPEN     # EPICS status value for open shutter
95                    SHUTTER_STATUS_CLOSED   # EPICS status value for closed shutter
96                    SHUTTER_IS_ON           # flag for automatic shutter control
97                    SHUTTER_SLEEP_TIME      # SPEC sleep time after opening shutter
98 
99   2010/07/23 (CS):
100           - added SVN keywords (replacing CVS keywords)
101 
102   2011/12/19 (CS):
103           - reformatted code documentation to work with ROBODoc
104           - added shutter_setup with following internal macros:
105         
106             * _shutter_print_setup
107             * _shutter_set_option
108             * _clear_screen
109         
110           - replaced SHUTTER_STATUS* with SHUTTER_MONITOR*
111           - replaced global variables _OPEN with _OPEN_VAL and
112             _CLOSED with _CLOSED_VAL
113"""
114#==============================================================================
115
116#==============================================================================
117# Define some global variables
118# ----------------------------
119
120    global SHUTTER_MAC
121           SHUTTER_MAC = DOFILE
122
123    # EPICS PV of the binary output which controls the shutter
124   
125    global SHUTTER_CONTROL_PV
126           SHUTTER_CONTROL_PV = "X04SA-ES3-SC:FPS"
127
128    global SHUTTER_CONTROL_OPEN_VAL
129           SHUTTER_CONTROL_OPEN_VAL = "On"
130
131    global SHUTTER_CONTROL_CLOSED_VAL
132           SHUTTER_CONTROL_CLOSED_VAL = "Off"
133
134    # EPICS PV of the binary input which monitors the state of the shutter
135    # if SHUTTER_MONITOR_PV = "", no monitoring is performed
136   
137    global SHUTTER_MONITOR_PV
138           SHUTTER_MONITOR_PV = ""
139
140    global SHUTTER_MONITOR_OPEN_VAL
141           SHUTTER_MONITOR_OPEN_VAL = "open"
142
143    global SHUTTER_MONITOR_CLOSED_VAL
144           SHUTTER_MONITOR_CLOSED_VAL = "closed"
145
146    global SHUTTER_IS_ON
147           SHUTTER_IS_ON = 0
148
149    global SHUTTER_SLEEP_TIME
150           SHUTTER_SLEEP_TIME = 0.1
151
152
153#==============================================================================
154# This macro file contains the following commands:
155#==============================================================================
156
157#------------------------------------------------------------------------------
158
159def shutter_help 'sh_help'
160
161def sh_help '{
162        """
163        sh_help, shutter_help: Displays the shutter help text.
164       
165        usage::
166       
167           > sh_help
168       
169        .. note::
170           The help text is generated by simply displaying the text file
171           ``shutter_mac.txt``, which should reside in the same directory as ``shutter.mac``.
172           If the file does not exist, a generic help text is shown.
173        """
174
175  unix (sprintf ("dirname %s", SHUTTER_MAC), _1)
176  ll = length (_1)
177  if (substr (_1, ll, 1) == "\n") _1 = substr (_1, 1, (ll - 1))
178  file = sprintf ("%s/shutter_mac.txt", _1)
179  if (file_info (file, "-e")) {
180    unix (sprintf ("cat %s", file))
181  } else {
182    printf("\n  Macros available in file shutter.mac:\n")
183    printf(  "                           ===========\n")
184    printf("\n")
185    printf("  sh_help      - creates this help text\n")
186    printf("  shop         - opens the fast shutter\n")
187    printf("\n")
188  }
189}'
190
191""".. note:: there is much more content in ``shutter.mac``"""
192
193#==============================================================================
194
195def _ascan ''
196
197kohzuMove_PV = "32ida:KohzuPutBO"
198Und_Delay = 0.1
199
200def kohzuE_cmd(mne,key,p1) '{
201     if (key == "set_position") {
202      return
203     }
204}'
205
206def show_und'
207   printf("\n%40.40s","Current Undulator Status")
208'
209
210  # cleanup macro for ^C usage
211  rdef _cleanup3 \'resetUSAXS\'
212  rdef _cleanup3 \'\'
213     cdef("Fheader", fheader,  "UCOL", 0x20)
214     rdef Flabel \'""\'
215
216#==============================================================================
217
218global kohzu_PV kohzuMV_PV UND_PV Und_Off UNDE_TRACK_ON
219global       kohzuStop_PV kohzuMode_PV      kohzuMove_PV
220global CCD_PREFIX            #: EPICS PV for CCD server
221global CCD_OVERHEAD_SECS        #: readout time
222global CCD_OVERHEAD_SECS_MEASURED   #: measured readout time
223
224    global @A_name[] @B_name[]
225       unglobal @A_name
226       unglobal @B_name
227global CCD_DARK_NUM CCDDARK CCD_THROW
228global MULTI_IMGS # useful 8-ID's IMM fileformat; currently not used
229
230#: twice the ratio of a circle's circumference to its diameter   
231constant TWO_PI 6.283
232local _newspaper        #: don't expect to see new ones
233
234#==============================================================================
235
236"""
237TODO: need some good test cases for arrays.
238But this is not the highest priority.
239
240[[extern] shared] [type] array var[cols]
241    Declares a one-dimensional data array.
242
243[[extern] shared] [type] array var[rows][cols]
244    Declares a two-dimensional data array.
245"""
246
247#==============================================================================
248
249"""    # This is the start of an extended comment
250
251this is located within an extended comment
252
253"""    # this is a normal comment after the extended comment
254
255
256a = 42.0    #  """ this is not an extended comment"""
257#==============================================================================
258
259
260"""End of $Id: test-battery.mac 1006 2012-07-12 15:34:33Z jemian $"""
Note: See TracBrowser for help on using the repository browser.