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 eb84287f authored by Feliks Kiszkurno's avatar Feliks Kiszkurno
Browse files

changes in test definitions and create data

parent eb920bfa
...@@ -17,12 +17,15 @@ import settings ...@@ -17,12 +17,15 @@ import settings
import test_definitions import test_definitions
settings.init() settings.init()
#test_definitions.init()
# Config # Config
create_new_data = False # set to True if you need to reassign the classes create_new_data = True # set to True if you need to reassign the classes
create_new_data_only = False # set to False in order to run ML classifications create_new_data_only = True # set to False in order to run ML classifications
reassign_classes = False; class_type = 'norm' reassign_classes = False; class_type = 'norm'
param_path = os.path.abspath(os.path.join(os.getcwd()) + '/' + 'TestDefinitions/hor_1layer_varying_depth.csv')
test_definitions.init(path=param_path)
test_definitions.init(path=param_path)
# Load existing data instead of creating new one. # Load existing data instead of creating new one.
if not create_new_data: if not create_new_data:
...@@ -58,18 +61,19 @@ else: ...@@ -58,18 +61,19 @@ else:
# min_depth, max_depth) # min_depth, max_depth)
#tests_parameters = test_definitions.test_definitions #tests_parameters = test_definitions.test_definitions
tests_parameters = slostabcreatedata.read_test_parameters(os.path.abspath(os.path.join(os.getcwd()) + '/' + 'TestDefinitions/big_list_overnight_part2.csv'))
test_definitions.init(tests_parameters)
# tests_parameters = {'hor_11': {'layer_n': 1, 'rho_values': [[1, 10], [2, 12]], 'layers_pos': np.array([-4])}} # tests_parameters = {'hor_11': {'layer_n': 1, 'rho_values': [[1, 10], [2, 12]], 'layers_pos': np.array([-4])}}
# Create models and invert them # Create models and invert them
test_results = {} test_results = {}
print(test_definitions.test_parameters)
for test_name in tests_parameters.keys(): for test_name in test_definitions.test_parameters.keys():
test_result_curr, test_rho_max, test_rho_min = slostabcreatedata.create_data(test_name, test_result_curr, test_rho_max, test_rho_min = slostabcreatedata.create_data(test_name,
tests_parameters[test_name], test_definitions.test_parameters[test_name],
abs(tests_parameters[test_name]['layers_pos'].max())) abs(test_definitions.test_parameters[test_name]['layers_pos'].max()),
lambda_param=test_definitions.test_parameters[test_name]['lambda'],
z_weight=test_definitions.test_parameters[test_name]['z_weight'])
test_results.update({test_name: test_result_curr}) test_results.update({test_name: test_result_curr})
del test_result_curr del test_result_curr
...@@ -82,9 +86,6 @@ else: ...@@ -82,9 +86,6 @@ else:
if not create_new_data_only: if not create_new_data_only:
print('Running ML stuff...') print('Running ML stuff...')
tests_parameters = slostabcreatedata.read_test_parameters(
os.path.abspath(os.path.join(os.getcwd()) + '/' + 'TestDefinitions/hor_1layer_constant_depth_varying_contrast.csv'))
test_definitions.init(tests_parameters)
ml_results = slopestabilityML.run_all_tests(test_results) ml_results = slopestabilityML.run_all_tests(test_results)
# Finish the script if ML classifiaction was not executed # Finish the script if ML classifiaction was not executed
......
...@@ -19,9 +19,9 @@ import slostabcreatedata ...@@ -19,9 +19,9 @@ import slostabcreatedata
import settings import settings
def create_data(test_name, test_config, max_depth): def create_data(test_name, test_config, max_depth, *, lambda_param=20, z_weight=0.6):
world_boundary_v = [-9 * max_depth, 0] # [NW edge] relatively to the middle world_boundary_v = [-200, 0] # [NW edge] relatively to the middle
world_boundary_h = [9 * max_depth, -9 * max_depth] # [SE edge] world_boundary_h = [200, -100] # [SE edge]
# world_boundary_v = [-500, 0] # [right, left border] relatively to the middle # world_boundary_v = [-500, 0] # [right, left border] relatively to the middle
# world_boundary_h = [500, -100] # [top, bottom border] # world_boundary_h = [500, -100] # [top, bottom border]
...@@ -43,14 +43,14 @@ def create_data(test_name, test_config, max_depth): ...@@ -43,14 +43,14 @@ def create_data(test_name, test_config, max_depth):
slopestabilitytools.save_plot(fig_geometry, test_name, '_1_geometry') slopestabilitytools.save_plot(fig_geometry, test_name, '_1_geometry')
measurement_scheme = ert.createERTData( measurement_scheme = ert.createERTData(
elecs=np.linspace(start=-8 * max_depth, stop=8 * max_depth, num=8 * max_depth + 1), elecs=np.linspace(start=-32, stop=32, num=44),
schemeName='dd') schemeName='dd')
for electrode in measurement_scheme.sensors(): for electrode in measurement_scheme.sensors():
geometry.createNode(electrode) geometry.createNode(electrode)
geometry.createNode(electrode - [0, 0.1]) # What does it do? geometry.createNode(electrode - [0, 0.1]) # What does it do?
mesh = mt.createMesh(geometry, quality=34) # , area=2)# mesh = mt.createMesh(geometry, quality=34, area=2)#
resistivity_map = test_config['rho_values'] # [0] resistivity_map = test_config['rho_values'] # [0]
...@@ -75,7 +75,9 @@ def create_data(test_name, test_config, max_depth): ...@@ -75,7 +75,9 @@ def create_data(test_name, test_config, max_depth):
# RUN INVERSION # # RUN INVERSION #
k0 = pg.physics.ert.createGeometricFactors(data) k0 = pg.physics.ert.createGeometricFactors(data)
model_inverted = ert_manager.invert(data=data, lam=20, paraDX=0.25, paraMaxCellSize=2, zWeight=0.9, # paraDepth=2 * max_depth, #inversion_Domain = mt.createMesh(mt.createRectangle([-35, 0], [35, -25], quality=34, area=1))
#inversion_mesh = pg.meshtools.appendTriangleBoundary(inversion_Domain, marker=0, xbound=30, ybound=30)
model_inverted = ert_manager.invert(data=data, lam=lambda_param, paraDX=0.25, paraMaxCellSize=2, zWeight=z_weight, # paraDepth=2 * max_depth,
quality=34, zPower=0.4) quality=34, zPower=0.4)
result_full = ert_manager.inv.model result_full = ert_manager.inv.model
......
...@@ -6,15 +6,19 @@ Created on 08.04.2021 ...@@ -6,15 +6,19 @@ Created on 08.04.2021
@author: Feliks Kiszkurno @author: Feliks Kiszkurno
""" """
import numpy as np
import slostabcreatedata import slostabcreatedata
import os.path
def init(test_def):
global test_definitions def init(path):
test_definitions = slostabcreatedata.read_test_parameters(os.path.abspath(os.path.join(os.getcwd()) + '/' + 'TestDefinitions/big_list_overnight_part2.csv'))
global test_parameters
test_parameters = {}
if path is not '':
test_parameters = slostabcreatedata.read_test_parameters(path)
else:
print('temp')
# test_definitions = {'hor1_01': {'layer_n': 1, 'rho_values': [[1, 5], [2, 15]], 'layers_pos': np.array([-5])}, # test_definitions = {'hor1_01': {'layer_n': 1, 'rho_values': [[1, 5], [2, 15]], 'layers_pos': np.array([-5])},
# 'hor1_02': {'layer_n': 1, 'rho_values': [[1, 5], [2, 50]], 'layers_pos': np.array([-5])}, # 'hor1_02': {'layer_n': 1, 'rho_values': [[1, 5], [2, 50]], 'layers_pos': np.array([-5])},
# 'hor1_03': {'layer_n': 1, 'rho_values': [[1, 15], [2, 20]], 'layers_pos': np.array([-8])}, # 'hor1_03': {'layer_n': 1, 'rho_values': [[1, 15], [2, 20]], 'layers_pos': np.array([-8])},
......
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