#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2016 California Institute of Technology.
# Copyright (c) 2016-2017 The Uncertainty Quantification Foundation.
# License: 3-clause BSD.  The full license text is available at:
#  - https://github.com/uqfoundation/mystic/blob/master/LICENSE

from mystic import log_reader

__doc__ = log_reader.__doc__

if __name__ == '__main__':

    import sys

    log_reader(sys.argv[1:])


# EOF

@my.penalty.quadratic_inequality(penalty, k=1e12)
def p(x):
    return 0.0


# monitor
mon = my.monitors.VerboseMonitor(1, 1)
my.solvers.fmin(f, [5, 5],
                bounds=[(0, 10)] * 2,
                penalty=p,
                itermon=mon,
                disp=1)

my.log_reader(mon)

fig = my.model_plotter(f,
                       mon,
                       depth=True,
                       scale=1.0,
                       bounds="0:10, 0:10",
                       out=True)

from matplotlib import cm
import matplotlib.pyplot as plt

x, y = my.scripts._parse_axes("0:10, 0:10", grid=True)
x, y = np.meshgrid(x, y)
z = 0 * x
s, t = x.shape