def get_hist_data(self): """returns the tuple of arrays (bin_centers,bin_counts),also saves them as self.binx and self.binc""" es = self.es index = self.index xname, xmin, xmax, xbins = self.xname, self.xmin, self.xmax, self.xbins x, c = get_1d_hist(xname, xmin, xmax, xbins, es, index=index) x, c = map(np.array, [x, c]) self.binx, self.binc = x, c return x, c
def draw_1d_hist_from_es(xname,xmin,xmax,xbins,es,index="*",ax=None,hist_drawer="whiskers"): """i plot the histogram of a variable xname between xmin,xmax with xbins uniform bins. i require es to be an elasticsearch.Elasticsearch client. if hist_drawer == "whiskers", plots a CERNish whiskered histogram elif hist_drawer == "classic", plots a regular one else tries to use hist_drawer as a function(xmin,xmax,xbins,counts,fig=<bokeh figure>) -> figure""" x,c = get_1d_hist(xname,xmin,xmax,xbins,es,index=index) if hist_drawer == "whiskers": deltas = np.sqrt(c) #use whiskered-specific interface return whiskered_histogram(xmin,xmax,xbins,c,deltas,-deltas,fig=ax) elif hist_drawer == "classic": hist_drawer = classic_histogram return hist_drawer(xmin,xmax,xbins,c,fig=ax)