Beispiel #1
0
#                    fwd_only=1,
#                    result_folder=result_folder_fwd,
#                    starting_model_file=jp(cwd, 'rho1.dat'))
# myfwd.run()

# %% Run CRTOMO

# This will make your Crtomo object run the inversion. The configuration files are
# automatically saved in the results folder

myinv.run()

# %% Import results

if dc == 0:  # If you have IP results to load
    res, ip = import_res(result_folder=result_folder)
    m2p = mtophase(ncycles=1, pulse_l=3.5, tmin=0.02, tmax=2.83)
    ipt = ip[:] * m2p
else:  # if you only have resistivity data to load
    res, files = import_res(result_folder=result_folder, return_file=1)
    rest = np.copy(res[0])

# If you want to convert a crtomo result file in a prior model for future inversions for example:
# modf = res2mod(files[0])

# Let's plot the results:
# Remove outliers (arbitrary)
cut = np.log10(4500)
rest[rest > cut] = cut
# Define a linear space for the color map
res_levels = 10**np.linspace(min(rest), cut, 10)
mesh_dir = jp(cwd, "mesh", sub_folder_name)  # Mesh files directory
mshf = jp(mesh_dir, "Mesh.dat")
results_dir = jp(cwd, "results", sub_folder_name,
                 "FM1B")  # Results files directory

subs = ""

result_folder = jp(results_dir, subs)

ncol, nlin, nelem, blocks, centerxy, nodes = crc.mesh_geometry(mshf)

# %% Load results
try:
    m2p = crc.mtophase(ncycles=1, pulse_l=3.5, tmin=0.02, tmax=2.83)

    res, ip, s = crc.import_res(result_folder=result_folder)

    rest = np.copy(res)
    ipt = np.copy(ip[:] / m2p)
    ss = [si[-1] for si in s]

    # res, files = import_res(result_folder=result_folder, return_file=1)
    # rest = np.copy(res[0])
    res_levels = 10**np.linspace(min(rest), max(rest), 8)
    rtp = 10**np.copy(rest)

    figname = jp(results_dir, result_folder + "_res.png")
    model_map(
        polygons=blocks,
        vals=rtp,
        log=1,
    figname=None,
    extension="pdf",
)
plt.show()

results_dir = jp("/Users/robin/PycharmProjects/MGS",
                 "results/paper/scenario/WFB")

# %% STEPI Smooth
# Load solution

results_dir = jp("/Users/robin/PycharmProjects/MGS",
                 "results/paper/scenario/WFB")
subs = "STEPI"
result_folder = jp(results_dir, subs)
sol, files = crc.import_res(result_folder=result_folder, return_file=1)

# Res plot
res = sol[0]

# res_levels = 10**np.array(sorted(set(resmod)))
rtp = 10**np.copy(res)

model_map(
    polygons=blocks,
    vals=rtp,
    log=1,
    cbpos=bpos,
    levels=res_levels,
    folder=result_folder,
    figname=None,