From d8bb3bbf125778c855e3b43cc9683c3a2f93f8e6 Mon Sep 17 00:00:00 2001 From: Tobias Megies Date: Tue, 17 Sep 2013 16:40:27 +0200 Subject: [PATCH] implement ResponseListElement.. but, uncertainties for FloatType of StationXML are not yet respected --- obspy/station/response.py | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/obspy/station/response.py b/obspy/station/response.py index 2b22b201118..7ebe556e6e6 100644 --- a/obspy/station/response.py +++ b/obspy/station/response.py @@ -416,18 +416,35 @@ def __init__(self, stage_sequence_number, stage_gain_value, decimation_correction=decimation_correction) -class ResponseListElement(): +class ResponseListElement(object): """ Describes the amplitude and phase response value for a discrete frequency value. - - :type frequency: float - :param frequency: The frequency for which the response is valid. - :type amplitude: float - :param amplitude: The value for the amplitude response at this frequency. - :type phase: float - :param phase: The value for the phase response at this frequency. """ + def __init__(self, frequency, amplitude, phase): + """ + :type frequency: float + :param frequency: The frequency for which the response is valid. + :type amplitude: float + :param amplitude: The value for the amplitude response at this + frequency. + :type phase: float + :param phase: The value for the phase response at this frequency. + """ + self.frequency = frequency + self.amplitude = amplitude + self.phase = phase + + @property + def phase(self): + return self.__phase + + @phase.setter + def phase(self, value): + value = float(value) + if not -360 <= value <= 360: + raise ValueError("Phase angle out of allowed range.") + self.__phase = value class FIRResponseStage(ResponseStage):