pyrocko.response¶
Frequency response parameterizations useful as transfer functions in signal processing.
Classes
|
Frequency response of an analog filter. |
|
Butterworth frequency response. |
|
Frequency response of a time delay. |
|
The differentiation response, optionally multiplied by a constant gain. |
|
Frequency response of an analog filter. |
|
Evaluates frequency response from digital filter pole-zero representation. |
|
Calls evalresp and generates values of the instrument response transfer function. |
|
Base class for parameterized frequency responses. |
|
Undocumented. |
|
A flat frequency response. |
|
The integration response, optionally multiplied by a constant gain. |
|
Frequency response returning NaN for all frequencies. |
|
Calls evalresp and generates values of the inverse instrument response for deconvolution of instrument response. |
|
Multiplication of several |
|
Evaluates frequency response from pole-zero representation. |
|
Interpolates frequency response given at a set of sampled frequencies. |
- class FrequencyResponseCheckpoint(**kwargs)[source]¶
Bases:
Object
Undocumented.
- ♦ frequency¶
float
- ♦ value¶
float
- class FrequencyResponse(*args, **kwargs)[source]¶
Bases:
Object
Base class for parameterized frequency responses.
- ♦ checkpoints¶
list
ofFrequencyResponseCheckpoint
objects, default:[]
- evaluate(freqs)[source]¶
Evaluate the response at given frequencies.
- Parameters:
freqs (
numpy.ndarray
of shape(N,)
and dtypefloat
) – Frequencies [Hz].- Returns:
Complex coefficients of the response.
- Return type:
numpy.ndarray
of shape(N,)
and dtypecomplex
- evaluate1(freq)[source]¶
Evaluate the response at a single frequency.
- Parameters:
freq – Frequency [Hz].
- Returns:
Complex response coefficient.
- Return type:
- get_fmax()[source]¶
Get maximum frequency for which the response is defined.
- Returns:
None
if the response has no upper limit, otherwise the maximum frequency in [Hz] for which the response is valid is returned.- Return type:
float or None
- property summary¶
Short summary with key information about the response object.
- class Gain(*args, **kwargs)[source]¶
Bases:
FrequencyResponse
A flat frequency response.
- ♦ constant¶
complex
, default:(1+0j)
- class Evalresp(respfile, trace=None, target='dis', nslc_id=None, time=None, stages=None, **kwargs)[source]¶
Bases:
FrequencyResponse
Calls evalresp and generates values of the instrument response transfer function.
- Parameters:
respfile – response file in evalresp format
trace – trace for which the response is to be extracted from the file
target –
'dis'
for displacement or'vel'
for velocity
- ♦ respfile¶
str
- ♦ nslc_id¶
tuple
of 4str
objects, default:(None, None, None, None)
- ♦ target¶
str
, default:'dis'
- ♦ instant¶
float
- ♦ stages¶
tuple
of 2int
objects, optional
- class InverseEvalresp(respfile, trace, target='dis', **kwargs)[source]¶
Bases:
FrequencyResponse
Calls evalresp and generates values of the inverse instrument response for deconvolution of instrument response.
- Parameters:
respfile – response file in evalresp format
trace – trace for which the response is to be extracted from the file
target –
'dis'
for displacement or'vel'
for velocity
- ♦ respfile¶
str
- ♦ nslc_id¶
tuple
of 4str
objects, default:(None, None, None, None)
- ♦ target¶
str
, default:'dis'
- ♦ instant¶
float
- class PoleZeroResponse(zeros=None, poles=None, constant=1 + 0j, **kwargs)[source]¶
Bases:
FrequencyResponse
Evaluates frequency response from pole-zero representation.
- Parameters:
(j*2*pi*f - zeros[0]) * (j*2*pi*f - zeros[1]) * ... T(f) = constant * ---------------------------------------------------- (j*2*pi*f - poles[0]) * (j*2*pi*f - poles[1]) * ...
The poles and zeros should be given as angular frequencies, not in Hz.
- ♦ zeros¶
list
ofcomplex
objects, default:[]
- ♦ poles¶
list
ofcomplex
objects, default:[]
- ♦ constant¶
complex
, default:(1+0j)
- class DigitalPoleZeroResponse(zeros=None, poles=None, constant=1 + 0j, deltat=None, **kwargs)[source]¶
Bases:
FrequencyResponse
Evaluates frequency response from digital filter pole-zero representation.
- Parameters:
The poles and zeros should be given as angular frequencies, not in Hz.
- ♦ zeros¶
list
ofcomplex
objects, default:[]
- ♦ poles¶
list
ofcomplex
objects, default:[]
- ♦ constant¶
complex
, default:(1+0j)
- ♦ deltat¶
float
- class ButterworthResponse(*args, **kwargs)[source]¶
Bases:
FrequencyResponse
Butterworth frequency response.
- Parameters:
corner – corner frequency of the response
order – order of the response
type – either
high
orlow
- ♦ corner¶
float
, default:1.0
- ♦ order¶
int
, default:4
- ♦ type¶
str
(pyrocko.guts.StringChoice
), default:'low'
- class SampledResponse(frequencies, values, left=None, right=None, **kwargs)[source]¶
Bases:
FrequencyResponse
Interpolates frequency response given at a set of sampled frequencies.
- Parameters:
frequencies,values – frequencies and values of the sampled response function.
left,right – values to return when input is out of range. If set to
None
(the default) the endpoints are returned.
- ♦ frequencies¶
numpy.ndarray (
pyrocko.guts_array.Array
)
- ♦ values¶
numpy.ndarray (
pyrocko.guts_array.Array
)
- ♦ left¶
complex
, optional
- ♦ right¶
complex
, optional
- inverse()[source]¶
Get inverse as a new
SampledResponse
object.
- class IntegrationResponse(n=1, gain=1.0, **kwargs)[source]¶
Bases:
FrequencyResponse
The integration response, optionally multiplied by a constant gain.
- Parameters:
n – exponent (integer)
gain – gain factor (float)
gain T(f) = -------------- (j*2*pi * f)^n
- ♦ n¶
int
, optional, default:1
- ♦ gain¶
float
, optional, default:1.0
- class DifferentiationResponse(n=1, gain=1.0, **kwargs)[source]¶
Bases:
FrequencyResponse
The differentiation response, optionally multiplied by a constant gain.
- Parameters:
n – exponent (integer)
gain – gain factor (float)
T(f) = gain * (j*2*pi * f)^n
- ♦ n¶
int
, optional, default:1
- ♦ gain¶
float
, optional, default:1.0
- class DigitalFilterResponse(b, a, deltat, drop_phase=False, **kwargs)[source]¶
Bases:
FrequencyResponse
Frequency response of an analog filter.
(see
scipy.signal.freqz()
).- ♦ b¶
list
offloat
objects, default:[]
- ♦ a¶
list
offloat
objects, default:[]
- ♦ deltat¶
float
- ♦ drop_phase¶
bool
, default:False
- class AnalogFilterResponse(b, a, **kwargs)[source]¶
Bases:
FrequencyResponse
Frequency response of an analog filter.
(see
scipy.signal.freqs()
).- ♦ b¶
list
offloat
objects, default:[]
- ♦ a¶
list
offloat
objects, default:[]
- class MultiplyResponse(responses=None, **kwargs)[source]¶
Bases:
FrequencyResponse
Multiplication of several
FrequencyResponse
objects.- ♦ responses¶
list
ofFrequencyResponse
objects, default:[]
- class DelayResponse(*args, **kwargs)[source]¶
Bases:
FrequencyResponse
Frequency response of a time delay.
- ♦ delay¶
float
Time delay [s]
- class InvalidResponse(message)[source]¶
Bases:
FrequencyResponse
Frequency response returning NaN for all frequencies.
When using
FrequencyResponse.evaluate()
for the first time after instantiation, the user supplied warningmessage
is emitted.- ♦ message¶
str
Warning message to be emitted when the response is used.