Changeset 14471
- Timestamp:
- 10/11/12 00:55:59 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/doc/examples.rst
r14470 r14471 115 115 Have a look:: 116 116 117 #!/usr/bin/python -tti118 119 import time120 import numpy as np121 from pyfact import SlowData122 123 f = SlowData('20120601.FTM_STATIC_DATA.fits')124 #125 # do here --> f.show() if you are not sure about the column names126 #127 f.register('PatchThresh')128 f.register('Time')129 f.stack()130 131 # now loop over the file and let SlowData do the magic132 for row in f:133 pass134 135 # the stacked data can be found in the dict SlowData.stacked_cols136 # put the Time array into a variable and convert into seconds since 01.01.1970137 t = f.stacked_cols['Time'] * 24. * 3600138 139 # put the thresholds into another var, for convenience140 dtr = f.stacked_cols['PatchThresh']141 142 # give the user some diagnostic info143 print 'start time:', time.asctime(time.gmtime(t[0]))144 print 'stop time:', time.asctime(time.gmtime(t[-1]))145 146 print 'mean/median threshold:', dtr.mean(), np.median(dtr)147 print 'min/max threshold:', dtr.min(), dtr.max()148 print 'std deviation:', dtr.std()117 #!/usr/bin/python -tti 118 119 import time 120 import numpy as np 121 from pyfact import SlowData 122 123 f = SlowData('20120601.FTM_STATIC_DATA.fits') 124 # 125 # do here --> f.show() if you are not sure about the column names 126 # 127 f.register('PatchThresh') 128 f.register('Time') 129 f.stack() 130 131 # now loop over the file and let SlowData do the magic 132 for row in f: 133 pass 134 135 # the stacked data can be found in the dict SlowData.stacked_cols 136 # put the Time array into a variable and convert into seconds since 01.01.1970 137 t = f.stacked_cols['Time'] * 24. * 3600 138 139 # put the thresholds into another var, for convenience 140 dtr = f.stacked_cols['PatchThresh'] 141 142 # give the user some diagnostic info 143 print 'start time:', time.asctime(time.gmtime(t[0])) 144 print 'stop time:', time.asctime(time.gmtime(t[-1])) 145 146 print 'mean/median threshold:', dtr.mean(), np.median(dtr) 147 print 'min/max threshold:', dtr.min(), dtr.max() 148 print 'std deviation:', dtr.std() 149 149 150 150
Note:
See TracChangeset
for help on using the changeset viewer.