py3dinterpolations.modelling.preprocessor.Preprocessor

class py3dinterpolations.modelling.preprocessor.Preprocessor(griddata: GridData, downsampling_res: Optional[float] = None, normalize_xyz: bool = True, standardize_v: bool = True)

Bases: object

Preprocessor class

Preprocess data before interpolation. Preprocessing includes:
  • Downsampling, by taking the mean of blocks of given resolution

  • Normalization of X Y Z

  • Standardization of V

By calling the preprocess method, the data is preprocessed and a new GridData object is returned with the preprocessed data and the preprocessing parameters set.

Parameters
  • griddata (GridData) – GridData object to preprocess

  • downsampling_res (Union[float, None]) – resolution to downsample data by taking the mean of blocks of given resolution. If None, no downsampling is applied. Default is None.

  • normalize_xyz (bool) – whether to normalize X Y Z. Default is True.

  • standardize_v (bool) – whether to standardize V. Default is True.

griddata

GridData object to preprocess

Type

GridData

downsampling_res

resolution to downsample data by taking the mean of blocks of given resolution. If None, no downsampling is applied. Default is None.

Type

Union[float, None]

normalize_xyz

whether to normalize X Y Z. Default is True.

Type

bool

standardize_v

whether to standardize V. Default is True.

Type

bool

preprocessor_params

dictionary with the parameters of the preprocessing. It is set after calling the preprocess method.:

preprocessor_params = {
    "downsampling": {
        "resolution": downsampling_res,
    },
    "normalization": {
        "X": {
            "min": min_value_of_X,
            "max": max_value_of_X,
        },
        "Y": {
            "min": min_value_of_Y,
            "max": max_value_of_Y,
        },
        "Z": {
            "min": min_value_of_Z,
            "max": max_value_of_Z,
        },
    },
    "standardization": {
        "mean": mean_value_of_V,
        "std": std_value_of_V,
    },

}
Type

dict

Examples

>>> # preprocess data
>>> preprocessor = Preprocessor(
>>>     griddata,
>>>     downsampling_res=0.1,
>>>     normalize_xyz=True,
>>>     standardize_v=True,
>>> )
>>> griddata = preprocessor.preprocess()

Methods

__init__(griddata[, downsampling_res, ...])

preprocess()

preprocess data

Attributes

preprocessor_params

preprocess() GridData

preprocess data

Returns

new GridData object with the preprocessed data

and prerpocessing parameters set

Return type

GridData