360 Make plot of shaped and digitized response functions. 362 >>> dat = garfield.load("/home/bviren/projects/wire-cell/garfield-data/ub_10.tar.gz") 363 >>> uvw = response.line.responses(dat) 364 >>> plots.plot_digitized_line(uvw) 366 See also wirecell.sigproc.paper.noise. 368 See also `wirecell-sigproc plot-garfield-track-response` command line. 371 time_offset = 50*units.us
374 dt_hi =
int(round(w.times[1] - w.times[0]))
377 n_lo =
int(round(dt_hi/tick * n_hi))
379 colors = [
'red',
'blue',
'black']
380 legends = [
'U-wire',
'V-wire',
'Y-wire']
382 fig, axes = plt.subplots(1, 1, dpi=144)
388 print (rf.plane, legends[ind], numpy.sum(rf.response)*dt_hi/units.eplus,
" electrons")
391 sig = rf.shaped(gain, shaping)
395 samp = sig.resample(n_lo)
396 x = (samp.times-time_offset)/units.us
402 print (
'Shaped:', ind, sum(samp.response))
404 adcf = numpy.floor(samp.response * adc_per_voltage)
405 y = numpy.array(adcf, dtype=int)
408 y = samp.response/units.mV
410 nonzero = [q
for q
in samp.response
if q>0]
412 dt = len(nonzero)*tick
414 print (
"qtot=%e C, itot=%e uA, dt=%d us, nele=%f" % \
415 (qtot/units.coulomb,itot/units.microampere,dt/units.us,qtot/units.eplus))
417 y = samp.response/units.nanoampere
419 print (
"padding waveforms by %d ticks" % tick_padding)
420 y = numpy.hstack((numpy.zeros((tick_padding,), dtype=int), y[:-tick_padding]))
422 ymins.append(numpy.min(y))
423 ymaxs.append(numpy.max(y))
425 if lstype ==
"steps":
426 print(x.shape, y.shape)
427 axes.step(x, y, color=colors[ind], label=legends[ind])
429 axes.plot(x, y, ls=lstype, color=colors[ind], label=legends[ind])
434 axes.legend(loc=
"upper left")
435 xmmymm = list(axes.axis())
446 axes.set_xlabel(
'Sample time [$\mu$s]')
448 axes.set_title(
'ADC Waveform with 2D %s Wire Plane Model' % detector)
449 axes.set_ylabel(
'ADC (baseline subtracted)')
451 xmmymm[3] =
max(ymaxs)
452 xmmymm[2] =
min(ymins)
454 axes.set_title(
'Voltage Waveform')
455 axes.set_ylabel(
'Voltage Sample (baseline subtracted) [mV]')
457 axes.set_title(
'Induced Current')
458 axes.set_xlabel(
'Time [$\mu$s]')
459 axes.set_ylabel(
'Instantaneous current (nanoamp)')
468 if "microboone" in detector.lower():
470 " Garfield 2D calculation\n(perpendicular line source)")
472 axes.text(textx,-20, msg)
474 if "dune" in detector.lower():
475 if tick_padding == 0:
479 " Garfield 2D calculation\n(perpendicular line source)")
482 return fig, numpy.vstack(data).T
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)