Commit f099f2dd authored by Feliks Kiszkurno's avatar Feliks Kiszkurno
Browse files

interface detection is implemented. Wraper around it for multilayer case is needed.

parent 7de6e67f
......@@ -770,7 +770,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 72,
"outputs": [],
"source": [
"# X - values used in the grid\n",
......@@ -795,7 +795,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 73,
"outputs": [
{
"name": "stdout",
......@@ -835,7 +835,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 74,
"outputs": [
{
"name": "stdout",
......@@ -897,7 +897,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 75,
"outputs": [
{
"name": "stdout",
......@@ -11489,13 +11489,13 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 67,
"outputs": [
{
"data": {
"text/plain": "[<matplotlib.lines.Line2D at 0x7fdc5224aad0>]"
"text/plain": "[<matplotlib.lines.Line2D at 0x7fdc52327350>]"
},
"execution_count": 50,
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
},
......@@ -11598,7 +11598,7 @@
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 68,
"outputs": [
{
"name": "stdout",
......@@ -11636,16 +11636,16 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 76,
"outputs": [],
"source": [
"interface_params_a = np.zeros([len(potential_interfaces_values)])*float('NaN')\n",
"interface_params_b = np.zeros([len(potential_interfaces_values)])*float('NaN')\n",
"for inter_id in range(len(potential_interfaces_values)):\n",
" inter_temp = interface_depths[inter_id,0:3261].copy()\n",
" x = depths[~np.isnan(inter_temp)].reshape([depths[~np.isnan(inter_temp)].size])\n",
" y = inter_temp[~np.isnan(inter_temp)].reshape([depths[~np.isnan(inter_temp)].size])\n",
" par = np.polyfit(x, y, 1, full=True)\n",
" x_temp = depths[~np.isnan(inter_temp)].reshape([depths[~np.isnan(inter_temp)].size])\n",
" y_temp = inter_temp[~np.isnan(inter_temp)].reshape([depths[~np.isnan(inter_temp)].size])\n",
" par = np.polyfit(x_temp, y_temp, 1, full=True)\n",
" interface_params_a[inter_id] = par[0][0]\n",
" interface_params_b[inter_id] = par[0][1]"
],
......@@ -11658,22 +11658,58 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 77,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.8768138599960507\n"
"ename": "IndexError",
"evalue": "boolean index did not match indexed array along dimension 0; dimension is 2831 but corresponding boolean dimension is 3262",
"output_type": "error",
"traceback": [
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mIndexError\u001B[0m Traceback (most recent call last)",
"\u001B[0;32m<ipython-input-77-86b42ed0207e>\u001B[0m in \u001B[0;36m<module>\u001B[0;34m\u001B[0m\n\u001B[1;32m 7\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mdiff\u001B[0m \u001B[0;34m<\u001B[0m \u001B[0mthreshold\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 8\u001B[0m \u001B[0minter_temp\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0minterface_depths\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0minter_id\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m:\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcopy\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m----> 9\u001B[0;31m \u001B[0mx1\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mx\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m~\u001B[0m\u001B[0mnp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0misnan\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minter_temp\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mreshape\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mx\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m~\u001B[0m\u001B[0mnp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0misnan\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minter_temp\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0msize\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 10\u001B[0m \u001B[0my1\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0minter_temp\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m~\u001B[0m\u001B[0mnp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0misnan\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minter_temp\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mreshape\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0minter_temp\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m~\u001B[0m\u001B[0mnp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0misnan\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minter_temp\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0msize\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 11\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n",
"\u001B[0;31mIndexError\u001B[0m: boolean index did not match indexed array along dimension 0; dimension is 2831 but corresponding boolean dimension is 3262"
]
}
],
"source": [
"threshold = 1.5\n",
"for inter_id in range(len(potential_interfaces_values)-1):\n",
" diff = abs(interface_params_b[inter_id] - interface_params_b[inter_id+1])\n",
"interfaces_final = {}\n",
"interfaces_final_number = 0\n",
"for inter_id in range(len(potential_interfaces_values) - 1):\n",
" interfaces_final_number = interfaces_final_number + 1\n",
" diff = abs(interface_params_b[inter_id] - interface_params_b[inter_id + 1])\n",
" if diff < threshold:\n",
" "
" inter_temp = interface_depths[inter_id, :].copy()\n",
" x1 = x[~np.isnan(inter_temp)].reshape([x[~np.isnan(inter_temp)].size])\n",
" y1 = inter_temp[~np.isnan(inter_temp)].reshape([inter_temp[~np.isnan(inter_temp)].size])\n",
"\n",
" inter_temp = interface_depths[inter_id + 1, :].copy()\n",
" x2 = x[~np.isnan(inter_temp)].reshape([x[~np.isnan(inter_temp)].size])\n",
" y2 = inter_temp[~np.isnan(inter_temp)].reshape([inter_temp[~np.isnan(inter_temp)].size])\n",
"\n",
" interface_combined_depths = np.concatenate((y1, y2))\n",
" interface_combined_x = np.concatenate((x1, x2))\n",
"\n",
" from scipy import interpolate\n",
" function = interpolate.interp1d(interface_combined_x, interface_combined_depths)\n",
" y_new = function(x)\n",
"\n",
" plt.plot(interface_combined_x, interface_combined_depths, 'r')\n",
" plt.plot(x, y_new)\n",
"\n",
" interfaces_final[interfaces_final_number] = {'x': interface_combined_x,\n",
" 'y': interface_combined_depths}\n",
" inter_id = inter_id + 1\n",
" else:\n",
" inter_temp = interface_depths[inter_id, :].copy()\n",
" x_temp = x[~np.isnan(inter_temp)].reshape([x[~np.isnan(inter_temp)].size])\n",
" y_temp = inter_temp[~np.isnan(inter_temp)].reshape([inter_temp[~np.isnan(inter_temp)].size])\n",
"\n",
"\n",
"\n",
" interfaces_final[interfaces_final_number] = {'x': x_temp, 'y': y_temp}\n",
"\n"
],
"metadata": {
"collapsed": false,
......
......@@ -15,7 +15,7 @@ import test_definitions
import settings
def plot_class_overview(test_results, test_name, class_in, y_pred, clf_name, *, training=False, depth_estimate='x', depth_accuracy='x'):
def plot_class_overview(test_results, test_name, class_in, y_pred, clf_name, *, training=False, depth_estimate='x', interface_y='x', interface_x='x', depth_accuracy='x'):
x = test_results['X'].to_numpy()
y = test_results['Y'].to_numpy()
......@@ -30,7 +30,7 @@ def plot_class_overview(test_results, test_name, class_in, y_pred, clf_name, *,
#fig.suptitle('Classification overview: ' + test_name + ', ' + clf_name + ', depth estimate accuracy: ' + str(depth_accuracy) + '%, depth (est/true): ' + str(depth_estimate) + '/' + str(test_definitions.test_parameters[test_name]['layers_pos'][0]))
depth_true = test_definitions.test_parameters[test_name]['layers_pos'][0]
fig.suptitle('Classification overview: {}, {}, depth estimate accuracy: {:.2f}%, depth (est/true): {:.2f}/{:.2f}'.format(test_name, clf_name, depth_accuracy, depth_estimate, depth_true))
fig.suptitle('Classification overview: {}, {}, depth estimate RMSE: {:.2f}%, depth (est/true): {:.2f}/{:.2f}'.format(test_name, clf_name, depth_accuracy, depth_estimate, depth_true))
fig.subplots_adjust(hspace=0.8)
# Convert labels to numerical for plotting
......@@ -57,6 +57,7 @@ def plot_class_overview(test_results, test_name, class_in, y_pred, clf_name, *,
for depth in test_definitions.test_parameters[test_name]['layers_pos']:
ax[1].hlines(y=depth, xmin=x.min(), xmax=x.max(), linestyle='-', color='r')
ax[1].hlines(y=depth_estimate, xmin=x.min(), xmax=x.max(), linestyle='-', color='g')
ax[1].plot(interface_x, interface_y)
ax[1].set_title('Predicted classes')
ax[1] = slopestabilitytools.set_labels(ax[1])
cb.append(plt.colorbar(im1, ax=ax[1], label='Class')) # , shrink=0.9)
......@@ -68,6 +69,7 @@ def plot_class_overview(test_results, test_name, class_in, y_pred, clf_name, *,
im2 = ax[2].scatter(x, y, c=test_results['INMN'].to_numpy())
for depth in test_definitions.test_parameters[test_name]['layers_pos']:
ax[2].hlines(y=depth, xmin=x.min(), xmax=x.max(), linestyle='-', color='r')
ax[2].hlines(y=depth_estimate, xmin=x.min(), xmax=x.max(), linestyle='-', color='g')
ax[2].set_title('Input model')
ax[2] = slopestabilitytools.set_labels(ax[2])
cb.append(plt.colorbar(im2, ax=ax[2], label='Resistivity log(ohm*m)')) # , shrink=0.9)
......
......@@ -9,11 +9,15 @@ import settings
import slopestabilityML
import pandas as pd
import numpy as np
from scipy import interpolate
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import make_pipeline
from sklearn.metrics import accuracy_score
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
import slopestabilitytools
import test_definitions
......@@ -93,6 +97,16 @@ def run_classification(test_training, test_prediction, test_results, clf, clf_na
result_grid_rolled = np.roll(y_pred_grid, -1, axis=0)
y_pred_grid_deri = y_pred_grid - result_grid_rolled
y_pred_grid_deri[-1, :] = 0
interfaces_detected = slopestabilitytools.detect_interface(xi, yi, y_pred_grid)
depth_interface_estimate = interfaces_detected[1]['depth']
y_estimate = interfaces_detected[1]['y']
x_estimate = interfaces_detected[1]['x']
#depth_interface_accuracy = ((depth_interface_estimate-test_definitions.test_parameters[name]['layers_pos'][0])/test_definitions.test_parameters[name]['layers_pos'][0])*100
y_actual = np.ones([y_estimate.size])*test_definitions.test_parameters[name]['layers_pos'][0]
depth_interface_accuracy = mean_squared_error(y_actual, y_estimate, squared=False)
interpolator = interpolate.interp1d(x_estimate, y_estimate, fill_value='extrapolate')
y_estimate_interp = interpolator(x)
'''
# interface_id = []
# interface_n = []
# interface_depth = []
......@@ -127,6 +141,8 @@ def run_classification(test_training, test_prediction, test_results, clf, clf_na
# interface_id.append(indexes_copy)
# interface_depth.append(yi[indexes_copy])
# interface_number = np.bincount(interface_n).argmax()
'''
'''
for column_id in range(y_pred_grid.shape[0]):
# if len(np.unique(y_pred_grid[:,column_id])) is not 2:
depth_id = np.array(np.where(y_pred_grid[:, column_id] == 4))
......@@ -139,14 +155,22 @@ def run_classification(test_training, test_prediction, test_results, clf, clf_na
depth_interface_estimate = np.mean(depth_all)
depth_interface_accuracy = (mean_absolute_error(depth_all_correct, depth_all) / abs(test_definitions.test_parameters[name]['layers_pos'][0]))*100
print(depth_interface_accuracy)
depth_estim_training.append(depth_interface_estimate)
depth_estim_accuracy_training.append(depth_interface_accuracy)
depth_estim_labels_training.append(name + '_' + str(test_definitions.test_parameters[name]['layers_pos'][0]))
# print(y_train.loc[index])
'''
depth_estim_training.append(depth_interface_estimate)
depth_estim_accuracy_training.append(depth_interface_accuracy)
slopestabilityML.plot_class_overview(test_results_combined.loc[index], name, y_train.loc[index], y_pred,
clf_name, training=True, depth_estimate=depth_interface_estimate,
interface_y=y_estimate_interp, interface_x=x,
depth_accuracy=depth_interface_accuracy)
del y_pred, y_pred_grid, y_pred_grid_deri, y, x, y_actual, xi, yi, y_estimate_interp, depth_interface_accuracy
del depth_interface_estimate
result_class = {}
# Predict with classifier
......@@ -172,31 +196,54 @@ def run_classification(test_training, test_prediction, test_results, clf, clf_na
# Evaluate the accuracy of interface depth detection
x = x_position.loc[index].to_numpy()
y = x_train_temp['Y'].to_numpy()
y = x_question['Y'].to_numpy()
xi, yi, gridded_data = slopestabilitytools.grid_data(x, y, {'class': y_pred})
y_pred_grid = gridded_data['class']
depth_all = np.zeros(y_pred_grid.shape[0])
depth_all_correct = np.ones(y_pred_grid.shape[0]) * test_definitions.test_parameters[test_name_pred]['layers_pos'][0]
for column_id in range(y_pred_grid.shape[0]):
# if len(np.unique(y_pred_grid[:,column_id])) is not 2:
depth_id = np.array(np.where(y_pred_grid[:, column_id] == 4))
if np.size(depth_id) is 0:
depth = yi[-1]
else:
depth_id = depth_id.min()
depth = yi[depth_id]
depth_all[column_id] = depth
depth_interface_estimate = np.mean(depth_all)
'''
y_pred_grid = gridded_data['class']
# depth_all = np.zeros(y_pred_grid.shape[0])
# depth_all_correct = np.ones(y_pred_grid.shape[0]) * test_definitions.test_parameters[test_name_pred]['layers_pos'][0]
# for column_id in range(y_pred_grid.shape[0]):
# # if len(np.unique(y_pred_grid[:,column_id])) is not 2:
# depth_id = np.array(np.where(y_pred_grid[:, column_id] == 4))
# if np.size(depth_id) is 0:
# depth = yi[-1]
# else:
# depth_id = depth_id.min()
# depth = yi[depth_id]
# depth_all[column_id] = depth
# depth_interface_estimate = np.mean(depth_all)
#
# depth_interface_accuracy = (mean_absolute_error(depth_all_correct, depth_all) / abs(test_definitions.test_parameters[name]['layers_pos'][0]))*100
# print(depth_interface_accuracy)
# depth_estim.append(depth_interface_estimate)
# depth_estim_accuracy.append(depth_interface_accuracy)
# depth_estim_labels.append(test_name_pred + '_' + str(test_definitions.test_parameters[test_name_pred]['layers_pos'][0]))
'''
result_grid_rolled = np.roll(y_pred_grid, -1, axis=0)
y_pred_grid_deri = y_pred_grid - result_grid_rolled
y_pred_grid_deri[-1, :] = 0
interfaces_detected = slopestabilitytools.detect_interface(xi, yi, y_pred_grid)
depth_interface_estimate = interfaces_detected[1]['depth']
y_estimate = interfaces_detected[1]['y']
x_estimate = interfaces_detected[1]['x']
# depth_interface_accuracy = ((depth_interface_estimate-test_definitions.test_parameters[name]['layers_pos'][0])/test_definitions.test_parameters[name]['layers_pos'][0])*100
y_actual = np.ones([y_estimate.size]) * test_definitions.test_parameters[name]['layers_pos'][0]
depth_interface_accuracy = mean_squared_error(y_actual, y_estimate, squared=False)
interpolator = interpolate.interp1d(x_estimate, y_estimate, fill_value='extrapolate')
y_estimate_interp = interpolator(x)
depth_interface_accuracy = (mean_absolute_error(depth_all_correct, depth_all) / abs(test_definitions.test_parameters[name]['layers_pos'][0]))*100
print(depth_interface_accuracy)
depth_estim.append(depth_interface_estimate)
depth_estim_accuracy.append(depth_interface_accuracy)
depth_estim_labels.append(test_name_pred + '_' + str(test_definitions.test_parameters[test_name_pred]['layers_pos'][0]))
slopestabilityML.plot_class_overview(test_results[test_name_pred], test_name_pred, class_in, y_pred, clf_name, depth_estimate=depth_interface_estimate,
depth_accuracy=depth_interface_accuracy)
slopestabilityML.plot_class_overview(test_results[test_name_pred], test_name_pred, class_in, y_pred,
clf_name, training=True, depth_estimate=depth_interface_estimate,
interface_y=y_estimate_interp, interface_x=x,
depth_accuracy=depth_interface_accuracy)
# Evaluate result
# accuracy_.append(len(np.where(y_pred == y_answer.to_numpy())) / len(y_answer.to_numpy()) * 100)
accuracy_result.append(score * 100)
......
......@@ -24,6 +24,7 @@ from .reassign_classes import reassign_classes
from .grid_data import grid_data
from .mov_avg import mov_avg
from .classes_labels import numeric2label, label2numeric
from .detect_interface import detect_interface
from .folder_structure.create_folder_structure import create_folder_structure
from .folder_structure.create_folder_for_test import create_folder_for_test
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 10.05.2021
@author: Feliks Kiszkurno
"""
import numpy as np
from scipy import interpolate
def detect_interface(x, y, y_pred_grid):
depths = y
y_pred_col_num = y_pred_grid.shape[1]
y_pred_grid_copy = y_pred_grid.copy()
y_pred_uniq = np.unique(y_pred_grid)
# Assign new values for each class
y_pred_new_values = np.zeros(len(y_pred_uniq))
for number in np.arange(1, len(y_pred_uniq), 1):
y_pred_new_values[number] = y_pred_new_values[number - 1] + number
for id_num in range(len(y_pred_uniq)):
y_pred_grid_copy[y_pred_grid_copy == y_pred_uniq[id_num]] = y_pred_new_values[id_num]
# Get "derivative" of the matrix
result_grid_rolled = np.roll(y_pred_grid_copy, -1, axis=0)
y_pred_grid_deri = y_pred_grid_copy - result_grid_rolled
y_pred_grid_deri[-1, :] = 0
potential_interfaces_values = []
for value in np.unique(y_pred_grid_deri):
#print(str(value) + ': ' + str((np.count_nonzero(y_pred_grid_deri == value) / y_pred_col_num) * 100))
if (np.count_nonzero(y_pred_grid_deri == value) / y_pred_col_num) * 100 > 50:
if value != 0:
potential_interfaces_values.append(value)
# Obtain depths and ids for potential interfaces
interface_ids = np.zeros([len(potential_interfaces_values), y_pred_col_num]) * float("NaN")
interface_depths = np.zeros([len(potential_interfaces_values), y_pred_col_num]) * float("NaN")
for inter_id in range(len(potential_interfaces_values)):
for col_id in range(y_pred_col_num):
ids_temp = np.where(y_pred_grid_deri[:, col_id] == potential_interfaces_values[inter_id])
if ids_temp[0].size > 1:
ids_temp = int(np.mean(ids_temp))
elif ids_temp[0].size == 0:
continue
#print(ids_temp)
# No idea why np.where returns array and sometimes integer
if isinstance(ids_temp, int) is True:
interface_ids[inter_id, col_id] = ids_temp
interface_depths[inter_id, col_id] = depths[ids_temp]
else:
interface_ids[inter_id, col_id] = ids_temp[0][0]
interface_depths[inter_id, col_id] = depths[ids_temp[0][0]]
# Obtain line parameterts
interface_params_a = np.zeros([len(potential_interfaces_values)]) * float('NaN')
interface_params_b = np.zeros([len(potential_interfaces_values)]) * float('NaN')
for inter_id in range(len(potential_interfaces_values)):
inter_temp = interface_depths[inter_id, :].copy()
x_temp = x[~np.isnan(inter_temp)].reshape([x[~np.isnan(inter_temp)].size])
y_temp = inter_temp[~np.isnan(inter_temp)].reshape([inter_temp[~np.isnan(inter_temp)].size])
par = np.polyfit(x_temp, y_temp, 1, full=True)
interface_params_a[inter_id] = par[0][0]
interface_params_b[inter_id] = par[0][1]
# Check if the layers should be combined
threshold = 1.5
interfaces_final = {}
interfaces_final_number = 0
for inter_id in range(len(potential_interfaces_values) - 1):
interfaces_final_number = interfaces_final_number + 1
diff = abs(interface_params_b[inter_id] - interface_params_b[inter_id + 1])
if diff < threshold:
inter_temp = interface_depths[inter_id, :].copy()
x1 = x[~np.isnan(inter_temp)].reshape([x[~np.isnan(inter_temp)].size])
y1 = inter_temp[~np.isnan(inter_temp)].reshape([inter_temp[~np.isnan(inter_temp)].size])
inter_temp = interface_depths[inter_id + 1, :].copy()
x2 = x[~np.isnan(inter_temp)].reshape([x[~np.isnan(inter_temp)].size])
y2 = inter_temp[~np.isnan(inter_temp)].reshape([inter_temp[~np.isnan(inter_temp)].size])
interface_combined_depths = np.concatenate((y1, y2))
interface_combined_x = np.concatenate((x1, x2))
#function = interpolate.interp1d(interface_combined_x, interface_combined_depths)
#y_new = function(x)
interfaces_final[interfaces_final_number] = {'x': interface_combined_x,
'y': interface_combined_depths,
'depth': np.nanmean(interface_combined_depths)}
inter_id = inter_id + 1
else:
inter_temp = interface_depths[inter_id, :].copy()
x_temp = x[~np.isnan(inter_temp)].reshape([x[~np.isnan(inter_temp)].size])
y_temp = inter_temp[~np.isnan(inter_temp)].reshape([inter_temp[~np.isnan(inter_temp)].size])
interfaces_final[interfaces_final_number] = {'x': x_temp, 'y': y_temp, 'depth': np.nanmean(y_temp)}
return interfaces_final
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