The GSLIb equivalent parameter file is
Parameters for DRAW
*******************
START OF PARAMETERS:
data/cluster.dat \file with data
3 \ number of variables
1 2 3 \ columns for variables
0 \ column for probabilities (0=equal)
-1.0e21 1.0e21 \ trimming limits
69069 100 \random number seed, number to draw
draw.out \file for realizations
In [1]:
#general imports
import matplotlib.pyplot as plt
import pygslib
import numpy as np
import pandas as pd
#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')
print ('\n\t\tCluster Data \n',cluster.tail())
In [3]:
print (pygslib.gslib.__draw.draw.__doc__)
In [4]:
cluster['NO-Weight']=1.
parameters_draw = {
'vr' : cluster[['Xlocation','Ylocation','Primary']], # data
'wt' : cluster['NO-Weight'], # weight/prob (use wt[:]=1 for equal probability)
'rseed' : 69069, # random number seed (conditioning cat.)
'ndraw' : 100} # number to draw
vo,sumwts,error = pygslib.gslib.__draw.draw(**parameters_draw)
print ('error ? ', error != 0, error)
print ('is 1./sumwts == nd?', 1./sumwts, len(cluster))
In [5]:
#making the output (which is numpy array) a pandas dataframe for nice printing
dfvo=pd.DataFrame(vo,columns= ['Xlocation','Ylocation','Primary'])
In [6]:
print (dfvo.head(6))
print ('******')
print (dfvo.tail(6))
Results in GSLIB
Xlocation Ylocation Primary
31.500 41.500 22.750
8.500 45.500 0.8100
39.500 30.500 7.940
3.500 23.500 1.380
45.500 22.500 0.930
********
41.500 45.500 2.750
2.500 9.500 6.260
11.500 46.500 0.4000
21.500 34.500 2.840
3.500 47.500 1.960
2.500 8.500 8.900
In [ ]: