PEARL Procedures Igor procedures for the analysis of PEARL data

- Main Page
- Related Pages
- Packages
- Namespaces
- Files

- File List
- Globals

pearl-arpes-scans.ipf
Go to the documentation of this file.
1 #pragma rtGlobals=3// Use modern global access method and strict wave access.
2 #pragma IgorVersion = 6.1
3 #pragma ModuleName = PearlArpesScans
4 #pragma version = 1.01
5 #include "mm-physconst"
6 #include "pearl-optics-theory"
7 #include "pearl-epics", version >= 1.01
8
9 // EPICS scans of Scienta
10 // matthias muntwiler, 2013-03-15
11 // $Id: pearl-optics-scans.ipf 129 2013-06-26 15:53:13Z muntwiler_m $
12
13 static const string basename = "X03DA-SCIENTA:";
14 static const string camname = "cam1:";
15 static const string hdfname = "HDF1:";
16 static const string imgname = "image1:";
17 static const string statsname = "Stats1:";
18
19 variable scienta_connect(){
20
21 dfref savedf = GetDataFolderDFR()
22 print "connecting EPICS channels..."
23
24 // channel lists
25 string controls = ""
26 controls += basename + camname + "PASS_ENERGY;"
27 controls += basename + camname + "LOW_ENERGY;"
28 controls += basename + camname + "CENTRE_ENERGY;"
29 controls += basename + camname + "HIGH_ENERGY;"
30 controls += basename + camname + "LENS_MODE;"
31 controls += basename + camname + "ACQ_MODE;"
32 controls += basename + camname + "ENERGY_MODE;"
33 controls += basename + camname + "DETECTOR_MODE;"
34 controls += basename + camname + "ELEMENT_SET;"
35 controls += basename + camname + "STEP_SIZE;"
36 controls += basename + camname + "SLICES;"
37 controls += basename + camname + "NumExposures;"
38 controls += basename + camname + "FRAMES;"
39 controls += basename + camname + "STEP_TIME;"
40
41 string monitors = ""
42 monitors += basename + camname + "PASS_ENERGY_RBV;"
43 monitors += basename + camname + "LOW_ENERGY_RBV;"
44 monitors += basename + camname + "CENTRE_ENERGY_RBV;"
45 monitors += basename + camname + "HIGH_ENERGY_RBV;"
46 monitors += basename + camname + "ENERGY_WIDTH_RBV;"
47 monitors += basename + camname + "LENS_MODE_RBV;"
48 monitors += basename + camname + "ACQ_MODE_RBV;"
49 monitors += basename + camname + "ENERGY_MODE_RBV;"
50 monitors += basename + camname + "DETECTOR_MODE_RBV;"
51 monitors += basename + camname + "ELEMENT_SET_RBV;"
52 monitors += basename + camname + "STEP_SIZE_RBV;"
53 monitors += basename + camname + "SLICES_RBV;"
54 monitors += basename + camname + "NumExposures_RBV;"
55 monitors += basename + camname + "CURRENT_CHANNEL_RBV;"
56 monitors += basename + camname + "TOTAL_POINTS_RBV;"
57 monitors += basename + camname + "PROGRESS_RBV;"
58 //monitors += basename + camname + "INT_SPECTRUM;"
59 monitors += basename + camname + "BinX_RBV;"
60 monitors += basename + camname + "BinY_RBV;"
61 monitors += basename + camname + "MinX_RBV;"
62 monitors += basename + camname + "MinY_RBV;"
63 monitors += basename + camname + "SizeX_RBV;"
64 monitors += basename + camname + "SizeY_RBV;"
65 monitors += basename + camname + "ReverseX_RBV;"
66 monitors += basename + camname + "ReverseY_RBV;"
67
68 // variable name list corresponding to channel lists
69 string variables = ""
70 variables = AddListItem("ArrayData", variables, ";", ItemsInList(variables))
71
72 // connect EPICS channels
73 epics_connect(controls, monitors)
74
75
76 print "...done"
77 setdatafolder savedf
78
79 };
80
81 variable pearl_set_attr_ch(string attr_wave_name, string attr_channel_name){
82 string attr_wave_name
83 string attr_channel_name
84
85 variable result
86 variable chid
87 pvOpen chid, attr_channel_name
88
89 switch(wavetype($attr_wave_name, 1))
90 case 1:// numeric
91 wave w_attr = $attr_wave_name
92 pvPutNumber /Q chid, w_attr[0]
93 result = 0
94 break
95 case 2:// text
96 wave /t wt_attr = $attr_wave_name
97 pvPutString /Q chid, wt_attr[0]
98 result = 0
99 break
100 default:// error
101 result = -1
102 endswitch
103
104 pvClose chid
105
106 return result
107 };
108
109 variable pearl_set_sscan(variable scan_rec_num){
110 variable scan_rec_num
111
112 string chan_base = "X03DA-PC:scan" + num2str(scan_rec_num) + ":"
113 string wave_base = "Scan" + num2str(scan_rec_num)
114
115 variable nfields
116 variable ifield
117 string wave_name
118 string chan_name
119 wave /z w_active = $(wave_base + "Active")
120 if (WaveExists(w_active))
121 if (w_active[0] != 0)
122 nfields = 4
123 for (ifield = 1; ifield <= nfields; ifield += 1)
124 sscanf wave_name, "%sPositioner%u", ifield
125 sscanf chan_name, "%sP%uPV", chan_base, ifield
126 pearl_set_attr_ch(wave_name, chan_name)
127 sscanf wave_name, "%sReadback%u", ifield
128 sscanf chan_name, "%sR%uPV", chan_base, ifield
129 pearl_set_attr_ch(wave_name, chan_name)
130 sscanf wave_name, "%sTrigger%u", ifield
131 sscanf chan_name, "%sT%uPV", chan_base, ifield
132 pearl_set_attr_ch(wave_name, chan_name)
133 endfor
134 nfields = 20
135 for (ifield = 1; ifield <= nfields; ifield += 1)
136 sscanf wave_name, "%sDetector%u", ifield
137 sscanf chan_name, "%sD%uPV", chan_base, ifield
138 pearl_set_attr_ch(wave_name, chan_name)
139 endfor
140 endif
141 endif
142 };
143
144 variable pearl_repeat_scan(){
145 // set up a scan according to the attributes of the given dataset
146 dfref savedf = GetDataFolderDFR()
147
148 setdatafolder :attr
149
150
151 setdatafolder savedf
152 };
153
pearl_set_sscan
variable pearl_set_sscan(variable scan_rec_num)
Definition: pearl-arpes-scans.ipf:109
epics_connect
static variable epics_connect()
connect the angle scan tracker to EPICS
Definition: pearl-anglescan-tracker.ipf:675
version
version
Definition: pearl-arpes-scans.ipf:7
statsname
static const string statsname
Definition: pearl-arpes-scans.ipf:17
pearl_set_attr_ch
variable pearl_set_attr_ch(string attr_wave_name, string attr_channel_name)
Definition: pearl-arpes-scans.ipf:81
imgname
static const string imgname
Definition: pearl-arpes-scans.ipf:16
camname
static const string camname
Definition: pearl-arpes-scans.ipf:14
scienta_connect
variable scienta_connect()
Definition: pearl-arpes-scans.ipf:19
hdfname
static const string hdfname
Definition: pearl-arpes-scans.ipf:15
pearl_repeat_scan
variable pearl_repeat_scan()
Definition: pearl-arpes-scans.ipf:144