11 pr = fr.planes[planeid]
15 ntbins = pr.paths[0].current.size
17 tmax = tmin + ntbins*period
18 tdelta = (tmax-tmin)/ntbins
19 print 'TBINS:', ntbins, tmin, tmax, tdelta, period
21 pitches = [path.pitchpos
for path
in pr.paths]
22 pdelta = pitches[1] - pitches[0]
23 pmax =
max(map(abs, pitches)) + 0.5*pdelta
25 npbins =
int(round((pmax-pmin)/pdelta))
26 print 'PBINS:', npbins, pmin, pmax, pdelta, (pmax-pmin)/pdelta
28 tlin = numpy.linspace(tmin, tmax, ntbins+1)
29 plin = numpy.linspace(pmin, pmax, npbins+1)
34 times, pitches = numpy.meshgrid(tlin, plin)
35 currents = numpy.zeros((npbins, ntbins))
39 pind =
int(round((pitch - pmin)/pdelta))
41 pind =
min(npbins, pind)
43 pind_ref =
int(round((-pitch - pmin)/pdelta))
44 pind_ref =
max(0, pind_ref)
45 pind_ref =
min(npbins, pind_ref)
47 assert path.current.size == ntbins
50 time = tmin + tind*tdelta
51 terr = time - times[pind, tind]
54 center_line = pitches[pind, tind] + 0.5*pdelta
55 perr = pitch - center_line
56 if abs(terr) >= 0.001*tdelta:
57 print 'time:', tind, time, times[pind, tind], terr
58 if abs(perr) >= 0.001*pdelta:
59 print 'pitch:', pind, pitch, pitches[pind, tind], perr
60 assert abs(terr) < 0.001*tdelta
61 assert abs(perr) < 0.001*pdelta
63 print 'pitch:', pind, pitch, pitches[pind, tind], perr
65 currents[pind, tind] = cur
68 currents[pind_ref, tind] = cur
70 return (times, pitches, currents)
def get_plane(fr, planeid, reflect=True)
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)