[edit] further restructuring and bugfixing

This commit is contained in:
2016-05-03 13:54:59 +02:00
parent a82c1d39c6
commit 41991c5d81
5 changed files with 52 additions and 17 deletions

View File

@@ -9,7 +9,7 @@ import matplotlib.pyplot as plt
from obspy import read_events
from pylot.core.io.phases import picks_to_dict
from pylot.core.io.phases import picksdict_from_picks
from pylot.core.util.pdf import ProbabilityDensityFunction
from pylot.core.util.version import get_git_version as _getVersionString
@@ -227,7 +227,7 @@ class PDFDictionary(object):
if len(cat) > 1:
raise NotImplementedError('reading more than one event at the same '
'time is not implemented yet! Sorry!')
return PDFDictionary(picks_to_dict(cat[0]))
return PDFDictionary(picksdict_from_picks(cat[0]))
def pdf_data(self, type='exp'):
"""

View File

@@ -464,6 +464,37 @@ def getResolutionWindow(snr):
return time_resolution / 2
def select_for_phase(st, phase):
'''
takes a STream object and a phase name and returns that particular component
which presumably shows the chosen PHASE best
:param st: stream object containing one or more component[s]
:type st: `~obspy.core.stream.Stream`
:param phase: label of the phase for which the stream selection is carried
out; 'P' or 'S'
:type phase: str
:return:
'''
from pylot.core.util.defaults import COMPNAME_MAP
sel_st = Stream()
if phase.upper() is 'P':
comp = 'Z'
alter_comp = COMPNAME_MAP[comp]
sel_st += st.select(component=comp)
sel_st += st.select(component=alter_comp)
elif phase.upper() is 'S':
comps = 'NE'
for comp in comps:
alter_comp = COMPNAME_MAP[comp]
sel_st += st.select(component=comp)
sel_st += st.select(component=alter_comp)
else:
raise TypeError('Unknown phase label: {0}'.format(phase))
return sel_st
def wadaticheck(pickdic, dttolerance, iplot):
'''
Function to calculate Wadati-diagram from given P and S onsets in order