def singlepopulationfitness(singlepopulation):
    geophysicsbase = GeoPhysicsBase(matrix_size, 0.25)
    geophysicsbase.g[0] = singlepopulation['population_properties'][0] + geophysicsbase.g[0]
    geophysicsbase.g[1] = singlepopulation['population_properties'][1] + geophysicsbase.g[1]
    geophysicsbase.g[2] = singlepopulation['population_properties'][2] + geophysicsbase.g[2]
    svd_regularization = SVDRegularization(geophysicsbase.A, geophysicsbase.g)
    f = svd_regularization.reconstruct_with_tikhonov(1E-11)
    return svd_regularization.getGCValue(geophysicsbase.A, geophysicsbase.g, f)
def plot_tsvd_plot(matrix_size):
    geophysics = GeoPhysicsBase(matrix_size, 0.25)
    svdregularization = SVDRegularization(geophysics.A, geophysics.g)
    s, utb, utbs = svdregularization.get_picatd_parameter()
    x = np.arange(matrix_size)
    plt.plot(x, geophysics.fexact, "r", linewidth=2, label="pre defined f")
    plt.plot(x, svdregularization.reconstruct_with_tikhonov(1e-12), "bs", linewidth=2, label="reconstructed f")
    plt.tick_params(axis="both", which="major", labelsize=18)
    plt.legend(loc="upper right", shadow=True, fontsize="18")
    plt.show()
def plot_tsvd_plot(matrix_size):
    geophysics = GeoPhysicsBase(matrix_size, 0.25)
    svdregularization = SVDRegularization(geophysics.A, geophysics.g)
    s, utb, utbs = svdregularization.get_picatd_parameter()
    x = np.arange(matrix_size)
    plt.plot(x, geophysics.fexact, 'r', linewidth=2, label='pre defined f')
    plt.plot(x, svdregularization.reconstruct_with_tsvd(48), 'bs', linewidth=2, label='reconstructed f')
    plt.tick_params(axis='both', which='major', labelsize=18)
    plt.legend(loc='upper right', shadow=True, fontsize='18')
    plt.show()
def plot_picard_plot(matrix_size):
    geophysics = GeoPhysicsBase(matrix_size, 0.25)
    noise = np.random.normal(0,1E-4, matrix_size)
    for i in range(3, matrix_size):
        noise[i] = 0
    g = geophysics.g + noise
    svdregularization = SVDRegularization(geophysics.A, g)
    s, utb, utbs = svdregularization.get_picatd_parameter()
    x = np.arange(matrix_size)
    plt.plot(x, s, 'r*', linewidth=2, label='${\sigma _i}$')
    plt.plot(x, abs(utb), 'bs', linewidth=2, label='$|u_i^Tb|$')
    plt.plot(x, abs(utbs), 'g^', linewidth=2, label='$|u_i^Tb|/{\sigma _i}$')
    plt.tick_params(axis='both', which='major', labelsize=18)
    plt.legend(loc='lower left', shadow=True, fontsize='18')
    plt.yscale("log")
    plt.show()