Changeset 13443 for fact/tools/pyscripts


Ignore:
Timestamp:
04/25/12 08:54:23 (12 years ago)
Author:
neise
Message:
...evolving...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/sandbox/dneise/gain/gain.py

    r13442 r13443  
    3434fig.hold(True)
    3535
     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
     48PEAKS_MAX = 10
     49N_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.
     57peaks = np.ones( ( N_INFO, run.nevents, run.npix, PEAKS_MAX), dtype=np.float32)
     58
    3659
    3760
    3861for event in run:
    39     print event['event_id'].value
     62    event_id = event['event_id'].value - 1
     63    print 'event_id', event_id
     64   
    4065    data = event['acal_data']
    4166    data = despike(data)
     
    4570    filtered = smooth(filtered)
    4671
     72   
     73
     74
    4775    # 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
    5078        plt.cla()
    5179        prod = fil[:-1] * fil[1:]
     
    94122        plt.plot(np.arange(len(dat)), dat, 'k:')
    95123       
    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       
    97131
    98132
Note: See TracChangeset for help on using the changeset viewer.