from em34 import *
# First define loop spacing used
spacing = array([10, 20, 40])
# Example 1: Simple 3-layer model for testing
z = array([2.5, 5.0])
cond = array([0.125, 10, 200])
EMresponse(spacing, z, cond)
# Example 2: Borehole log from island with lots of layers
z = array([2.22, 2.37, 2.52, 2.67, 2.82, 2.97, 3.12, 3.27, 3.42, 3.57, 3.72, 3.87, 4.02, 4.17, 4.32, 4.47])
res = array([8000, 14.0, 12.6, 11.0, 9.5, 8.4, 6.6, 5.7, 4.7, 4.0, 3.6, 3.2, 3.0, 2.7, 2.4, 2.2, 2.3])
EMresponse(spacing, z, 1000.0 / res)
# Example 3: Optimization
''' Define model as before but now assign a negative value to the depths or
conductivities to be optimized. The absolute values of these numbers will be
used as starting guesses in the optimization process.'''
z = array([3.0, -3.1, 5.0]) # Four-layer model, depth of bottom of 2nd layer will be optimized
res = array([20000, 20, 10, -16]) # Conductivity of 4th layer will be optimized
cond = 1000.0 / res
''' For the optimization we need to supply the measured conductivities. For
this example, we calculated those based on the following model:
z = array([3, 4, 5])
res = array([20000, 20, 10, 8])
So, the optimized values should be equal to these values.'''
meas = array([99.60288164, 116.67793727, 122.72996711, 62.71779086, 86.5168288, 103.57591697])
# Call the optimization routine and pass the layered model (depths, conductivities) and measuremed data as arguments
z_new, cond_new = fit_model(spacing, z, cond, meas)
#print_measurements(spacing, meas)
# Call EMresponse to output the calculated theoretical response and the optimized model
EMresponse(spacing, z_new, cond_new, True, meas)
# Example 4: Four-layer model from Portugal
z = array([2.0, 5.0, -50.0])
res = array([1000, 125, -75, -5])
cond = 1000.0 / res
meas = array([46.0, 63.0, 77.0, 30.0, 55.0, 80.0])
z_new, cond_new = fit_model(spacing, z, cond, meas)
EMresponse(spacing, z_new, cond_new, True, meas) # Notice the poor fit