watex.utils.vesDataOperator#

watex.utils.vesDataOperator(AB=None, rhoa=None, data=None, typeofop='mean', outdf=False)[source]#

Process VES data to handle duplicated spacing distances (AB) by applying specified operations to the corresponding resistivity values (rhoa).

In VES measurements, it’s common to encounter duplicated AB values with different resistivity readings due to minor adjustments in the MN distance. This function consolidates such duplicates by either averaging, taking the median, or randomly selecting one of the resistivity readings.

Parameters:
  • AB (Optional[ArrayLike], optional) – 1D array of AB spacings from current electrodes, representing the exploration depth measurements in meters. If data is provided, this parameter is ignored.

  • rhoa (Optional[ArrayLike], optional) – 1D array of apparent resistivity values corresponding to AB spacings, measured in ohm-meters (Ω·m). If data is provided, this parameter is ignored.

  • data (Optional[DataFrame], optional) – DataFrame containing both AB spacings and corresponding rhoa values. Overrides AB and rhoa parameters when provided.

  • typeofop (str, optional) –

    Specifies the operation to apply to rhoa values for duplicated AB spacings: - ‘mean’: Calculates the mean of rhoa values for each unique AB spacing. - ‘median’: Determines the median of rhoa values for each unique AB spacing. - ‘leaveoneout’: Randomly selects one rhoa value from the duplicates for each

    unique AB spacing. This approach is useful for experiments with significant measurement variance at the same AB spacing.

    Default is ‘mean’.

  • outdf (bool, optional) – Determines the format of the output. If True, returns a DataFrame with processed AB and rhoa values; otherwise, returns a tuple (AB, rhoa). Default is False.

Returns:

Processed AB and rhoa values. The format is dictated by the outdf parameter: a DataFrame if True, or a tuple (AB, rhoa) if False.

Return type:

Union[Tuple[ArrayLike, ArrayLike], DataFrame]

Examples

>>> from watex.utils.exmath import vesDataOperator
>>> AB = np.array([10, 10, 20, 30, 30])
>>> rhoa = np.array([100, 105, 150, 200, 195])
>>> # Processing with mean operation
>>> AB_proc, rhoa_proc = vesDataOperator(AB, rhoa, typeofop='mean')
>>> print(AB_proc)
[10 20 30]
>>> print(rhoa_proc)
[102.5 150 197.5]
>>> # Using DataFrame input and median operation
>>> data = pd.DataFrame({'AB': AB, 'rhoa': rhoa})
>>> df_proc = vesDataOperator(data=data, typeofop='median', outdf=True)
>>> print(df_proc)
     AB  rhoa
0  10  102.5
1  20  150.0
2  30  197.5