def _simulate_matern(D1, D2, D3, N, num_inducing, plot_sim=False):
Q_signal = <NUM_LIT:4><EOL>import GPy<EOL>import numpy as np<EOL>np.random.seed(<NUM_LIT>)<EOL>k = GPy.kern.Matern32(Q_signal, <NUM_LIT:1.>, lengthscale=(np.random.uniform(<NUM_LIT:1>, <NUM_LIT:6>, Q_signal)), ARD=<NUM_LIT:1>)<EOL>for i in range(Q_signal):<EOL><INDENT>k += GPy.kern.PeriodicExponential(<NUM_LIT:1>, variance=<NUM_LIT:1.>, active_dims=[i], period=<NUM_LIT>, lower=-<NUM_LIT:2>, upper=<NUM_LIT:6>)<EOL><DEDENT>t = np.c_[[np.linspace(-<NUM_LIT:1>, <NUM_LIT:5>, N) for _ in range(Q_signal)]].T<EOL>K = k.K(t)<EOL>s2, s1, s3, sS = np.random.multivariate_normal(np.zeros(K.shape[<NUM_LIT:0>]), K, size=(<NUM_LIT:4>))[:, :, None]<EOL>Y1, Y2, Y3, S1, S2, S3 = _generate_high_dimensional_output(D1, D2, D3, s1, s2, s3, sS)<EOL>slist = [sS, s1, s2, s3]<EOL>slist_names = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>Ylist = [Y1, Y2, Y3]<EOL>if plot_sim:<EOL><INDENT>from matplotlib import pyplot as plt<EOL>import matplotlib.cm as cm<EOL>import itertools<EOL>fig = plt.figure("<STR_LIT>", figsize=(<NUM_LIT:8>, <NUM_LIT:6>))<EOL>fig.clf()<EOL>ax = fig.add_subplot(<NUM_LIT:2>, <NUM_LIT:1>, <NUM_LIT:1>)<EOL>labls = slist_names<EOL>for S, lab in zip(slist, labls):<EOL><INDENT>ax.plot(S, label=lab)<EOL><DEDENT>ax.legend()<EOL>for i, Y in enumerate(Ylist):<EOL><INDENT>ax = fig.add_subplot(<NUM_LIT:2>, len(Ylist), len(Ylist) + <NUM_LIT:1> + i)<EOL>ax.imshow(Y, aspect='<STR_LIT>', cmap=cm.gray)  <EOL>ax.set_title("<STR_LIT>".format(i + <NUM_LIT:1>))<EOL><DEDENT>plt.draw()<EOL>plt.tight_layout()<EOL><DEDENT>return slist, [S1, S2, S3], Ylist<EOL>
Simulate some data drawn from a matern covariance and a periodic exponential for use in MRD demos.