コード例 #1
0
def test_loading_normal():
    ert = reda.ERT()
    ert.import_syscal_bin(basepath + 'data_normal.bin')
    # this is an old measurement, accidently downloaded from the Syscal
    assert ert.data.shape[0] == 1

    ert2 = reda.ERT()
    ert2.import_syscal_bin(basepath + 'data_normal.bin', skip_rows=1)
    # real data
    assert ert2.data.shape[0] == 325
コード例 #2
0
def test_loading_reciprocal():
    ert = reda.ERT()
    ert.import_syscal_bin(
        basepath + 'data_reciprocal.bin',
        reciprocals=48,
    )

    ert_txt = reda.ERT()
    ert_txt.import_syscal_txt(
        basepath + 'data_reciprocal.txt',
        reciprocals=48,
    )
コード例 #3
0
def test_neg_K():
    """Test computation and subsequent sign correction for two negative K
    factor """
    df = _get_dataframe()

    # test for 1-3 rows that need fixing (i.e., negative K factor + neg. r)
    for rows_to_changes in ([0], [0, 1], [0, 1, 2]):
        # witch m, n of first configuration to yield a negative k factor, r,
        # and rho_a value
        df.iloc[rows_to_changes, [3, 4]] = df.iloc[rows_to_changes,
                                                   [4, 3]].values
        df.loc[df.index[rows_to_changes], ['r', 'Vmn', 'Zt']] *= -1

        ert = reda.ERT(data=df)
        ert.compute_K_analytical(spacing=1, debug=True)

        assert np.all(ert.data.loc[ert.data.index[rows_to_changes], [
            'r',
            'rho_a',
            'k',
            'Vmn',
        ]] >= 0)
        # check real and imaginary parts pf Zt
        assert np.all(
            np.real(ert.data.loc[ert.data.index[rows_to_changes],
                                 ['Zt']]) >= 0)
        assert np.all(
            np.imag(ert.data.loc[ert.data.index[rows_to_changes],
                                 ['Zt']]) <= 0)
コード例 #4
0
def loader_txt(request):
    """Fixture to load one or more text data files from the syscal"""
    filenames = request.cls.filenames
    ert = reda.ERT()
    ert.import_syscal_txt(basepath + filenames[0])
    if len(filenames) == 2:
        nr_electrodes = request.cls.nr_electrodes
        ert.import_syscal_txt(
            basepath + filenames[1], reciprocals=nr_electrodes)
    request.cls.ert = ert
    yield
コード例 #5
0
ファイル: test_container_ert.py プロジェクト: j-gallistl/reda
def test_init_with_data():
    """test initializing an ERT container an provide good data"""
    df = pd.DataFrame(
        [
            # normals
            (0, 1, 2, 4, 3, 1.1),
            (0, 1, 2, 5, 4, 1.2),
            (0, 1, 2, 6, 5, 1.3),
            (0, 1, 2, 7, 6, 1.4),
            (0, 2, 3, 5, 4, 1.5),
            (0, 2, 3, 6, 5, 1.6),
            (0, 2, 3, 7, 6, 1.7),
            (0, 3, 4, 6, 5, 1.8),
            (0, 3, 4, 7, 6, 1.9),
            (0, 4, 5, 7, 6, 2.0),
        ],
        columns=['timestep', 'a', 'b', 'm', 'n', 'r'],
    )
    container_good = reda.ERT(data=df)
    assert container_good.data.shape[0] == df.shape[0]
コード例 #6
0
ファイル: plot_syscal_dc.py プロジェクト: agrogeophy/datasets
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Importing Syscal ERT data
=========================
"""
import reda
ert = reda.ERT()

###############################################################################
# data import:

# 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)
コード例 #7
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Importing Syscal ERT data
=========================

This example is all about import data from IRIS Instruments Syscal systems.
There is a variety of different options that should cover most use cases.
Also, shortly introduced are the data journal, action log, filtering, and
accessing data using the underlying dataframe.

"""
import numpy as np
import matplotlib.pylab as plt
import reda
ert = reda.ERT()

###############################################################################
# data import:

# note that you should prefer importing the binary data as the text export
# sometimes is missing some of the auxiliary data contained in the binary 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
)
コード例 #8
0
"""Dummy data containers for testing purposes."""

import pandas as pd
import numpy as np
import reda

# construct a simple container using random numbers
ERTContainer = reda.ERT()
df = pd.DataFrame(columns=list("ABMNR"))
df.A = np.arange(1, 23)
df.B = df.A + 1
df.M = df.A + 2
df.N = df.B + 2
np.random.seed(0)
df.R = np.random.randn(len(df.R))
ERTContainer.df = df

# construct an ERT container with normal and reciprocal data
df = pd.DataFrame(
    [
        # normals
        (0, 1, 2, 4, 3, 1.1),
        (0, 1, 2, 5, 4, 1.2),
        (0, 1, 2, 6, 5, 1.3),
        (0, 1, 2, 7, 6, 1.4),
        (0, 2, 3, 5, 4, 1.5),
        (0, 2, 3, 6, 5, 1.6),
        (0, 2, 3, 7, 6, 1.7),
        (0, 3, 4, 6, 5, 1.8),
        (0, 3, 4, 7, 6, 1.9),
        (0, 4, 5, 7, 6, 2.0),
コード例 #9
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Importing Syscal ERT data from roll-a-long scheme
=================================================

"""
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()

###############################################################################
コード例 #10
0
ファイル: test_container_ert.py プロジェクト: j-gallistl/reda
def test_init():
    """test initializing an empty ERT container"""
    container = reda.ERT()
コード例 #11
0
def test_loading_normal():
    ert = reda.ERT()
    ert.import_syscal_bin(basepath + 'data_normal.bin')

    ert_txt = reda.ERT()
    ert_txt.import_syscal_txt(basepath + 'data_normal.txt')
コード例 #12
0
ファイル: containers.py プロジェクト: niklasj-h/reda
"""Dummy data containers for testing purposes."""

import pandas as pd
import numpy as np
import reda

# construct a simple container using random numbers
df = pd.DataFrame(columns=list("abmnr"))
df.a = np.arange(1, 23)
df.b = df.a + 1
df.m = df.a + 2
df.n = df.b + 2
np.random.seed(0)
df.r = np.random.randn(len(df.r))

ERTContainer = reda.ERT(data=df)

# construct an ERT container with normal and reciprocal data
df = pd.DataFrame(
    [
        # normals
        (0, 1, 2, 4, 3, 1.1),
        (0, 1, 2, 5, 4, 1.2),
        (0, 1, 2, 6, 5, 1.3),
        (0, 1, 2, 7, 6, 1.4),
        (0, 2, 3, 5, 4, 1.5),
        (0, 2, 3, 6, 5, 1.6),
        (0, 2, 3, 7, 6, 1.7),
        (0, 3, 4, 6, 5, 1.8),
        (0, 3, 4, 7, 6, 1.9),
        (0, 4, 5, 7, 6, 2.0),
コード例 #13
0
def test_bad_init():
    # anything but a DataFrame
    bad_input_data = 1
    with pytest.raises(Exception):
        reda.ERT(data=bad_input_data)
コード例 #14
0
def test_init():
    """test initializing an empty ERT container"""
    container = reda.ERT()
    assert isinstance(container, reda.ERT)