Change PickingResults to inherit from dict and add dot access methods

This commit is contained in:
Darius Arnold 2018-06-19 19:44:26 +02:00
parent 675052975a
commit f4750472c7

View File

@ -164,7 +164,7 @@ class PickingParameters(object):
for key, value in d.items():
setattr(self, key, value)
class PickingResults(object):
class PickingResults(dict):
def __init__(self):
# initialize output
@ -192,6 +192,12 @@ class PickingResults(object):
self.Ao = None # Wood-Anderson peak-to-peak amplitude
self.picker = 'auto' # type of picks
def __setattr__(self, key, value):
self[key] = value
def __getattr__(self, key):
return self[key]
class MissingTraceException(ValueError):
"""
Used to indicate missing traces in a obspy.core.stream.Stream object