In [1]:
from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
Out[1]:
In [3]:
%matplotlib inline
In [36]:
# here the usual imports. If any of the imports fails, make sure that pynoddy is installed
# properly, ideally with 'python setup.py develop' or 'python setup.py install'
import sys, os
import matplotlib.pyplot as plt
import numpy as np
# adjust some settings for matplotlib
from matplotlib import rcParams
# print rcParams
rcParams['font.size'] = 15
# determine path of repository to set paths corretly below
repo_path = os.path.realpath('../..')
import pynoddy.history
import pynoddy.experiment
rcParams.update({'font.size': 20})
In [162]:
reload(pynoddy.history)
reload(pynoddy.output)
reload(pynoddy.experiment)
reload(pynoddy)
# the model itself is now part of the repository, in the examples directory:
history_file = os.path.join(repo_path, "examples/GBasin_Ve1_V4_b.his")
gipps_mc = pynoddy.experiment.MonteCarlo(history = history_file)
In [163]:
gipps_mc.load_parameter_file(os.path.join(repo_path, "examples/gipps_params_2.csv"))
gipps_mc.freeze()
We now define the number of samples to be generated:
In [164]:
gipps_mc.set_n_draws(100)
probs = gipps_mc.perform_sampling('', output_type = 'section', resolution = 20)
In [165]:
probs.keys()
Out[165]:
In [166]:
gipps_mc.plot_section(direction = 'x', ve = 5.0)
In [167]:
gipps_mc.nx = np.shape(probs[7.0])[0]
gipps_mc.nz = np.shape(probs[7.0])[2]
gipps_mc.plot_section(direction = 'x', data = probs[7.0], ve = 5., cmap = 'RdBu_r')
Furthermore, we set the random seed to enable a completely reproducible experiment:
In [52]:
gipps_mc.set_random_seed(180415)
In [49]:
fig = plt.figure(figsize = (12,6))
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
gipps_mc.plot_section(ax = ax1, direction = 'x', model_type = "base",
colorbar = False, title = "", ve = 5.)
gipps_mc.plot_section(ax = ax2, direction = 'x', colorbar = False,
title = "", ve = 5.)