main.py 1.68 KB
Newer Older
felikskiszkurno's avatar
felikskiszkurno committed
1
2
3
4
5
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan  8 10:29:00 2021

felikskiszkurno's avatar
felikskiszkurno committed
6
@author: Feliks Kiszkurno
felikskiszkurno's avatar
felikskiszkurno committed
7
8
9
10
11
12
13
"""

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

import slopestabilitytools
felikskiszkurno's avatar
felikskiszkurno committed
14
import slopestabilitytools.datamanagement
felikskiszkurno's avatar
felikskiszkurno committed
15
16
17
18
19
20
21
import slopestabilityML
import slostabcreatedata

import pygimli as pg
import pygimli.meshtools as mt
import pygimli.physics.ert as ert

felikskiszkurno's avatar
felikskiszkurno committed
22
23
24
# Config
create_new_data = False

25
# Prepare folder structure for output
felikskiszkurno's avatar
felikskiszkurno committed
26
27
is_success = slopestabilitytools.folder_structure.create_folder_structure()

felikskiszkurno's avatar
felikskiszkurno committed
28
29
30
31
32
if not create_new_data:

    test_results = slopestabilitytools.datamanagement.import_tests()

else:
felikskiszkurno's avatar
felikskiszkurno committed
33

felikskiszkurno's avatar
felikskiszkurno committed
34
    # TODO Put this part into a function
felikskiszkurno's avatar
felikskiszkurno committed
35

felikskiszkurno's avatar
felikskiszkurno committed
36
37
38
39
40
41
42
43
    # Settings
    number_of_tests = 10
    rho_spread_factor = 1.5
    rho_max = 150
    layers_min = 1
    layers_max = 5
    min_depth = 1
    max_depth = 25
felikskiszkurno's avatar
felikskiszkurno committed
44

felikskiszkurno's avatar
felikskiszkurno committed
45
46
47
48
49
    # Generate parameters for tests
    tests_horizontal = slopestabilitytools.model_params(number_of_tests,
                                                        rho_spread_factor, rho_max,
                                                        layers_min, layers_max,
                                                        min_depth, max_depth)
felikskiszkurno's avatar
felikskiszkurno committed
50

felikskiszkurno's avatar
felikskiszkurno committed
51
52
    #  Create models and invert them
    test_results = {}
felikskiszkurno's avatar
felikskiszkurno committed
53

felikskiszkurno's avatar
felikskiszkurno committed
54
55
56
57
    for test_name in tests_horizontal.keys():
        test_result_curr = slostabcreatedata.create_data(test_name, tests_horizontal[test_name], max_depth)
        test_results.update({test_name: test_result_curr})
        del test_result_curr
felikskiszkurno's avatar
felikskiszkurno committed
58

felikskiszkurno's avatar
felikskiszkurno committed
59
60
        # Plot and save figures
        slopestabilitytools.plot_and_save(test_name, test_results[test_name], 'Test: ' + test_name)
felikskiszkurno's avatar
felikskiszkurno committed
61

felikskiszkurno's avatar
felikskiszkurno committed
62
svm_accuracy_score, svm_accuracy_labels = slopestabilityML.svm_run(test_results)