Пример #1
0
 def compute_K_analytical(self, spacing, **kwargs):
     """Compute geometrical factors over the homogeneous half-space with a
     constant electrode spacing
     """
     K = redaK.compute_K_analytical(self.data, spacing=spacing, **kwargs)
     self.data = redaK.apply_K(self.data, K, **kwargs)
     redafixK.fix_sign_with_K(self.data, **kwargs)
Пример #2
0
    def compute_K_analytical(self, spacing):
        """Assuming an equal electrode spacing, compute the K-factor over a
        homogeneous half-space.

        For more complex grids, please refer to the module:
        reda.utils.geometric_factors

        Parameters
        ----------
        spacing : float
            Electrode spacing

        """
        assert isinstance(spacing, Number)
        K = geometric_factors.compute_K_analytical(self.data, spacing)
        self.data = geometric_factors.apply_K(self.data, K)
        fix_sign_with_K(self.data)
Пример #3
0
def compute_correction_factors(data, true_conductivity, elem_file, elec_file):
    """Compute correction factors for 2D rhizotron geometries, following
    Weigand and Kemna, 2017, Biogeosciences

    https://doi.org/10.5194/bg-14-921-2017

    Parameters
    ----------
    data : :py:class:`pandas.DataFrame`
        measured data
    true_conductivity : float
        Conductivity in S/m
    elem_file : string
        path to CRTomo FE mesh file (elem.dat)
    elec_file : string
        path to CRTomo FE electrode file (elec.dat)

    Returns
    -------
    correction_factors : Nx5 :py:class.`numpy.ndarray`
        measurement configurations and correction factors
        (a,b,m,n,correction_factor)
    """
    settings = {
        'rho': 100,
        'pha': 0,
        'elem': 'elem.dat',
        'elec': 'elec.dat',
        '2D': True,
        'sink_node': 100,
    }
    K = geometric_factors.compute_K_numerical(data, settings=settings)

    data = geometric_factors.apply_K(data, K)
    data = fixK.fix_sign_with_K(data)

    frequency = 100

    data_onef = data.query('frequency == {}'.format(frequency))
    rho_measured = data_onef['r'] * data_onef['k']

    rho_true = 1 / true_conductivity * 1e4
    correction_factors = rho_true / rho_measured

    collection = np.hstack(
        (data_onef[['a', 'b', 'm',
                    'n']].values, np.abs(correction_factors)[:, np.newaxis]))

    return collection
Пример #4
0
 def compute_K_analytical(self, spacing):
     """Compute geometrical factors over the homogeneous half-space with a
     constant electrode spacing
     """
     redaK.compute_K_analytical(self.data, spacing=spacing)
     redafixK.fix_sign_with_K(self.data)
Пример #5
0
 def fix_sign_with_K(self):
     """ """
     fix_sign_with_K(self.data)
Пример #6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Import MPT DAS-1 data
=====================

"""
import reda

###############################################################################
# normal loading of tdip data
ip = reda.TDIP()
# with profiler():
ip.import_mpt('data_mpt_das1/TD_2000ms.Data')

print(ip.data[['a', 'b', 'm', 'n', 'id', 'norrec']])

# import IPython
# IPython.embed()
# exit()
###############################################################################
#
import reda.utils.geometric_factors as geomK
K = geomK.compute_K_analytical(ip.data, spacing=2)
geomK.apply_K(ip.data, K)

import reda.utils.fix_sign_with_K as fixK
ip.data = fixK.fix_sign_with_K(ip.data)

###############################################################################
                    'data/configs.dat')
print(seit.data[['a', 'b', 'm', 'n']].iloc[0:10])
###############################################################################
# compute geometric factors and correct for signs/phase shifts by pi
settings = {
    'rho': 100,
    'elem': 'data/elem.dat',
    'elec': 'data/elec.dat',
    'sink_node': '6467',
    '2D': True,
}
k = geom_facs.compute_K_numerical(seit.data, settings)
seit.data = geom_facs.apply_K(seit.data, k)

# input('nr 2, press enter to continue')
fix_sign_with_K(seit.data)
###############################################################################
# apply correction factors for 2D rhizotron tank
corr_facs_nor = np.loadtxt('data/corr_fac_avg_nor.dat')
corr_facs_rec = np.loadtxt('data/corr_fac_avg_rec.dat')
corr_facs = np.vstack((corr_facs_nor, corr_facs_rec))
seit.data, cfacs = eit_fzj.apply_correction_factors(seit.data, corr_facs)

###############################################################################
# apply data filters
seit.filter('r < 0')
seit.filter('rho_a < 15 or rho_a > 35')
seit.filter('rpha < - 40 or rpha > 3')
seit.filter('rphadiff < -5 or rphadiff > 5')
seit.filter('k > 400')
seit.filter('rho_a < 0')
Пример #8
0
# initialize an sEIT container
seit_not_used = reda.sEIT()

# import the data
seit_not_used.import_eit_fzj(filename='data_EIT40_v_EZ-2017/eit_data_mnu0.mat',
                             configfile=MD_ConfigsPermutate)

##############################################################################
# Compute geometric factors
import reda.utils.geometric_factors as redaK
import reda.utils.fix_sign_with_K as redafixK

K = redaK.compute_K_analytical(seit.data, spacing=0.25)
redaK.apply_K(seit.data, K)
redafixK.fix_sign_with_K(seit.data)

##############################################################################
# compute normal and reciprocal pairs
# note that this is usually done on import once.
import reda.utils.norrec as norrec
seit.data = norrec.assign_norrec_to_df(seit.data)

##############################################################################
# quadrupoles can be directly accessed using a pandas grouper
print(seit.abmn)
quadpole_data = seit.abmn.get_group((10, 29, 15, 34))
print(quadpole_data[['a', 'b', 'm', 'n', 'frequency', 'r', 'rpha']])

##############################################################################
# filter data