Exemplo n.º 1
0
def model_function2(h):
    return model.exponential(h, 12.0, 1.4) + model.nugget(h, 1.3)
Exemplo n.º 2
0
def main():
    """
    Plots different variogram models and compares them to experimental data.
    """
    lag = 0.1
    nlag = 40
    jura_data = np.genfromtxt('data.txt', names=True)
    hc, gc = variogram.cloud(jura_data['X'], jura_data['Y'], jura_data['Co'])
    he, ge = variogram.experimental(hc, gc, lag, nlag)

    # Print one figure with 4 subplots, subplot syntax: (rows, columns, number)
    # Each figure represents a different variogram model for the same data
    plt.figure(1)

    # Gaussian
    plt.subplot(221)
    x = np.linspace(0, nlag * lag, 1000)
    y = model.gaussian(x, 10, 0.9) + 3.0
    plt.scatter(he, ge, s=30)
    variance = np.var(jura_data['Co'])
    plt.axhline(variance, linestyle='--')
    plt.xlim(xmin=0, xmax=lag * nlag)
    plt.ylim(ymin=0)
    plt.title('Gaussian')
    plt.plot(x, y)

    # Exponential
    plt.subplot(222)
    x = np.linspace(0, nlag * lag, 1000)
    y = model.exponential(x, 12.5, 1.5)
    plt.scatter(he, ge, s=30)
    variance = np.var(jura_data['Co'])
    plt.axhline(variance, linestyle='--')
    plt.xlim(xmin=0, xmax=lag * nlag)
    plt.ylim(ymin=0)
    plt.title('Exponential')
    plt.plot(x, y)

    # Spherical
    plt.subplot(223)
    x = np.linspace(0, nlag * lag, 1000)
    y = model.spherical(x, 13, 1.5)
    plt.scatter(he, ge, s=30)
    variance = np.var(jura_data['Co'])
    plt.axhline(variance, linestyle='--')
    plt.xlim(xmin=0, xmax=lag * nlag)
    plt.ylim(ymin=0)
    plt.xlabel('distance')
    plt.ylabel('gamma')
    plt.title('Spherical')
    plt.plot(x, y)

    # Pure nugget
    plt.subplot(224)
    x = np.linspace(0, nlag * lag, 1000)
    y = model.nugget(x, 13)
    plt.scatter(he, ge, s=30)  # marker size 's' set to 30
    variance = np.var(jura_data['Co'])
    plt.axhline(variance, linestyle='--')
    plt.xlim(xmin=0, xmax=lag * nlag)
    plt.ylim(ymin=0)
    plt.title('Nugget')
    plt.plot(x, y)

    plt.show()
Exemplo n.º 3
0
def model_function(h):
    """
    Model function used in the exercise 11
    """
    return model.exponential(h, 7, 2) + model.nugget(h, 2)
Exemplo n.º 4
0
def model_function(h):
    return model.exponential(h, 14.5, 1.7) + model.nugget(h, 0.5)
Exemplo n.º 5
0
def model_function2(h):
    """
    Model function 2
    """
    return model.gaussian(h, 10.0, 0.9) + model.nugget(h, 3.0)
Exemplo n.º 6
0
def model_function3(h):
    """
    Model function 3
    """
    return model.exponential(h, 12.0, 1.4) + model.nugget(h, 1.3)
Exemplo n.º 7
0
def model_function1(h):
    """
    Model function 1
    """
    return model.exponential(h, 14.5, 1.7) + model.nugget(h, 0.5)
Exemplo n.º 8
0
def model_function5(h):
    """
    Model function 5
    """
    return model.exponential(h, 12.5, 1.5) + model.nugget(h, 1.0)
Exemplo n.º 9
0
def model_function4(h):
    """
    Model function 4
    """
    return model.spherical(h, 10.3, 1.1) + model.nugget(h, 2.5)
Exemplo n.º 10
0
def test_nugget():
    h = 1
    nugget = 2
    assert model.nugget(h, nugget) == 2
Exemplo n.º 11
0
def model_function(h):
    return model.exponential(h, 0.65, 1.5) + model.nugget(h, 0.35)