[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()
|
plt.show()
|
||||||
|
|
||||||
def get_array(self, phase, method):
|
def get_all(self, phasename):
|
||||||
pdf_dict = self.comparison
|
pdf_dict = self.comparison
|
||||||
exp_array = list()
|
rlist = list()
|
||||||
for station, phases in pdf_dict.items():
|
for phases in pdf_dict.values():
|
||||||
try:
|
try:
|
||||||
exp_array.append(phases[phase].expectation())
|
rlist.append(phases[phasename])
|
||||||
except KeyError as e:
|
except KeyError:
|
||||||
print('{err_msg}; station = {station}, phase = {phase}'.format(
|
|
||||||
err_msg=str(e), station=station, phase=phase))
|
|
||||||
continue
|
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):
|
def get_expectation_array(self, phase):
|
||||||
pdf_dict = self.comparison
|
return self.get_array(phase, 'expectation')
|
||||||
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
|
|
||||||
|
|
||||||
def get_std_array(self, phase):
|
def get_std_array(self, phase):
|
||||||
pdf_dict = self.comparison
|
return self.get_array(phase, 'standard_deviation')
|
||||||
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
|
|
||||||
|
|
||||||
def hist_expectation(self, phases='all', bins=20, normed=False):
|
def hist_expectation(self, phases='all', bins=20, normed=False):
|
||||||
phases.strip()
|
phases.strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user