shakelib.correlation.dummy

class shakelib.correlation.dummy.DummyCorrelation(periods)[source]

Bases: shakelib.correlation.ccf_base.CrossCorrelationBase

Simplified correlation module for testing purposes. Should not be used in productions runs as it does not produce valid correlations.

Initialize the cross-correlation object.

Parameters:

periods (ndarray) – An array of periods that will be requested from the function. Values must be in the range [0.01, 10.0], and must me sorted from smallest to largest.

Returns:

An instance of DummyCorrelation.

getCorrelation(ix1, ix2, h)[source]

Compute the correlation between two periods and a separation distance of h km. The result returned is:

rho = T1/T2 * exp(-h/10)

where rho is the correlation, T1 is the smaller period, T2 is the larger period, and h is the distance between the points of interest.

The index arrays (ix1 and ix2) and h array must have the same dimensions. The indices may be equal, and there is no restriction on which one is larger. The indices refer to periods in the ‘period’ argument to the class constructor.

Parameters:
  • ix1 (ndarray) – The indices of the first period of interest.

  • ix2 (ndarrays) – The indices of the second period of interest.

  • h (ndarray) – The separation distance between two sites (units of km). The result is placed in h.

Returns:

The predicted correlation coefficient. The output array will have the same shape as the inputs.

Return type:

h (ndarray)