[bugfix] changed the way the the expectation and the std array are calculated; not sure how to deal with values 'inf'
This commit is contained in:
parent
a3deb2a9d3
commit
3568a8a59a
@ -140,41 +140,28 @@ class Comparison(object):
|
||||
|
||||
plt.show()
|
||||
|
||||
def get_array(self, phase, method):
|
||||
def get_all(self, phasename):
|
||||
pdf_dict = self.comparison
|
||||
exp_array = list()
|
||||
for station, phases in pdf_dict.items():
|
||||
rlist = list()
|
||||
for phases in pdf_dict.values():
|
||||
try:
|
||||
exp_array.append(phases[phase].expectation())
|
||||
except KeyError as e:
|
||||
print('{err_msg}; station = {station}, phase = {phase}'.format(
|
||||
err_msg=str(e), station=station, phase=phase))
|
||||
rlist.append(phases[phasename])
|
||||
except KeyError:
|
||||
continue
|
||||
return exp_array
|
||||
return rlist
|
||||
|
||||
def get_array(self, phase, method_name):
|
||||
import operator
|
||||
method = operator.methodcaller(method_name)
|
||||
pdf_list = self.get_all(phase)
|
||||
rarray = map(method, pdf_list)
|
||||
return rarray
|
||||
|
||||
def get_expectation_array(self, phase):
|
||||
pdf_dict = self.comparison
|
||||
exp_array = list()
|
||||
for station, phases in pdf_dict.items():
|
||||
try:
|
||||
exp_array.append(phases[phase].expectation())
|
||||
except KeyError as e:
|
||||
print('{err_msg}; station = {station}, phase = {phase}'.format(
|
||||
err_msg=str(e), station=station, phase=phase))
|
||||
continue
|
||||
return exp_array
|
||||
return self.get_array(phase, 'expectation')
|
||||
|
||||
def get_std_array(self, phase):
|
||||
pdf_dict = self.comparison
|
||||
std_array = list()
|
||||
for station, phases in pdf_dict.items():
|
||||
try:
|
||||
std_array.append(phases[phase].standard_deviation())
|
||||
except KeyError as e:
|
||||
print('{err_msg}; station = {station}, phase = {phase}'.format(
|
||||
err_msg=str(e), station=station, phase=phase))
|
||||
continue
|
||||
return std_array
|
||||
return self.get_array(phase, 'standard_deviation')
|
||||
|
||||
def hist_expectation(self, phases='all', bins=20, normed=False):
|
||||
phases.strip()
|
||||
|
Loading…
Reference in New Issue
Block a user