コード例 #1
0
This is work in progress
"""
###############################################################################
# imports
import reda
###############################################################################
# load the data set

seit = reda.sEIT()
for nr in range(0, 4):
    seit.import_crtomo(
        directory='data_synthetic_4d/modV_0{}_noisy/'.format(nr), timestep=nr)
seit.compute_K_analytical(spacing=1)
###############################################################################
# Plotting pseudosections
with reda.CreateEnterDirectory('output_visualize_4d'):
    pass
    print('at this point the plotting routines do not honor'
          ' timestep dimensionality')

###############################################################################
# Plot a single spectrum
nor, rec = seit.get_spectrum(abmn=[1, 2, 4, 3])

with reda.CreateEnterDirectory('output_visualize_4d'):
    for timestep, spectrum in nor.items():
        spectrum.plot(filename='spectrum_1-2_4-3_ts_{}.png'.format(timestep))

with reda.CreateEnterDirectory('output_visualize_4d'):
    nor, rec, fig = seit.get_spectrum(abmn=[1, 2, 4, 3],
                                      plot_filename='specplot.png')
コード例 #2
0
###############################################################################
# define frequencies
frequencies = np.logspace(-3, 3, 10)

# create the eit manager
eitman = crtomo.eitMan(frequencies=frequencies, grid=grid)

###############################################################################
# start with a homogeneous complex resistivity distribution
eitman.add_homogeneous_model(magnitude=100, phase=0)

r = eitman.plot_forward_models(maglim=[90, 110])
print(r)

# save to files
with reda.CreateEnterDirectory('output_gen_seit_model'):
    r['rmag']['fig'].savefig('fwd_model_hom_rmag.png', dpi=300)
    r['rpha']['fig'].savefig('fwd_model_hom_rpha.png', dpi=300)

###############################################################################
# now we can start parameterizing the subsurface
eitman.set_area_to_single_colecole(0, 5, -2, 0, [100, 0.1, 0.04, 0.8])

r = eitman.plot_forward_models(maglim=[90, 110], phalim=[-30, 0])

# save to files
with reda.CreateEnterDirectory('output_gen_seit_model'):
    r['rmag']['fig'].savefig('fwd_model_par_rmag.png', dpi=300)
    r['rpha']['fig'].savefig('fwd_model_par_rpha.png', dpi=300)

###############################################################################
コード例 #3
0
ファイル: plot_syscal_dc.py プロジェクト: agrogeophy/datasets
# note that you should prefer importing the binary data (the importer can
# import more data)
ert.import_syscal_txt('data_syscal_ert/data_normal.txt')

# the second data set was measured in a reciprocal configuration by switching
# the 24-electrode cables on the Syscal Pro input connectors. The parameter
# "reciprocals" changes electrode notations.
ert.import_syscal_txt('data_syscal_ert/data_reciprocal.txt', reciprocals=48)

# compute geometrical factors using the analytical half-space equation for a
# spacing of 0.25 m
ert.compute_K_analytical(spacing=0.25)

###############################################################################
# create some plots in a subdirectory
with reda.CreateEnterDirectory('plots'):
    ert.pseudosection(column='r',
                      filename='pseudosection_log10_r.pdf',
                      log10=True)
    ert.histogram([
        'r',
        'rho_a',
        'Iab',
    ], filename='histograms.pdf')

###############################################################################
# export to various data files
with reda.CreateEnterDirectory('data_export'):
    # TODO: seems broken
    # ert.export_bert('data.ohm')
    # ert.export_pygimli('data.pygimli')
コード例 #4
0
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))
        for f, td in sinv.tds.items():
            td.configs.gen_dipole_dipole(skipc=0, nr_voltage_dipoles=40)
            td.configs.gen_reciprocals(append=True)
        r = sinv.measurements()
コード例 #5
0
    reciprocals=48
)

# compute geometrical factors using the analytical half-space equation for a
# spacing of 0.25 m
ert.compute_K_analytical(spacing=0.25)

###############################################################################
ert.print_data_journal()

###############################################################################
ert.print_log()

###############################################################################
# create some plots in a subdirectory
with reda.CreateEnterDirectory('plots'):
    ert.pseudosection(
        column='r', filename='pseudosection_log10_r.pdf', log10=True)
    ert.histogram(['r', 'rho_a', 'Iab', ], filename='histograms.pdf')

###############################################################################
# export to various data files
with reda.CreateEnterDirectory('output_01_syscal_import'):
    ert.export_bert('data.ohm')
    ert.export_pygimli('data.pygimli')
    ert.export_crtomo('volt.dat')

###############################################################################
# The data is internally stored in a pandas.DataFrame
# As such, you can always use the data directly and build your custom
# functionality on top of REDA
コード例 #6
0
soil and sediments, Measurement Science and Technology, 30, 084 002,
doi:10.1088/1361-6501/ab1b09, 2019.

"""
import matplotlib.pylab as plt
import numpy as np

