======== Examples ======== RawData ======== one may interactively play with the two most important classes *RawData* and *SlowData* from module pyfact... *datafilepath* and *calibfilepath* should be adjusted in case you are not working on the ISDC cluster. explore class RawData:: from pyfact import RawData # or from pyfact import * datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz' calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz' run = RawData(datafilepath, calibfilepath) event = run.next() type(event) print 70*'*' for key in event: print 'key :', key print 'value:', event[key] print 70*'*' for historical reasons, an event contains *data* and *acal_data*, where *acal_data* would be the DRS amplitude calibrated data, and *data* would be uncalibrated. But since the calibration was moved into a C++ class, for better performance, these keys now contains the same data. loop over RawData:: from pyfact import RawData # or from pyfact import * datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz' calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz' run = RawData(datafilepath, calibfilepath) for event in run: print 'event_id:', event['event_id'] # the data can be found in event['data'] SlowData ========= have a look at some SlowData:: :~$ cd /fact/aux/2012/05/30 :/fact/aux/2012/05/30$ python from pyfact import SlowData file = SlowData('20120530.FTM_CONTROL_TRIGGER_RATES.fits') file.show() have a look at the *columns*, that are available:: 'columns': {'BoardRate': (40L, 4L, 'E', 'Hz'), 'ElapsedTime': (1L, 4L, 'E', 'sec'), 'FTMtimeStamp': (1L, 8L, 'K', 'us'), 'OnTime': (1L, 4L, 'E', 'sec'), 'OnTimeCounter': (1L, 8L, 'K', 'us'), 'PatchRate': (160L, 4L, 'E', 'Hz'), 'QoS': (1L, 4L, 'J', ''), 'Time': (1L, 8L, 'D', 'MJD'), 'TriggerCounter': (1L, 4L, 'J', 'int'), 'TriggerRate': (1L, 4L, 'E', 'Hz')}, choose the *columns* you would like to retrieve from the file:: file.register('TriggerRate') file.register('Time') # or in case you are unsure file.register('all') check, what happened. file has got some new members:: file.show() but they are all zero. Now one should call *next()* in order to get the file contents row by row:: file.next() file.show() or loop over the file:: for row in file: print row.Time, row. OnTime *row* is just be a copy of *file*, but inside the for loop, I think it is convenient to access members of *row* rather than members of *file*. I is just easier to understand for the reader, I think. calling a system command ======================== Using the os module any command executable on the command line can be called within a script. This is in particular true for your own python scripts:: import os os.system('echo long listing of dir; pwd; ls -l') or suppose you created a script my_script.py:: from os import system system('python my_scrip.py')