-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtract.nb
286 lines (266 loc) · 10.2 KB
/
Extract.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 11.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 9965, 278]
NotebookOptionsPosition[ 8449, 248]
NotebookOutlinePosition[ 8827, 264]
CellTagsIndexPosition[ 8784, 261]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["Raw Data Extraction", "Subsection",
CellChangeTimes->{{3.7316511128959365`*^9,
3.7316511170931683`*^9}},ExpressionUUID->"e82512db-63fd-437d-9e9e-\
ec178bd34185"],
Cell["\<\
This file is used to extract the raw data in the form of .Spe file produced \
by the computer that connects the detector.\
\>", "Text",
CellChangeTimes->{{3.731651092139855*^9, 3.7316510939677296`*^9}, {
3.731651147355961*^9,
3.731651207622755*^9}},ExpressionUUID->"00fbf9a4-80cc-442f-aa4a-\
07845bcd6d7c"],
Cell["\<\
Copyright \[Copyright] 2018 Changkai Zhang
Contact: [email protected]
Licensed under GPL 3.0\
\>", "Text",
CellChangeTimes->{{3.7316512313059464`*^9, 3.7316512693978095`*^9}, {
3.7316513358822455`*^9,
3.731651413927269*^9}},ExpressionUUID->"a260c494-23a3-4d17-837e-\
c2729801f447"],
Cell[TextData[{
"Raw data are stored in a series of .Spe files in the raw data directory \
named under \
\[OpenCurlyDoubleQuote]Angle-\[Theta].Spe\[CloseCurlyDoubleQuote], where \
\[Theta] is the angle of the detector when collecting this dataset. Raw data \
are stored in a plain text format, and are now read into a list named ",
StyleBox["RawDataSetAngle[\[Theta]]",
FontWeight->"Bold"],
" as follows."
}], "Text",
CellChangeTimes->{{3.731651451890786*^9, 3.7316515281710157`*^9}, {
3.7316515743513827`*^9, 3.731651664980683*^9}, {3.7316517057109833`*^9,
3.731651721670298*^9}},ExpressionUUID->"b16cde93-2767-4094-848b-\
c2230662cfef"],
Cell[BoxData[
RowBox[{
RowBox[{"Do", "[",
RowBox[{
RowBox[{
RowBox[{"RawDataSetAngle", "[", "angle", "]"}], "=",
RowBox[{"ReadList", "[",
RowBox[{
RowBox[{"StringReplace", "[",
RowBox[{
RowBox[{
RowBox[{"NotebookDirectory", "[", "]"}], "<>",
"\"\</Raw Data/Angle-rp.Spe\>\""}], ",", " ",
RowBox[{"\"\<rp\>\"", "\[Rule]",
RowBox[{"ToString", "[", "angle", "]"}]}]}], "]"}], ",", " ",
"String"}], "]"}]}], ",",
RowBox[{"{",
RowBox[{"angle", ",",
RowBox[{"{",
RowBox[{
"0", ",", "5", ",", "15", ",", "30", ",", "35", ",", "45", ",", "55",
",", "60", ",", "70", ",", "85", ",", "95", ",", "105", ",", "115"}],
"}"}]}], "}"}]}], "]"}], ";"}]], "Input",
CellChangeTimes->{{3.7314077227410603`*^9, 3.73140776916906*^9}, {
3.73140785704006*^9, 3.7314078987930603`*^9}, {3.7314079862010603`*^9,
3.73140801696906*^9}, {3.7314081736280603`*^9, 3.7314082301780605`*^9}, {
3.7314083706730604`*^9, 3.7314083747130604`*^9}, {3.73140842961706*^9,
3.7314084789370604`*^9}, 3.73140890250506*^9, {3.731596695410649*^9,
3.7315966959987764`*^9}, {3.7315967707732973`*^9,
3.7315967907559557`*^9}},ExpressionUUID->"2116326e-f3b9-43a4-b32a-\
1d53b4de349a"],
Cell[TextData[{
"The .Spe file records the number of particles detected in each channel \
starting the 13th line. Only the peak corresponds to the ",
Cell[BoxData[
FormBox[
RowBox[{"662", "keV"}], TraditionalForm]],
FormatType->"TraditionalForm",ExpressionUUID->
"26807381-fb9b-4760-844f-b5d301c18485"],
" peak at ",
Cell[BoxData[
FormBox[
RowBox[{"0", "\[Degree]"}], TraditionalForm]],
FormatType->"TraditionalForm",ExpressionUUID->
"04ee809c-faea-4e66-82eb-5b7f7a3cf09c"],
" is useful. This position of this peak (recognized as the label of channel) \
is identified manually as follows. For each angle, ",
StyleBox["PeakPosAng[\[Theta]]",
FontWeight->"Bold"],
" stores the start and the end channel number of the peak."
}], "Text",
CellChangeTimes->{{3.7316517663754*^9, 3.731651842365759*^9}, {
3.731651921015671*^9, 3.7316519642006297`*^9}, {3.7316520096473722`*^9,
3.731652037386379*^9}, {3.731652103194535*^9,
3.731652156901922*^9}},ExpressionUUID->"468ca13c-c9e9-4a9c-936f-\
39c20a3f8bf9"],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "0", "]"}], "=",
RowBox[{"{",
RowBox[{"412", ",", "476"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "5", "]"}], "=",
RowBox[{"{",
RowBox[{"400", ",", "460"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "15", "]"}], "=",
RowBox[{"{",
RowBox[{"375", ",", "446"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "30", "]"}], "=",
RowBox[{"{",
RowBox[{"340", ",", "434"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "35", "]"}], "=",
RowBox[{"{",
RowBox[{"298", ",", "411"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "45", "]"}], "=",
RowBox[{"{",
RowBox[{"268", ",", "335"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "55", "]"}], "=",
RowBox[{"{",
RowBox[{"234", ",", "310"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "60", "]"}], "=",
RowBox[{"{",
RowBox[{"229", ",", "280"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "70", "]"}], "=",
RowBox[{"{",
RowBox[{"194", ",", "254"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "85", "]"}], "=",
RowBox[{"{",
RowBox[{"173", ",", "217"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "95", "]"}], "=",
RowBox[{"{",
RowBox[{"153", ",", "197"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "105", "]"}], "=",
RowBox[{"{",
RowBox[{"149", ",", "188"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"PeakPosAng", "[", "115", "]"}], "=",
RowBox[{"{",
RowBox[{"134", ",", "171"}], "}"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.7314088509640603`*^9,
3.73140912736106*^9}},ExpressionUUID->"84ce0173-a724-492a-b335-\
04f071ea229c"],
Cell["\<\
Check the global namespace, there should contain variable RawDataSetAngle and \
PeakPosAng.\
\>", "Text",
CellChangeTimes->{{3.731652170486783*^9,
3.731652211687149*^9}},ExpressionUUID->"609132bd-e5b7-4948-b432-\
fc35fd9852b0"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Names", "[", "\"\<Global`*\>\"", "]"}]], "Input",
CellChangeTimes->{{3.7314093163660603`*^9,
3.73140933471206*^9}},ExpressionUUID->"83ea26f9-5e57-40a1-96e4-\
cc6ee9f3f92c"],
Cell[BoxData[
FormBox[
RowBox[{"{",
RowBox[{"\<\"angle\"\>", ",", "\<\"PeakPosAng\"\>",
",", "\<\"RawDataSetAngle\"\>", ",", "\<\"$UseTextSearchQ\"\>"}], "}"}],
TraditionalForm]], "Output",
CellChangeTimes->{3.7314093357250605`*^9,
3.731596922481656*^9},ExpressionUUID->"dd27cd40-576b-4fb9-8977-\
9d1215946673"]
}, Open ]],
Cell[TextData[{
"Export these raw data into a file ",
StyleBox["RawData.mx",
FontWeight->"Bold"],
" at the same directory."
}], "Text",
CellChangeTimes->{{3.7316522202756352`*^9,
3.7316522536150985`*^9}},ExpressionUUID->"34378079-5509-40a1-93fe-\
cd22461f0386"],
Cell[BoxData[
RowBox[{
RowBox[{"DumpSave", "[",
RowBox[{
RowBox[{
RowBox[{"NotebookDirectory", "[", "]"}], "<>", "\"\</RawData.mx\>\""}],
",", "\"\<Global`\>\""}], "]"}], ";"}]], "Input",
CellChangeTimes->{{3.73140935984906*^9, 3.7314093952800603`*^9}, {
3.731596832454507*^9,
3.7315968409671926`*^9}},ExpressionUUID->"28a61394-7aa8-40bd-9f77-\
19d38d2bd937"],
Cell["\<\
This is the end of file Extract.nb. Current version: release-0.0.1.0. Started \
March 28, 2018. Finished March 30, 2018. Last Revised April 2, 2018.\
\>", "Text",
CellChangeTimes->{{3.7316522802798157`*^9, 3.73165235587716*^9}, {
3.7316523880360765`*^9,
3.7316524280672216`*^9}},ExpressionUUID->"55453450-8087-482f-9836-\
b1ce45f90b1e"]
}, Open ]]
},
WindowSize->{759, 835},
WindowMargins->{{Automatic, 533}, {59, Automatic}},
Magnification:>1.3 Inherited,
FrontEndVersion->"11.2 for Microsoft Windows (64-bit) (September 10, 2017)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[580, 22, 171, 3, 69, "Subsection",ExpressionUUID->"e82512db-63fd-437d-9e9e-ec178bd34185"],
Cell[754, 27, 322, 7, 73, "Text",ExpressionUUID->"00fbf9a4-80cc-442f-aa4a-07845bcd6d7c"],
Cell[1079, 36, 313, 8, 102, "Text",ExpressionUUID->"a260c494-23a3-4d17-837e-c2729801f447"],
Cell[1395, 46, 649, 13, 131, "Text",ExpressionUUID->"b16cde93-2767-4094-848b-c2230662cfef"],
Cell[2047, 61, 1309, 30, 138, "Input",ExpressionUUID->"2116326e-f3b9-43a4-b32a-1d53b4de349a"],
Cell[3359, 93, 1032, 24, 160, "Text",ExpressionUUID->"468ca13c-c9e9-4a9c-936f-39c20a3f8bf9"],
Cell[4394, 119, 2208, 68, 338, "Input",ExpressionUUID->"84ce0173-a724-492a-b335-04f071ea229c"],
Cell[6605, 189, 241, 6, 73, "Text",ExpressionUUID->"609132bd-e5b7-4948-b432-fc35fd9852b0"],
Cell[CellGroupData[{
Cell[6871, 199, 200, 4, 37, "Input",ExpressionUUID->"83ea26f9-5e57-40a1-96e4-cc6ee9f3f92c"],
Cell[7074, 205, 330, 8, 42, "Output",ExpressionUUID->"dd27cd40-576b-4fb9-8977-9d1215946673"]
}, Open ]],
Cell[7419, 216, 270, 8, 44, "Text",ExpressionUUID->"34378079-5509-40a1-93fe-cd22461f0386"],
Cell[7692, 226, 386, 10, 37, "Input",ExpressionUUID->"28a61394-7aa8-40bd-9f77-19d38d2bd937"],
Cell[8081, 238, 352, 7, 73, "Text",ExpressionUUID->"55453450-8087-482f-9836-b1ce45f90b1e"]
}, Open ]]
}
]
*)