transferFunctionMetric: Cross-spectral comparison

View source: R/transferFunctionMetric.R

transferFunctionMetricR Documentation

Cross-spectral comparison


The transferFunctionMetric() function calculates metrics that assess the relationship between two SNCLs with the same network, station and channel but separate locations. When seismometers are working properly, the transfer function amplitude and phase will match similar values calculated from the instrument responses.

This function calculates the transfer function from data in the incoming streams. Response information is then obtained from the evalresp web service.


transferFunctionMetric(st1, st2, evalresp1, evalresp2)



a Stream object containing a seismic signal


a Stream object containing a seismic signal


a data frame containing an amplitude and phase spectrum


a data frame containing an amplitude and phase spectrum


Details of the algorithm are as follows

# compute complex cross-spectrum of traces x and y ==> Pxx, Pxy, Pyy
# calculate transfer function values:
#     Txy(f) = Pxy(f) / Pxx(f)
#     dataGain <- Mod(Txy)
#     dataPhase <- Arg(Txy)
# calculate avgDataGain and avgDataPhase values for periods of 5-7s
# calculate the corresponding response amplitude ratio and phase difference:
#     request responses for x and y
#     respGain = respGainy(f) / respGainx(f)
#     respPhase = respPhasey(f) - respPhasex(f)
# calculate avgRespGain and avgRespPhase values for periods of 5-7s
# calculate metrics:
#     gain_ratio = avgDataGain / avgRespGain
#     hase_diff = avgDataPhase - avgRespPhase
#     ms_coherence = |Pxy|^2 / (Pxx*Pyy)


A list with a single SingleValueMetric object is returned. The metric name is transfer_function and it has three attributes:

  • gain_ratio – reasonableness of cross-spectral amplitude between st1 and st2

  • phase_diff – reasonableness of cross-spectral phase between st1 and st2

  • ms_coherence – mean square coherence between st1 and st2

These values can be interpreted as follows:

Whenever ms_coherence ~= 1.0, properly functioning seismometers should have:

  • gain_raio ~= 1.0

  • phase_diff < 10.0 (degrees)


Seismic streams passed to transferFunctionMetric() must have the same network, station and channel and must cover the same time range. The two channels should also have values of azimuth and dip within five degrees of each other. If sampling rates differ and one is a multiple of the other, the stream with the higher sampling rate will be decimated to match the lower sampling rate.

The metricList generated for these two-channel metrics will have a SNCL code of the form: N.S.L1:L2.C.Q.


Jonathan Callahan (R code), Mary Templeton (algorithm)


  ## Not run: 
# Create a new IrisClient
iris <- new("IrisClient", debug=TRUE)

# Get seismic data
starttime <- as.POSIXct("2011-05-01 12:00:00", tz="GMT")
endtime <- starttime + 3600

st1 <- getDataselect(iris,"CI","PASC","00","BHZ",starttime,endtime,inclusiveEnd=FALSE)
st2 <- getDataselect(iris,"CI","PASC","10","BHZ",starttime,endtime,inclusiveEnd=FALSE)
evalresp1 <- IRISSeismic::transferFunctionSpectra(st1,40)
evalresp2 <- IRISSeismic::transferFunctionSpectra(st2,40)

# Calculate metrics
metricList <- transferFunctionMetric(st1,st2,evalresp1,evalresp2)
## End(Not run)

IRISMustangMetrics documentation built on April 28, 2022, 1:06 a.m.