Ignore:
Timestamp:
06/08/12 15:31:39 (12 years ago)
Author:
neise
Message:
... working on the docu
Location:
fact/tools/pyscripts/doc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/doc/classes.rst

    r14109 r14119  
    55module pyfact
    66=============
    7 
    8 rawdata access
    9 --------------
    10 .. autoclass:: pyfact.RawData
    11     :members:
    12 
    13 SlowData access
    14 ---------------
    15 .. autoclass:: pyfact.SlowData
    16     :members:
    17 
    18 
    19 fnames of a data run   
    20 --------------------
    21 .. autoclass:: pyfact.fnames
     7.. automodule:: pyfact
    228    :members:
    239
     
    2511=================
    2612.. automodule:: extractor
     13    :members:
     14   
     15Plotting
     16====================
     17.. automodule:: plotters
    2718    :members:
    2819
  • fact/tools/pyscripts/doc/examples.rst

    r13151 r14119  
    22Examples
    33========
     4
     5
     6RawData
     7========
     8
     9one may interactively play with the two most important classes *RawData* and
     10*SlowData* from module pyfact...
     11
     12*datafilepath* and *calibfilepath* should be adjusted in case you are not working
     13on the ISDC cluster.
     14
     15explore class RawData::
     16
     17  from pyfact import RawData
     18  # or from pyfact import *
     19 
     20  datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz'
     21  calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz'
     22  run = RawData(datafilepath, calibfilepath)
     23  event = run.next()
     24 
     25  type(event)
     26 
     27  print 70*'*'
     28  for key in event:
     29    print 'key  :', key
     30    print 'value:', event[key]
     31    print 70*'*'
     32
     33for historical reasons, an event contains *data* and *acal_data*, where *acal_data*
     34would be the DRS amplitude calibrated data, and *data* would be uncalibrated.
     35But since the calibration was moved into a C++ class, for better performance,
     36these keys now contains the same data.
     37
     38loop over RawData::
     39
     40  from pyfact import RawData
     41  # or from pyfact import *
     42 
     43  datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz'
     44  calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz'
     45  run = RawData(datafilepath, calibfilepath)
     46
     47  for event in run:
     48    print 'event_id:', event['event_id']
     49    # the data can be found in event['data']
     50
     51SlowData
     52=========
     53
     54have a look at some SlowData::
     55
     56  :~$ cd /fact/aux/2012/05/30
     57  :/fact/aux/2012/05/30$ python
     58 
     59  from pyfact import SlowData
     60  file = SlowData('20120530.FTM_CONTROL_TRIGGER_RATES.fits')
     61  file.show()
     62 
     63
     64have a look at the *columns*, that are available::
     65
     66  'columns': {'BoardRate': (40L, 4L, 'E', 'Hz'),
     67             'ElapsedTime': (1L, 4L, 'E', 'sec'),
     68             'FTMtimeStamp': (1L, 8L, 'K', 'us'),
     69             'OnTime': (1L, 4L, 'E', 'sec'),
     70             'OnTimeCounter': (1L, 8L, 'K', 'us'),
     71             'PatchRate': (160L, 4L, 'E', 'Hz'),
     72             'QoS': (1L, 4L, 'J', ''),
     73             'Time': (1L, 8L, 'D', 'MJD'),
     74             'TriggerCounter': (1L, 4L, 'J', 'int'),
     75             'TriggerRate': (1L, 4L, 'E', 'Hz')},
     76
     77choose the *columns* you would like to retrieve from the file::
     78
     79  file.register('TriggerRate')
     80  file.register('Time')
     81  # or in case you are unsure
     82  file.register('all')
     83
     84check, what happened. file has got some new members::
     85
     86  file.show()
     87
     88but they are all zero. Now one should call *next()* in order to get
     89the file contents row by row::
     90
     91  file.next()
     92  file.show()
     93
     94or loop over the file::
     95
     96  for row in file:
     97    print row.Time, row. OnTime
     98
     99*row* is just be a copy of *file*, but inside the for loop, I think it is
     100convenient to access members of *row* rather than members of *file*.
     101I is just easier to understand for the reader, I think.
    4102
    5103calling a system command
     
    17115
    18116       
    19 
  • fact/tools/pyscripts/doc/getting_started.rst

    r14106 r14119  
    112112This should work at ISDC only, but if it does not work, please ask somebody for help.
    113113
    114 6. Tiny examples
    115 ===============
    116114
    117 one may interactively play with the two most important classes *RawData* and
    118 *SlowData* from module pyfact...
    119 
    120 *datafilepath* and *calibfilepath* should be adjusted in case you are not working
    121 on the ISDC cluster.
    122 
    123 explore class RawData::
    124 
    125   from pyfact import RawData
    126   # or from pyfact import *
    127  
    128   datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz'
    129   calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz'
    130   run = RawData(datafilepath, calibfilepath)
    131   event = run.next()
    132  
    133   type(event)
    134  
    135   print 70*'*'
    136   for key in event:
    137     print 'key  :', key
    138     print 'value:', event[key]
    139     print 70*'*'
    140 
    141 for historical reasons, an event contains *data* and *acal_data*, where *acal_data*
    142 would be the DRS amplitude calibrated data, and *data* would be uncalibrated.
    143 But since the calibration was moved into a C++ class, for better performance,
    144 these keys now contains the same data.
    145 
    146 loop over RawData::
    147 
    148   from pyfact import RawData
    149   # or from pyfact import *
    150  
    151   datafilepath = '/fact/raw/2012/03/04/20120304_018.fits.gz'
    152   calibfilepath = '/fact/raw/2012/03/04/20120304_012.drs.fits.gz'
    153   run = RawData(datafilepath, calibfilepath)
    154 
    155   for event in run:
    156     print 'event_id:', event['event_id']
    157     # the data can be found in event['data']
    158 
    159 have a look at some SlowData::
    160 
    161   :~$ cd /fact/aux/2012/05/30
    162   :/fact/aux/2012/05/30$ python
    163  
    164   from pyfact import SlowData
    165   file = SlowData('20120530.FTM_CONTROL_TRIGGER_RATES.fits')
    166   file.show()
    167  
    168 
    169 have a look at the *columns*, that are available::
    170 
    171   'columns': {'BoardRate': (40L, 4L, 'E', 'Hz'),
    172              'ElapsedTime': (1L, 4L, 'E', 'sec'),
    173              'FTMtimeStamp': (1L, 8L, 'K', 'us'),
    174              'OnTime': (1L, 4L, 'E', 'sec'),
    175              'OnTimeCounter': (1L, 8L, 'K', 'us'),
    176              'PatchRate': (160L, 4L, 'E', 'Hz'),
    177              'QoS': (1L, 4L, 'J', ''),
    178              'Time': (1L, 8L, 'D', 'MJD'),
    179              'TriggerCounter': (1L, 4L, 'J', 'int'),
    180              'TriggerRate': (1L, 4L, 'E', 'Hz')},
    181 
    182 choose the *columns* you would like to retrieve from the file::
    183 
    184   file.register('TriggerRate')
    185   file.register('Time')
    186   # or in case you are unsure
    187   file.register('all')
    188 
    189 check, what happened. file has got some new members::
    190 
    191   file.show()
    192 
    193 but they are all zero. Now one should call *next()* in order to get
    194 the file contents row by row::
    195 
    196   file.next()
    197   file.show()
    198 
    199 or loop over the file::
    200 
    201   for row in file:
    202     print row.Time, row. OnTime
    203 
    204 *row* is just be a copy of *file*, but inside the for loop, I think it is
    205 convenient to access members of *row* rather than members of *file*.
    206 I is just easier to understand for the reader, I think.
    207 
    208 7. Old way of creating the so files
     1156. Old way of creating the so files
    209116===================================
    210117
Note: See TracChangeset for help on using the changeset viewer.