def draw_mean_pedestals(self, sigma=False, irr=False, redo=False, show=True): y = array([ mean_sigma(tc_values[1 if sigma else 0])[0] for tc_values in self.get_pedestals(redo) ]) x = self.get_irradiations(string=False) / 1e14 if irr else arange( y.size) g = Draw.make_tgrapherrors( x, y, title='Mean {}'.format('Noise' if sigma else 'Pedestals'), x_tit='Irradation [10^{14} n/cm^{2}]' if irr else 'Run Plan', y_tit='Pulse Height [mV]') format_histo(g, y_off=1.2, x_range=ax_range(x, fl=.1, fh=.1) if irr else ax_range( 0, y.size - 1, .3, .3), x_off=2.5) self.set_bin_labels(g) if not irr else do_nothing() self.Draw(g, self.get_savename('PedestalMeans'), show, draw_opt='ap', bm=.2, w=1.5, h=.75, gridy=True)
def draw_signals(self, step=.1, max_sig=10, rel=True): s = arange(0, max_sig + step, step) data = [self.get_bucket(), self.get_signal()] res = array([ mean_sigma( concatenate([data[0][0][invert(cb)], data[1][0][invert(cs)]]))[0] for cb, cs in [self.get_bucket_cut(data, i, i) for i in s] ]) real = mean(data[1][0]) no_cut = mean(concatenate([data[0][0], data[1][0] ])) / (real if rel else 1) res /= real if rel else 1 g = self.Draw.graph( s, res, x_tit='N Sigma', y_tit= f'{"Relative " if rel else ""}Pulse Height {"" if rel else "[mV]"}', draw_opt='ae3', lw=2, fill_color=2, y_range=ax_range(no_cut, max(res).n, .1, .2)) lc = Draw.horizontal_line(no_cut, w=2) lr = Draw.horizontal_line(1 if rel else real, w=2, color=3) self.Draw.legend([g, lr, lc], ['w/ cut', 'real signal', 'w/o cut'], ['f', 'l', 'l'])
def draw_means(self, **dkw): y = array([ ufloat(*mean_sigma(ph_list, err=False)) for ph_list in self.get_pulse_heights() ]) g = self.Draw.graph(arange(y.size), y, title='Pulse Height Evolution', x_tit='Run Plan', y_tit='Mean Pulse Height [mV]', show=False, x_range=ax_range(0, y.size - 1, .3, .3)) self.set_bin_labels(g, rp=False) self.Draw(g, file_name=self.get_savename('Means'), **prep_kw(dkw, **Draw.mode(2), gridy=True, x_off=2.5))
def draw(self, off=0, bin_size=None, show=True): p = roll(self.get_pulser(), off) & self.get_beam_interruptions() x, y = arange(self.NEntries)[p], self.load_n_hits()[p] x, y = get_hist_vecs( self.Run.Draw.profile( x, y, make_bins( 0, max(x), int( choose(bin_size, self.BinSize / self.get_pulser_rate().n))), show=0)) return self.Draw.graph(x, y, x_tit='Event Number', y_tit='N Hits @ Pulser', w=2, show=show, draw_opt='alx', y_range=ax_range(0, max(max(y).n, 5), .1, .3))
def draw_sigmas(self, y_range=None, show=True): y = array( [mean_sigma(ph_list)[1] for ph_list in self.get_pulse_heights()]) g = Draw.make_tgrapherrors(arange(y.size), y=y, title='Pulse Height STD Evolution', x_tit='Run Plan', y_tit='Pulse Height Standard Deviation [%]') format_histo(g, y_off=1.2, x_range=ax_range(0, y.size - 1, .3, .3), x_off=2.5, y_range=y_range) self.set_bin_labels(g) self.Draw(g, self.get_savename('Sigmas'), show, draw_opt='ap', bm=.2, w=1.5, h=.75, gridy=True)