def spatial_correlation_array(dmatrix, imts, correl='yes', vs30clustered=True): """ :param dmatrix: distance matrix of shape (N, N) :param imts: M intensity measure types :param correl: 'yes', 'no' or 'full' :param vs30clustered: flag, True by default :returns: array of shape (M, N, N) """ assert correl in 'yes no full', correl n = len(dmatrix) corr = numpy.zeros((len(imts), n, n)) for imti, im in enumerate(imts): if correl == 'no': corr[imti] = numpy.eye(n) if correl == 'full': corr[imti] = numpy.ones((n, n)) elif correl == 'yes': corr[imti] = correlation.jbcorrelation(dmatrix, im, vs30clustered) return corr