Example #1
0
                          x = np.linspace(-20.1, 20.5, 100),
                          Lr = np.linspace(0.1, 20.0, 50)
                          ),
             theta_vars = dict(tau = RV('uniform', 0.7, 1.0),
                          l = RV('uniform', 5.0, 10.0),
                          D_f = 26e-3,
                          E_f = 72e3,
                          theta = 0.0,
                          xi = RV('weibull_min', scale = 0.017, shape = 8, n_int = 10),
                          phi = 1.0,
                          Ll = 50.0,
 #                              Lr = 1.0
                          ),
             n_int = 5)
 
 e_arr = make_ogrid(s.evar_lst)
 n_e_arr = [ e / np.max(np.fabs(e)) for e in e_arr ]
 
 max_mu_q = np.max(np.fabs(s.mu_q_arr))
 n_mu_q_arr = s.mu_q_arr / max_mu_q
 n_std_q_arr = np.sqrt(s.var_q_arr) / max_mu_q
 
 #===========================================================================
 # Prepare plotting 
 #===========================================================================
 tdir = tempfile.mkdtemp()
 n_img = n_mu_q_arr.shape[0]
 fnames = [os.path.join(tdir, 'x%02d.jpg' % i) for i in range(n_img) ]
 
 f = m.figure(1, size = (1000, 500), fgcolor = (0, 0, 0),
              bgcolor = (1., 1., 1.))
Example #2
0
# This software is provided without warranty under the terms of the BSD
# license included in the Spirrid top directory "licence.txt" and may be
# redistributed only under the conditions described in the aforementioned
# license.
#
# Thanks for using Simvisage open source!
#
#-------------------------------------------------------------------------------

from spirrid import make_ogrid
import numpy as np

evar_names = ['a', 'b', 'c']
evar_lst = [np.arange(1, 5, 1), np.arange(5, 10, 1), np.arange(10, 15, 1)]

e_ogrid = make_ogrid(evar_lst)

def f(a, b, c,):
    return a * b * c


def mu_q(*e):
    eargs = dict(zip(evar_names, e))
    res = f(**eargs)
    return res

otypes = [ float for i in range(len(evar_lst))]
mu_q_vec = np.vectorize(mu_q, otypes=[float])

print mu_q_vec(*e_ogrid)