import reda
import reda.importers.eit_fzj as eit_fzj

md_data = eit_fzj.get_md_data('data_eit_fzj_li/eit_data.mat',
                              multiplexer_group=1)
print('Available frequencies:', np.unique(md_data['frequency'].values))
data_1k = md_data.query('frequency == 1000')

# convert to [nF]
Cl_1k_nF = np.abs(data_1k[['Cl1', 'Cl2', 'Cl3']] / 1e-9)

min_Cl = np.min(Cl_1k_nF[['Cl1', 'Cl2', 'Cl3']], axis=1)
max_Cl = np.max(Cl_1k_nF[['Cl1', 'Cl2', 'Cl3']], axis=1)
mean_Cl = np.mean(Cl_1k_nF[['Cl1', 'Cl2', 'Cl3']], axis=1)

fig, ax = plt.subplots(1, 1, figsize=(8.3 / 2.54, 4.5 / 2.54))
ax.fill_between(range(0, len(mean_Cl)), y1=np.real(min_Cl), y2=np.real(max_Cl))
ax.plot(np.real(mean_Cl), '.')
ax.set_ylabel('real(Cl) [nF]')
fig.tight_layout()

with reda.CreateEnterDirectory('output_eit_fzj_li'):
    fig.savefig('electrode_capacitances.jpg', dpi=300)
コード例 #7
0
"""
import reda
###############################################################################
# create an ERT container and import first dataset
# The 'elecs_transform_reg_spacing_x' parameter transforms the spacing in x
# direction from the spacing stored in the data file (here 1 m) to the true
# spacing of 0.2 m. This is useful if the spacing on the measurement system is
# not changed between measurements and only changed in the postprocessing (this
# is common practice in some work groups).
ert_p1 = reda.ERT()
ert_p1.import_syscal_bin(
    'data_syscal_rollalong/profile_1.bin',
    elecs_transform_reg_spacing_x=(1, 0.2),
)
ert_p1.compute_K_analytical(spacing=0.2)
with reda.CreateEnterDirectory('output_02_rollalong'):
    ert_p1.pseudosection(
        filename='profile1_pseudosection.pdf',
        column='r', log10=True
    )
###############################################################################
# Print statistics
ert_p1.print_data_journal()

###############################################################################
# This here is an activity list
ert_p1.print_log()

###############################################################################
# create an ERT container and import second dataset
ert_p2 = reda.ERT()
コード例 #8
0
# if not os.path.isdir('hists_filtered'):
#     os.makedirs('hists_filtered')

# r = redahist.plot_histograms_extra_dims(
#     seit.data, ['R', 'rpha'], ['frequency']
# )

# for f in sorted(r.keys()):
#     r[f]['all'].savefig(
#         'hists_filtered/hist_filtered_f_{0}.png'.format(f), dpi=300
#     )

###############################################################################
# Now export the data to CRTomo-compatible files
# this context manager executes all code within the given directory
with reda.CreateEnterDirectory('output_eit_fzj_check'):
    import reda.exporters.crtomo as redaex
    redaex.write_files_to_directory(
        seit.data,
        'crt_results',
        norrec='nor',
    )

###############################################################################
# Plot pseudosections of all frequencies
import reda.plotters.pseudoplots as PS
import pylab as plt

with reda.CreateEnterDirectory('output_eit_fzj_check'):
    g = seit.data.groupby('frequency')
    fig, axes = plt.subplots(4,
コード例 #9
0
#!/usr/bin/env python3
# *-* coding: utf-8 *-*
"""
Analyzing data response of inversion result
===========================================

"""
import crtomo
import reda

seit = crtomo.eitMan(seitdir='seitdir', shalllow_import=False)
with reda.CreateEnterDirectory('output_03'):
    seit.plot_result_spectrum('spectrum_01.jpg', 0)
コード例 #10
0
#!/usr/bin/env python3
# *-* coding: utf-8 *-*
"""
Various ways to create measurement configurations
=================================================
"""
from reda import ConfigManager

configs = ConfigManager(nr_of_electrodes=32)

configs.gen_gradient(skip=10, step=8, vskip=5)
configs.gen_dipole_dipole(skipc=1)
configs.gen_gradient()
configs.gen_schlumberger(15, 16)

print(configs.configs)

###############################################################################
# export mechanisms:
import reda
with reda.CreateEnterDirectory('exported_configs'):
    configs.to_iris_syscal('syscal_configs.txt')
    configs.write_configs('abmn.dat')
    configs.write_crmod_config('config.dat')
コード例 #11
0
import reda
import reda.utils.geometric_factors as geom_facs
from reda.utils.fix_sign_with_K import fix_sign_with_K
import reda.importers.eit_fzj as eit_fzj
###############################################################################
# define an output directory for all files
output_directory = 'output_single_freq_inversion_sEIT'

###############################################################################
# import the sEIT data set
seit = reda.sEIT()
seit.import_eit_fzj('data/bnk_raps_20130408_1715_03_einzel.mat',
                    'data/configs.dat')
###############################################################################
with reda.CreateEnterDirectory(output_directory):
    # export the data into CRTomo-style data files. Each frequency gets its own
    # file
    seit.export_to_crtomo_multi_frequency('result_raw_data')

    # just for demonstration purposes, data could be imported from this
    # directory:
    # create a new sEIT container
    seit_temp = reda.sEIT()
    seit_temp.import_crtomo('result_raw_data')
    # delete it to prevent any confusions
    del (seit_temp)

###############################################################################
# this is a container measurement, we need to compute geometric factors using
# numerical modeling
コード例 #12
0
ファイル: plot_radic_sip256c.py プロジェクト: niklasj-h/reda
###############################################################################
# group the data into frequencies
g = seit.data.groupby('frequency')

###############################################################################
# Plot pseudosection for 10 Hz
import reda.plotters.pseudoplots as PS
data_10hz = g.get_group(10)
fig, ax, cb = PS.plot_pseudosection_type2(data_10hz, column='r', log10=True)
fig, ax, cb = PS.plot_pseudosection_type2(data_10hz, column='rpha')

###############################################################################
# Plot pseudosections of all frequencies
import reda.plotters.pseudoplots as PS
import pylab as plt
with reda.CreateEnterDirectory('output_radic'):
    fig, axes = plt.subplots(7,
                             2,
                             figsize=(15 / 2.54, 25 / 2.54),
                             sharex=True,
                             sharey=True)
    for ax, (key, item) in zip(axes.flat, g):
        fig, ax, cb = PS.plot_pseudosection_type2(item,
                                                  ax=ax,
                                                  column='r',
                                                  log10=True)
        ax.set_title('f: {} Hz'.format(key))
    fig.subplots_adjust(
        hspace=1,
        wspace=0.5,
        right=0.9,
コード例 #13
0
import numpy as np

import reda
import reda.importers.eit_fzj as eit_fzj

emd, md = eit_fzj.get_mnu0_data(
    'data_eit_fzj_leakage_currents/eit_data_mnu0.mat',
    'data_eit_fzj_leakage_currents/configs.data',
    multiplexer_group=1)

data_1k = emd.query('frequency == 1000')

# symmetric excitation current
Is = data_1k['Iab']
# leakage current
Il = data_1k['Ileakage']

ratio_IlIs = np.abs(Il) / np.abs(Is)

Zt_imag = np.imag(data_1k['Zt'])

fig, ax = plt.subplots(1, 1, figsize=(8.3 / 2.54, 4.5 / 2.54))
ax.semilogx(ratio_IlIs, Zt_imag, '.')
ax.set_ylabel(r'imag(Zt) [$\Omega$]')

ax.set_xlabel(r'$|I_l| / |I_s|$')

fig.tight_layout()
with reda.CreateEnterDirectory('output_eit_fzj_leakage_currents'):
    fig.savefig('plot_ratio_vs_Zt.jpg', dpi=300)