To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 944409d6 authored by felikskiszkurno's avatar felikskiszkurno
Browse files

Added some function files (placeholders for now). Moved inversion to a function.

parent 48dfc457
......@@ -34,68 +34,12 @@ tests_horizontal = slopestabilitytools.model_params(number_of_tests,
layers_min, layers_max,
min_depth, max_depth)
for test_name in tests_horizontal['names'].values():
slostabcreatedata.create_data()
for test_name in tests_horizontal.keys():
test_result_curr = slostabcreatedata.create_data(test_name, tests_horizontal[test_name])
world_boundary_v = [-200, 0] # [right, left border] relatively to the middle
world_boundary_h = [200, -100] # [top, bottom border]
test_results = {}
test_results_grid = {}
test_input = {}
test_name = 'hor_1'
#tests_horizontal['layers_pos'][test_name] = [-5]
# INPUT MODEL - SUBSURFACE START #
world = mt.createWorld(start=world_boundary_v, end=world_boundary_h, layers=tests_horizontal['layers_pos'][test_name])#,
#marker=np.linspace(1, tests_horizontal['layer_n']['hor_1'],
# tests_horizontal['layer_n']['hor_1']))
geometry = world # +block
measurement_scheme = ert.createERTData(elecs=np.linspace(start=-45, stop=45, num=91), schemeName='dd')
for electrode in measurement_scheme.sensors():
geometry.createNode(electrode)
geometry.createNode(electrode - [0, 0.1]) # What does it do?
mesh = mt.createMesh(geometry, quality=34) # , area=2)#
resistivity_map = tests_horizontal['rho_values'][test_name] # [0]
#resistivity_map[0] = [1, 50.0]
#resistivity_map[1] = [2, 150.0]
input_model = pg.solver.parseMapToCellArray(resistivity_map, mesh) # rename to input_mesh
# INPUT MODEL - SUBSURFACE MODEL END ###
# SIMULATE ERT MEASUREMENT - START ###
mesh_pd = [] # add new mesh
data = ert.simulate(mesh, scheme=measurement_scheme, res=resistivity_map, noiseLevel=1, noiseAbs=1e-6, seed=1337)
data.remove(data['rhoa'] < 0)
# SIMULATE ERT MEASUREMENT - END ###
ert_manager = ert.ERTManager(sr=False, useBert=True, verbose=True, debug=False)
# RUN INVERSION #
k0 = pg.physics.ert.createGeometricFactors(data)
model_inverted = ert_manager.invert(data=data, lam=20, paraDX=0.25, paraMaxCellSize=5, paraDepth=10, quality=34,
zPower=0.4)
result = ert_manager.inv.model
result_array = result.array()
input_model2 = pg.interpolate(srcMesh=mesh, inVec=input_model, destPos=ert_manager.paraDomain.cellCenters())
input_model2_array = input_model2.array()
experiment_results = pd.DataFrame(data={'X': ert_manager.paraDomain.cellCenters().array()[:, 0],
'Y': ert_manager.paraDomain.cellCenters().array()[:, 1],
'Z': ert_manager.paraDomain.cellCenters().array()[:, 2],
'INM': input_model2_array,
'RES': result_array})
test_results[test_name] = experiment_results
fig, ax = plt.subplots(3)
fig.suptitle(test_name)
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
......@@ -6,11 +6,12 @@ Created on Fri Jan 8 10:29:00 2021
@author: felikskrno
"""
import numpy as np
from numpy import random
random.seed(999)
# number_of_tests = 1
# rho_spread_factor = 1.5
# max_rho = 150
......@@ -21,11 +22,11 @@ random.seed(999)
def model_params(n_of_tests, rho_spread, rho_max, layers_n_min, layers_n_max, depth_min, depth_max):
test_names = {}
test_n_layers = {}
test_rho = {}
test_layers_pos = {}
tests_horizontal = {}
for test_id in range(n_of_tests):
......@@ -72,7 +73,7 @@ def model_params(n_of_tests, rho_spread, rho_max, layers_n_min, layers_n_max, de
if len(rho_temp) == 0:
#rho_temp.append([layer + 1, new_rho])
# rho_temp.append([layer + 1, new_rho])
rho_used.append(new_rho)
else:
......@@ -80,7 +81,7 @@ def model_params(n_of_tests, rho_spread, rho_max, layers_n_min, layers_n_max, de
if new_rho not in rho_used:
new_rho = int(random.rand(1)[0] * rho_max)
#rho_temp.append([layer + 1, new_rho])
# rho_temp.append([layer + 1, new_rho])
rho_used.append(new_rho)
else:
......@@ -88,7 +89,7 @@ def model_params(n_of_tests, rho_spread, rho_max, layers_n_min, layers_n_max, de
while new_rho in rho_used:
new_rho = int(random.rand(1)[0] * rho_max)
#rho_temp.append([layer + 1, new_rho])
# rho_temp.append([layer + 1, new_rho])
rho_used.append(new_rho)
layer += 1
......@@ -102,19 +103,21 @@ def model_params(n_of_tests, rho_spread, rho_max, layers_n_min, layers_n_max, de
rho_final.append([layer_id, rho])
layer_id += 1
test_layers_pos[test_names[test_id]] = -1*(np.sort(np.array(layer_pos_temp)))#np.flip(np.sort(np.array(layer_pos_temp)))
test_rho[test_names[test_id]] = rho_final#np.sort(rho_temp)
test_layers_pos[test_names[test_id]] = -1 * (np.sort(np.array(layer_pos_temp))) # np.flip(np.sort(np.array(layer_pos_temp)))
test_rho[test_names[test_id]] = rho_final # np.sort(rho_temp)
rho_temp = []
rho_used = []
layer_pos = []
layer_pos_temp = []
layer_pos_used = []
tests_horizontal = {'names': test_names,
'layer_n': test_n_layers,
'rho_values': test_rho,
'layers_pos': test_layers_pos}
tests_horizontal2 = {}
for test_name in test_names:
tests_horizontal.update({test_names[test_id]: {'layer_n': test_n_layers[test_names[test_id]],
'rho_values': rho_final,
'layers_pos': test_layers_pos[test_names[test_id]]}})
#tests_horizontal = {'names': test_names,
# 'layer_n': test_n_layers,
# 'rho_values': test_rho,
# 'layers_pos': test_layers_pos}
return tests_horizontal
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on
Created on 15.01.2021
@author:
@author: Feliks Kiszkurno
"""
from .create_data import create_data
\ No newline at end of file
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on
Created on 15.01.2021
@author:
@author: Feliks Kiszkurno
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def create_data(tests_horizontal):
import pygimli as pg
import pygimli.meshtools as mt
import pygimli.physics.ert as ert
def create_data(test_name, test_config):
world_boundary_v = [-200, 0] # [right, left border] relatively to the middle
world_boundary_h = [200, -100] # [top, bottom border]
......@@ -16,14 +24,14 @@ def create_data(tests_horizontal):
test_results_grid = {}
test_input = {}
test_name = 'hor_1'
#test_name = 'hor_1'
for test_name in tests_horizontal['']
# tests_horizontal['layers_pos'][test_name] = [-5]
# INPUT MODEL - SUBSURFACE START #
world = mt.createWorld(start=world_boundary_v, end=world_boundary_h,
layers=tests_horizontal['layers_pos'][test_name]) # ,
layers=test_config['layers_pos']) # ,
# marker=np.linspace(1, tests_horizontal['layer_n']['hor_1'],
# tests_horizontal['layer_n']['hor_1']))
......@@ -36,7 +44,7 @@ def create_data(tests_horizontal):
mesh = mt.createMesh(geometry, quality=34) # , area=2)#
resistivity_map = tests_horizontal['rho_values'][test_name] # [0]
resistivity_map = test_config['rho_values'] # [0]
# resistivity_map[0] = [1, 50.0]
# resistivity_map[1] = [2, 150.0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment