Changeset 13443 for fact/tools/pyscripts/sandbox/dneise/gain
- Timestamp:
- 04/25/12 08:54:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/sandbox/dneise/gain/gain.py
r13442 r13443 34 34 fig.hold(True) 35 35 36 # we try to determine the: 37 # * Position 38 # * and Height (in two versions: filtered, and unfiltered data) 39 # of dark count peaks in: 40 # a) all events 41 # b) all pixel 42 # 43 # we limit ourselfs to 10 peaks per pixel max! 44 # and 1000 events max! 45 # 46 # So in order to store this stuff, we prepare an n-dim-array 47 48 PEAKS_MAX = 10 49 N_INFO = 3 # Position, Height of unfiltered peak, Height of Filtered peak 50 51 # TODO: this operation might under certain circumstances need way to much mem. 52 # I would like to solve this, using try except, and in case of a 'MemoryError' 53 # reduce the number of events. 54 # So I will process the events, in e.g. chunks of 1000 and save the results 55 # The user will then find a certain nuber of ndarray in the output npz file. 56 # But this should not be a major problem. 57 peaks = np.ones( ( N_INFO, run.nevents, run.npix, PEAKS_MAX), dtype=np.float32) 58 36 59 37 60 38 61 for event in run: 39 print event['event_id'].value 62 event_id = event['event_id'].value - 1 63 print 'event_id', event_id 64 40 65 data = event['acal_data'] 41 66 data = despike(data) … … 45 70 filtered = smooth(filtered) 46 71 72 73 74 47 75 # this is a loop over all pixel of this event 48 49 for dat, fil, orig in zip(data, filtered, data_orig):76 for pixel_id, dat, fil, orig in enumerate(zip(data, filtered, data_orig)): 77 print 'pixel id:', pixel_id 50 78 plt.cla() 51 79 prod = fil[:-1] * fil[1:] … … 94 122 plt.plot(np.arange(len(dat)), dat, 'k:') 95 123 96 raw_input('bla') 124 ret = raw_input('pixel-loop?') 125 if ret == 'q': 126 break 127 ret = raw_input('event-loop?') 128 if ret == 'q': 129 break 130 97 131 98 132
Note:
See TracChangeset
for help on using the changeset viewer.