Exemplo n.º 1
0
reda.
"""
###############################################################################
# imports
import os
from glob import glob

import numpy as np

import crtomo
import reda

###############################################################################
# Generate the forward models
frequencies = np.logspace(-3, 3, 15)
grid = crtomo.crt_grid('data_synthetic_4d/elem.dat',
                       'data_synthetic_4d/elec.dat')

# this context manager makes sure that all output is relative to the given
# directory
with reda.CreateEnterDirectory('output_synthetic_4d'):
    for nr, anomaly_z_pos in enumerate(range(0, -10, -3)):
        outdir = 'modV_{:02}'.format(nr)
        if os.path.isdir(outdir):
            continue
        sinv = crtomo.eitMan(grid=grid, frequencies=frequencies)
        sinv.add_homogeneous_model(100, 0)
        sinv.set_area_to_single_colecole(18, 22, anomaly_z_pos - 2.0,
                                         anomaly_z_pos, [100, 0.1, 0.04, 0.6])
        r = sinv.plot_forward_models()
        r['rmag']['fig'].savefig('forward_rmag_{:02}.pdf'.format(nr))
        r['rpha']['fig'].savefig('forward_rpha_{:02}.pdf'.format(nr))
Exemplo n.º 2
0
#!/usr/bin/env python3
# *-* coding: utf-8 *-*
"""
Plot a potential distribution, computed with CRMod
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


"""
###############################################################################
# create a tomodir object
import crtomo
grid = crtomo.crt_grid('grid_surface/elem.dat', 'grid_surface/elec.dat')
td = crtomo.tdMan(grid=grid)

###############################################################################
# define configurations
import numpy as np
td.configs.add_to_configs(np.array((
    (1, 10, 5, 7),
    (1, 3, 10, 7),
)))

###############################################################################
# add a homogeneous forward model
td.add_homogeneous_model(100, 0)

###############################################################################
# compute FEM solution using CRMod
td.model(potentials=True)

###############################################################################
seit.filter('k > 400')
seit.filter('rho_a < 0')
seit.filter('a == 12 or b == 12 or m == 12 or n == 12')
seit.filter('a == 13 or b == 13 or m == 13 or n == 13')

# import IPython
# IPython.embed()
seit.print_data_journal()
seit.filter_incomplete_spectra(flimit=300, percAccept=85)
seit.print_data_journal()
seit.print_log()
###############################################################################

import crtomo

grid = crtomo.crt_grid('data/elem.dat', 'data/elec.dat')

seitinv = seit.export_to_crtomo_seit_manager(grid, norrec='nor')
seitinv.crtomo_cfg['robust_inv'] = 'F'
seitinv.crtomo_cfg['mag_abs'] = 0.012
seitinv.crtomo_cfg['mag_rel'] = 0.5
seitinv.crtomo_cfg['hom_bg'] = 'T'
seitinv.crtomo_cfg['d2_5'] = 0
seitinv.crtomo_cfg['fic_sink'] = 'T'
seitinv.crtomo_cfg['fic_sink_node'] = 6467
seitinv.apply_crtomo_cfg()

###############################################################################
# now run the inversion
# we do this the "old" style using the command td_run_all_local, which is also
# included in the crtomo_tools
Exemplo n.º 4
0
###############################################################################
# Create simple surface grids with this wrapper
grid = crtomo.crt_grid.create_surface_grid(nr_electrodes=10, spacing=1.5)
grid.plot_grid()
# number the electrodes (useful for numerical studies)
grid.plot_grid(plot_electrode_numbers=True)

# save this grid to disc
grid.save_elem_file('elem.dat')
grid.save_elec_file('elec.dat')


###############################################################################
# Grid can be read from disk:
grid1 = crtomo.crt_grid('elem.dat', 'elec.dat')
print(grid1)
grid1.plot_grid()

###############################################################################
# Create a grid with layering
grid = crtomo.crt_grid.create_surface_grid(
    nr_electrodes=10,
    spacing=1.5,
    lines=[0.5, 1],
)
print(grid)
grid.plot_grid()