histogram_matching¶
petrophys.preprocessing.normalization.histogram_matching
Also available as petrophys.preprocessing.histogram_matching
- histogram_matching(source, reference, n_bins=256)[source]¶
Match histogram of source to reference distribution.
This method transforms the source data so that its histogram matches that of the reference data.
- Parameters:
source (np.ndarray) – Source data to transform
reference (np.ndarray) – Reference data to match
n_bins (int, optional) – Not used: samples are mapped by their rank, not through bins.
- Returns:
Transformed source data: each valid sample replaced by the reference quantile at its empirical-CDF position; NaN samples stay NaN.
- Return type:
np.ndarray
Examples
>>> # Normalize well B to match well A >>> gr_b_normalized = histogram_matching(gr_well_b, gr_well_a)