Skip to content

Instantly share code, notes, and snippets.

@yohanesnuwara
Created July 2, 2021 08:05
Show Gist options
  • Save yohanesnuwara/3f4b791d2f1ee358c6302c682a07c441 to your computer and use it in GitHub Desktop.
Save yohanesnuwara/3f4b791d2f1ee358c6302c682a07c441 to your computer and use it in GitHub Desktop.
Calculate probability of neutron porosity from drilling torque
import statviz
# Choose lithology
lith = 'marl' # sandstone, claystone, marl
# Two variables to plot against
x, y = 'TORQUE', 'BPHI'
# Bounds of each variable to evaluate probabilities
xbound, ybound = (20e3, 22.5e3), (20, 30)
df = merge_fac_df[merge_fac_df.LITH==lith]
# Plot KDE
statviz.kde2d(df, x, y, evaluate_proba=True, xbound=xbound, ybound=ybound)
# Calculate probabilities from KDE
Px, Py, Pxny, Pxy_cond = statviz.compute_proba_2d(df, x, y, xbound, ybound)
print(Px, Py, Pxny, Pxy_cond)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment