Ignore:
Timestamp:
04/26/12 10:33:41 (13 years ago)
Author:
kraehenb
Message:
Reinserted the unused code parts in CalFitsPerformanceWeave for better comparison of the Weave and numpy approaches.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/sandbox/kraehenb/CalFitsPerformanceWeave.py

    r13451 r13452  
    8787#        if x:
    8888#            print x,
     89
     90#    #Old attempts using numpy functions
     91#    npcalevent = npcalevent.reshape((caltest.npix, caltest.nroi))
     92#    npthr = npcalevent>2.5 #true if above threshold
     93#    npthr = npthr[:,1:-14] * np.logical_not(npthr[:,:-15]) #only true for the zero crossings, shape (1400,285) [smaller due to necessary integration range]
     94##    print [(x,y) for x,y in zip(npthr.nonzero()[0],npthr.nonzero()[1])] #print the coordinates, range 0-1399,0-284
     95#   
     96#    #Various versions to get the integral, all with approximately the same miserable speed (3 Hz), except for the last one (vectorized function) with ~4.3 Hz
     97#    #Missing: add deadtime after an integration, remove start & end of the array
     98##    integrals = [np.sum(npcalevent[x,y+5:y+15]) for x,y in np.transpose(npthr.nonzero())]
     99##    integrals = [np.sum(npcalevent[x,y+5:y+15]) for x,y in zip(npthr.nonzero()[0],npthr.nonzero()[1])]
     100##    integrals = [np.sum(npcalevent[x,y+5:y+15]) for x,y in itertools.izip(npthr.nonzero()[0],npthr.nonzero()[1])]
     101##    integrals = map((lambda index_a,index_b: np.sum(npcalevent[index_a,index_b+5:index_b+15])),npthr.nonzero()[0],npthr.nonzero()[1])
     102#    integrals = vecoffsum(npthr.nonzero()[0],npthr.nonzero()[1])
     103#    print len(integrals)
     104
    89105#    print caltest.event_id, caltest.event_triggertype, caltest.event_caldata[10]
    90106#    pass
Note: See TracChangeset for help on using the changeset viewer.