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
cluster= pygslib.gslib.read_gslib_file('../datasets/cluster.dat')  
true= pygslib.gslib.read_gslib_file('../datasets/true.dat')  
true['Declustering Weight'] = 1
    
This is not plotting results but is handy to get declustered bins for plots
In [3]:
    
print pygslib.gslib.__plot.qpplt.__doc__
    
    
In [4]:
    
npoints = len(cluster['Primary'])
true['Declustering Weight'] = 1
#using declustering wight
parameters_qpplt = {
     'qqorpp'  : 0,                             # Q-Q plot (qqorpp=0); P-P plot (qqorpp=1)
      'npts'   : npoints,                       # number of points to use on the Q-Q or P-P plot (should not exceed the smallest number of data in data1 / data2
       'va1'   : cluster['Primary'],            # array('d') with bounds (nd)
       'va2'   : true['Primary'],               # array('d') with bounds (nd)
       'wt1'   : cluster['Declustering Weight'],# array('d') with bounds (nd)
       'wt2'   : true['Declustering Weight']}   # array('d') with bounds (nd)
    
vr1a,vr2a,error = pygslib.gslib.__plot.qpplt(**parameters_qpplt)
print 'error ? ',  error != 0
#ignoring declustering wight
cluster['No Weight'] =1
parameters_qpplt['wt1'] =  cluster['No Weight']
       
vr1b,vr2b,error = pygslib.gslib.__plot.qpplt(**parameters_qpplt)
print 'error ? ',  error != 0
    
    
In [5]:
    
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot (vr1a, vr2a, 'o', label = 'declustered')
plt.plot (vr1b, vr2b, 'o', label = ' non declustered')
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlabel ('cluster dataset')
ax.set_ylabel ('true dataset')
ax.set_title ('QQ PLot')
plt.legend(loc=4)
plt.grid(True)
fig.show
    
    Out[5]:
    
In [6]:
    
npoints = len(cluster['Primary'])
true['Declustering Weight'] = 1
#using declustering wight
parameters_qpplt = {
     'qqorpp'  : 1,                             # Q-Q plot (qqorpp=0); P-P plot (qqorpp=1)
      'npts'   : npoints,                       # number of points to use on the Q-Q or P-P plot (should not exceed the smallest number of data in data1 / data2
       'va1'   : cluster['Primary'],            # array('d') with bounds (nd)
       'va2'   : true['Primary'],               # array('d') with bounds (nd)
       'wt1'   : cluster['Declustering Weight'],# array('d') with bounds (nd)
       'wt2'   : true['Declustering Weight']}   # array('d') with bounds (nd)
    
vr1a,vr2a,error = pygslib.gslib.__plot.qpplt(**parameters_qpplt)
print 'error ? ',  error != 0
#ignoring declustering wight
cluster['No Weight'] =1
parameters_qpplt['wt1'] =  cluster['No Weight']
       
vr1b,vr2b,error = pygslib.gslib.__plot.qpplt(**parameters_qpplt)
print 'error ? ',  error != 0
    
    
In [7]:
    
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
plt.plot (vr1a, vr2a, 'o', label = 'declustered')
plt.plot (vr1b, vr2b, 'o', label = ' non declustered')
#ax.set_xscale('log')
#ax.set_yscale('log')
ax.set_xlabel ('cluster dataset')
ax.set_ylabel ('true dataset')
ax.set_title ('PP PLot')
plt.legend(loc=4)
plt.grid(True)
fig.show
    
    Out[7]:
    
In [ ]: