plots.py
Go to the documentation of this file.
1 from wirecell import units
2 
3 import numpy
4 from matplotlib.backends.backend_pdf import PdfPages
5 import matplotlib.pyplot as plt
6 
7 def plot_many(spectra, pdffile):
8  '''
9  Make a multipage pdf with the spectral information
10  '''
11  with PdfPages(pdffile) as pdf:
12  for ns in spectra:
13  fig, ax = plt.subplots(nrows=1,ncols=1)
14 
15  freqs = numpy.asarray(ns.freqs)/units.MHz
16  amps = numpy.asarray(ns.amps)/(units.volt/units.Hz)
17 
18  ax.set_title('plane=%d, wirelen=%.1f cm, gain=%.1f mV/fC shape=%.1f $\mu$s' % \
19  (ns.plane, ns.wirelen/units.cm, ns.gain/(units.mV/units.fC), ns.shaping/units.us))
20  ax.set_xlabel('sampled frequency [MHz]')
21  ax.set_ylabel('sampled amplitude [V/Hz]')
22  ax.plot(freqs, amps)
23  pdf.savefig(fig)
24  plt.close()
25 
def plot_many(spectra, pdffile)
Definition: plots.py:7