source: fact/tools/pyscripts/examples/result_collection/can.pkl

Last change on this file was 13113, checked in by neise, 13 years ago
initial commit of first thoughts about how to collect anaysis results
File size: 4.9 KB
Line 
1(dp0
2S'src'
3p1
4(lp2
5S'#!/usr/bin/python -i\nimport sys\nimport pickle\nimport random\nconfirm_next_step = True\n\n# this little can will hold \n# * all the settings, \n# * all results and intermediate results\n# * as well as this script itself\n# and then it will be written, to an output file\ncan = {} # the FACT can \ncan[\'settings\'] = {} # a subspace for holdind all settings\ncan[\'results\'] = {} # a subspace for holding all results... or similar stuff\ncan[\'logbook\'] = [] # a list of statements ... human readable logbook\ncan[\'src\'] = [] # this script and other sources\n\n# store this scipt in the list of sources.\ncan[\'src\'].append( open(sys.argv[0], \'r\').read() )\n\n# declare filenames to work with:\ncan[\'settings\'][\'data_file_names\'] = [\'/media/daten_platte/FACT/data/20120229_144.fits.gz\']\ncan[\'settings\'][\'calib_file_names\'] = [\'/media/daten_platte/FACT/data/20120229_132.drs.fits.gz\']\n# we even tell the can, where we are going to store it\ncan[\'settings\'][\'outfile_name\'] = \'./can.pkl\' # <-- no list ... simple string\n\n\n# put the settings for all the extractors and similar data processors \n# into the settings\ncan[\'settings\'][\'SlidingAverage\'] = [8]\ncan[\'settings\'][\'DRSSpikes\'] = []\ncan[\'settings\'][\'GlobalMaxFinder\'] = [40,200]\ncan[\'settings\'][\'AmplitudeCleaner\'] = [45,18,\'return_bool_mask=False\']\n\n# prepare some space in the can, for the results of this script\ncan[\'results\'][\'areas\'] = []\ncan[\'results\'][\'sizes\'] = []\n# and make some shortcuts\nareas = can[\'results\'][\'areas\']\nsizes = can[\'results\'][\'sizes\']\n\n# this loop will loop over all events, out of all data files in the can,\n# so the analysis loop doesn\'t even know, there are more files involved.\n# of course in the logbook the opening and closing will be stored\nfor data in range(100):\n if True:\n\n size = 0\n for i in range(data):\n size += data\n \n area = random.randint(0,data)\n if area > 4:\n areas.append( area )\n sizes.append( size )\n # we suddenly realize, that we would like to store\n # the event IDs of events, which are have no survivors\n # we should scroll up ... before the loop and declare an empty list\n # like: can[\'results\'][\'no_survivor_ids\'] = []\n # but imagine we are writing a function, which is beeing called inside the loop\n # and this function has no possibility to declare that ...\n # well then this function can still put new things inside the can!\n else:\n if \'no_survivor_ids\' not in can[\'results\']:\n can[\'results\'][\'no_survivor_ids\'] = [data]\n else:\n can[\'results\'][\'no_survivor_ids\'].append(data)\n \n if confirm_next_step:\n user_input = raw_input("\'q\'-quit, \'r\'-run, anything else goes one step")\n number=None\n try:\n number=int(user_input)\n except:\n number=None\n if user_input.find(\'q\') != -1:\n sys.exit(0)\n elif user_input.find(\'r\') != -1:\n confirm_next_step = False\n elif number!=None:\n run += number\n\n# Now our analysis is done and we save the can\noutput = open(can[\'settings\'][\'outfile_name\'], \'wb\')\npickle.dump(can, output)\noutput.close()'
6p3
7asS'logbook'
8p4
9(lp5
10sS'results'
11p6
12(dp7
13S'sizes'
14p8
15(lp9
16I64
17aI121
18aI196
19aI225
20aI256
21aI289
22aI361
23aI400
24aI441
25aI484
26aI625
27aI676
28aI729
29aI784
30aI841
31aI900
32aI961
33aI1024
34aI1089
35aI1156
36aI1225
37aI1296
38aI1369
39aI1444
40aI1521
41aI1600
42aI1681
43aI1849
44aI1936
45aI2025
46aI2116
47aI2209
48aI2304
49aI2401
50aI2704
51aI2809
52aI2916
53aI3025
54aI3136
55aI3364
56aI3481
57aI3600
58aI3721
59aI3844
60aI3969
61aI4096
62aI4225
63aI4356
64aI4489
65aI4624
66aI4761
67aI4900
68aI5041
69aI5184
70aI5329
71aI5476
72aI5625
73aI5776
74aI5929
75aI6084
76aI6241
77aI6400
78aI6561
79aI6889
80aI7056
81aI7225
82aI7396
83aI7569
84aI7744
85aI7921
86aI8100
87aI8281
88aI8464
89aI8649
90aI8836
91aI9025
92aI9216
93aI9409
94aI9604
95aI9801
96asS'no_survivor_ids'
97p10
98(lp11
99I0
100aI1
101aI2
102aI3
103aI4
104aI5
105aI6
106aI7
107aI9
108aI10
109aI12
110aI13
111aI18
112aI23
113aI24
114aI42
115aI50
116aI51
117aI57
118aI82
119asS'areas'
120p12
121(lp13
122I5
123aI10
124aI10
125aI13
126aI15
127aI6
128aI10
129aI20
130aI13
131aI5
132aI22
133aI20
134aI21
135aI18
136aI14
137aI29
138aI25
139aI21
140aI13
141aI10
142aI12
143aI16
144aI10
145aI28
146aI32
147aI36
148aI12
149aI9
150aI23
151aI43
152aI7
153aI35
154aI42
155aI30
156aI49
157aI26
158aI16
159aI42
160aI10
161aI32
162aI17
163aI13
164aI40
165aI49
166aI24
167aI29
168aI61
169aI65
170aI14
171aI7
172aI37
173aI53
174aI24
175aI57
176aI20
177aI30
178aI19
179aI67
180aI21
181aI75
182aI57
183aI77
184aI35
185aI76
186aI66
187aI55
188aI11
189aI15
190aI73
191aI47
192aI15
193aI81
194aI12
195aI11
196aI16
197aI53
198aI28
199aI86
200aI68
201aI39
202assS'settings'
203p14
204(dp15
205S'AmplitudeCleaner'
206p16
207(lp17
208I45
209aI18
210aS'return_bool_mask=False'
211p18
212asS'outfile_name'
213p19
214S'./can.pkl'
215p20
216sS'data_file_names'
217p21
218(lp22
219S'/media/daten_platte/FACT/data/20120229_144.fits.gz'
220p23
221asS'SlidingAverage'
222p24
223(lp25
224I8
225asS'calib_file_names'
226p26
227(lp27
228S'/media/daten_platte/FACT/data/20120229_132.drs.fits.gz'
229p28
230asS'DRSSpikes'
231p29
232(lp30
233sS'GlobalMaxFinder'
234p31
235(lp32
236I40
237aI200
238ass.
Note: See TracBrowser for help on using the repository browser.