[refs #195] hitsogram plots implemented for expectation and standard deviation

This commit is contained in:
Sebastian Wehling-Benatelli 2016-04-07 16:29:29 +02:00
parent b5345bb5d3
commit f15e27e81d

View File

@ -145,6 +145,26 @@ class Comparison(object):
return std_array return std_array
def hist_expectation(self, phases='all', bins=50, normed=False): def hist_expectation(self, phases='all', bins=50, normed=False):
phases.strip()
if phases.find('all') is 0:
phases = 'ps'
phases = phases.upper()
nsp = len(phases)
fig, axarray = plt.subplots(1, nsp, sharey=True)
for n, phase in enumerate(phases):
ax = axarray[n]
data = self.get_expectation_array(phase)
xlims = [np.floor(min(data)), np.ceil(max(data))]
ax.hist(data, range=xlims, bins=bins, normed=normed)
title_str = 'phase: {0}, samples: {1}'.format(phase, len(data))
ax.set_title(title_str)
ax.set_xlabel('expectation [s]')
if n is 0:
ax.set_ylabel('abundance [-]')
plt.setp([a.get_yticklabels() for a in axarray[1:]], visible=False)
plt.show()
def hist_standard_deviation(self, phases='all', bins=50, normed=False):
phases.strip() phases.strip()
if phases.find('all') == 0: if phases.find('all') == 0:
phases = 'ps' phases = 'ps'
@ -152,21 +172,18 @@ class Comparison(object):
nsp = len(phases) nsp = len(phases)
fig, axarray = plt.subplots(1, nsp, sharey=True) fig, axarray = plt.subplots(1, nsp, sharey=True)
for n, phase in enumerate(phases): for n, phase in enumerate(phases):
ax = axarray[0, n] ax = axarray[n]
data = self.get_expectation_array(phase) data = self.get_std_array(phase)
xlims = [np.floor(min(data)), np.ceil(max(data))] xlims = [np.floor(min(data)), np.ceil(max(data))]
ax.hist(data, xlims=xlims, bins=bins, normed=normed) ax.hist(data, range=xlims, bins=bins, normed=normed)
title_str = 'phase: {0}, samples: {1}'.format(phase, len(data)) title_str = 'phase: {0}, samples: {1}'.format(phase, len(data))
ax.title(title_str) ax.set_title(title_str)
ax.xlabel('expectation [s]') ax.set_xlabel('standard deviation [s]')
if n is 0: if n is 0:
ax.ylabel('abundance [-]') ax.set_ylabel('abundance [-]')
plt.setp([a.get_yticklabels() for a in axarray[0, 1:]], visible=False) plt.setp([a.get_yticklabels() for a in axarray[1:]], visible=False)
plt.show() plt.show()
def hist_standard_deviation(self):
pass
def hist(self, type='std'): def hist(self, type='std'):
pass pass
@ -223,3 +240,9 @@ class PDFDictionary(object):
type=type) type=type)
return pdf_picks return pdf_picks
comp_obj = Comparison(manual='/home/sebastianp/Data/Insheim/e0057.026.13.xml', auto='/home/sebastianp/Data/Insheim/e0057.026.13.xml')
comp_obj.plot()
comp_obj.hist_expectation()
comp_obj.hist_standard_deviation()