Changeset 14099
- Timestamp:
- 06/07/12 10:53:41 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/doc/getting_started.rst
r14097 r14099 179 179 =============== 180 180 181 one may interactively play with the two most important classes *RawData* and 182 *SlowData* from module pyfact... 183 181 184 *datafilepath* and *calibfilepath* should be adjusted in case you are not working 182 185 on the ISDC cluster. … … 184 187 explore class RawData:: 185 188 186 import pyfact 187 datafilepath = '/data00/fact-construction/raw/2012/03/04/20120304_018.fits.gz' 188 calibfilepath = '/data00/fact-construction/raw/2012/03/04/20120304_012.drs.fits.gz' 189 run = pyfact.RawData( datafilepath, calibfilepath, return_dict = True) 189 from pyfact import RawData 190 # or from pyfact import * 191 192 datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz' 193 calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz' 194 run = RawData(datafilepath, calibfilepath) 190 195 event = run.next() 191 196 … … 198 203 print 70*'*' 199 204 205 for historical reasons, an event contains *data* and *acal_data*, where *acal_data* 206 would be the DRS amplitude calibrated data, and *data* would be uncalibrated. 207 But since the calibration was moved into a C++ class, for better performance, 208 these keys now contains the same data. 209 200 210 loop over RawData:: 201 211 202 import pyfact 203 datafilepath = '/data00/fact-construction/raw/2012/03/04/20120304_018.fits.gz' 204 calibfilepath = '/data00/fact-construction/raw/2012/03/04/20120304_012.drs.fits.gz' 205 run = pyfact.RawData( datafilepath, calibfilepath, return_dict = True) 206 212 from pyfact import RawData 213 # or from pyfact import * 214 215 datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz' 216 calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz' 217 run = RawData(datafilepath, calibfilepath) 218 207 219 for event in run: 208 220 print 'event_id:', event['event_id'] 209 # the data can be found in event['acal_data'] 221 # the data can be found in event['data'] 222 223 have a look at some SlowData:: 224 225 :~$ cd /fact/aux/2012/05/30 226 :/fact/aux/2012/05/30$ python 227 228 from pyfact import SlowData 229 file = SlowData('20120530.FTM_CONTROL_TRIGGER_RATES.fits') 230 file.show() 231 232 233 have a look at the *columns*, that are available:: 234 235 'columns': {'BoardRate': (40L, 4L, 'E', 'Hz'), 236 'ElapsedTime': (1L, 4L, 'E', 'sec'), 237 'FTMtimeStamp': (1L, 8L, 'K', 'us'), 238 'OnTime': (1L, 4L, 'E', 'sec'), 239 'OnTimeCounter': (1L, 8L, 'K', 'us'), 240 'PatchRate': (160L, 4L, 'E', 'Hz'), 241 'QoS': (1L, 4L, 'J', ''), 242 'Time': (1L, 8L, 'D', 'MJD'), 243 'TriggerCounter': (1L, 4L, 'J', 'int'), 244 'TriggerRate': (1L, 4L, 'E', 'Hz')}, 245 246 choose the *columns* you would like to retrieve from the file:: 247 248 file.register('TriggerRate') 249 file.register('Time') 250 # or in case you are unsure 251 file.register('all') 252 253 check, what happened. file has got some new members:: 254 255 file.show() 256 257 but they are all zero. Now one should call *next()* in order to get 258 the file contents row by row:: 259 260 file.next() 261 file.show() 262 263 or loop over the file:: 264 265 counter = 0 266 for row in file:: 267 if counter > 10: 268 break 269 270 print row.Time, row. OnTime 271 counter += 1 272 210 273 211 274 .. rubric:: Footnotes
Note:
See TracChangeset
for help on using the changeset viewer.