In [1]:
#general imports
import matplotlib.pyplot as plt
import pygslib
import numpy as np
#make the plots inline
%matplotlib inline
In [2]:
#get the data in gslib format into a pandas Dataframe
mydata= pygslib.gslib.read_gslib_file('../datasets/cluster.dat')
true= pygslib.gslib.read_gslib_file('../datasets/true.dat')
In [3]:
# This is a 2D file, in this GSLIB version we require 3D data and drillhole name or domain code
# so, we are adding constant elevation = 0 and a dummy BHID = 1
mydata['Zlocation']=0
mydata['bhid']=1
true['Declustering Weight']=1
# printing to verify results
print ' \n **** 5 first rows in my datafile \n\n ', mydata.head(n=5)
print ' \n **** 5 first rows in my datafile \n\n ', true.head(n=5)
In [4]:
#view data in a 2D projection
plt.scatter(mydata['Xlocation'],mydata['Ylocation'], c=mydata['Primary'])
plt.colorbar()
plt.grid(True)
plt.show()
This is not plotting results but is handy to get declustered bins for plots
In [5]:
print pygslib.gslib.__plot.probplt.__doc__
In [6]:
mydata['Declustering Weight'].sum()
Out[6]:
In [7]:
parameters_probplt = {
'iwt' : 0, #int, 1 use declustering weight
'va' : mydata['Primary'], # array('d') with bounds (nd)
'wt' : mydata['Declustering Weight']} # array('d') with bounds (nd), wight variable (obtained with declust?)
parameters_probpltl = {
'iwt' : 1, #int, 1 use declustering weight
'va' : mydata['Primary'], # array('d') with bounds (nd)
'wt' : mydata['Declustering Weight']} # array('d') with bounds (nd), wight variable (obtained with declust?)
parameters_probpltt = {
'iwt' : 0, #int, 1 use declustering weight
'va' : true['Primary'], # array('d') with bounds (nd)
'wt' : true['Declustering Weight']} # array('d') with bounds (nd), wight variable (obtained with declust?)
binval,cl,xpt025,xlqt,xmed,xuqt,xpt975,xmin,xmax, \
xcvr,xmen,xvar,error = pygslib.gslib.__plot.probplt(**parameters_probplt)
binvall,cll,xpt025l,xlqtl,xmedl,xuqtl,xpt975l,xminl, \
xmaxl,xcvrl,xmenl,xvarl,errorl = pygslib.gslib.__plot.probplt(**parameters_probpltl)
binvalt,clt,xpt025t,xlqtt,xmedt,xuqtt,xpt975t,xmint, \
xmaxt,xcvrt,xment,xvart,errort = pygslib.gslib.__plot.probplt(**parameters_probpltt)
In [8]:
print cl
print binvall
In [9]:
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot (clt, binvalt, label = 'true')
plt.plot (cl, binval, label = 'raw')
plt.plot (cll, binvall, label = 'declustered')
plt.grid(True)
plt.legend()
fig.show
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot (clt, binvalt, label = 'true')
plt.plot (cl, binval, label = 'raw')
plt.plot (cll, binvall, label = 'declustered')
ax.set_xscale('log')
plt.grid(True)
plt.legend()
fig.show
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot (clt, binvalt, label = 'true')
plt.plot (cl, binval, label = 'raw')
plt.plot (cll, binvall, label = 'declustered')
ax.set_yscale('log')
plt.grid(True)
plt.legend()
fig.show
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot (clt, binvalt, label = 'true')
plt.plot (cl, binval, label = 'raw')
plt.plot (cll, binvall, label = 'declustered')
ax.set_xscale('log')
ax.set_yscale('log')
plt.grid(True)
plt.legend()
fig.show
Out[9]:
In [10]:
print 'data min, max: ', xmin, xmax
print 'data quantile 2.5%, 25%, 50%, 75%, 97.75%: ' , xpt025,xlqt,xmed,xuqt,xpt975
print 'data cv, mean, variance : ', xcvr,xmen,xvar
print 'error <> 0? Then all ok?' , error==0
In [ ]:
In [ ]: