Example #1
0
if random_sample == False:
    n0 = 50  # number of samples in lam0 direction
    n1 = 50  # number of samples in lam1 direction
    n_samples = n0 * n1
else:
    n_samples = 2.5E3

#set up samples
if random_sample == False:
    vec0 = list(np.linspace(lam_domain[0][0], lam_domain[0][1], n0))
    vec1 = list(np.linspace(lam_domain[1][0], lam_domain[1][1], n1))
    vecv0, vecv1 = np.meshgrid(vec0, vec1, indexing='ij')
    samples = np.vstack((vecv0.flat[:], vecv1.flat[:])).transpose()
else:
    samples = calculateP.emulate_iid_lebesgue(lam_domain=lam_domain,
                                              num_l_emulate=n_samples)

# QoI map
Q_map = np.array([[0.506, 0.463], [0.253, 0.918]])

# calc data
data = np.dot(samples, Q_map)
'''
Compute the output distribution simple function approximation by
propagating a different set of samples to implicitly define a Voronoi
discretization of the data space, and then propagating i.i.d. uniform
samples to bin into these cells.

Suggested changes for user:

See the effect of using different values for d_distr_samples_num.
if random_sample == False:
  n0 = 50 # number of samples in lam0 direction
  n1 = 50 # number of samples in lam1 direction
  n_samples = n0*n1 
else:
  n_samples = 1E3  

#set up samples
if random_sample == False:
  vec0 = list(np.linspace(lam_domain[0][0], lam_domain[0][1], n0))
  vec1 = list(np.linspace(lam_domain[1][0], lam_domain[1][1], n1))
  vecv0, vecv1 = np.meshgrid(vec0, vec1, indexing='ij')
  samples = np.vstack((vecv0.flat[:], vecv1.flat[:])).transpose()
else:
  samples = calculateP.emulate_iid_lebesgue(lam_domain=lam_domain, 
					    num_l_emulate = n_samples)

# QoI function
def QoI(x,y,lam1,lam2):
  z = np.sin(m.pi*x*lam1)*np.sin(m.pi*y*lam2)
  return z #np.vstack(z.flat[:]).transpose()

'''
Suggested changes for user:

Try setting QoI_num = 2.  

Play around with the x1, y1, and/or, x2, y2 values to try and
"optimize" the QoI to give the highest probability region 
on the reference parameter above. 
Example #3
0
if random_sample == False:
  n0 = 50 # number of samples in lam0 direction
  n1 = 50 # number of samples in lam1 direction
  n_samples = n0*n1
else:
  n_samples = 2.5E3  


#set up samples
if random_sample == False:
  vec0=list(np.linspace(lam_domain[0][0], lam_domain[0][1], n0))
  vec1 = list(np.linspace(lam_domain[1][0], lam_domain[1][1], n1))
  vecv0, vecv1 = np.meshgrid(vec0, vec1, indexing='ij')
  samples=np.vstack((vecv0.flat[:], vecv1.flat[:])).transpose()
else:
  samples = calculateP.emulate_iid_lebesgue(lam_domain=lam_domain, 
					    num_l_emulate = n_samples)

# QoI map
Q_map = np.array([[0.506, 0.463],[0.253, 0.918]])


# calc data
data = np.dot(samples,Q_map)

'''
Compute the output distribution simple function approximation by
propagating a different set of samples to implicitly define a Voronoi
discretization of the data space, and then propagating i.i.d. uniform
samples to bin into these cells.

Suggested changes for user:
if random_sample == False:
    n0 = 50  # number of samples in lam0 direction
    n1 = 50  # number of samples in lam1 direction
    n_samples = n0 * n1
else:
    n_samples = 1E3

#set up samples
if random_sample == False:
    vec0 = list(np.linspace(lam_domain[0][0], lam_domain[0][1], n0))
    vec1 = list(np.linspace(lam_domain[1][0], lam_domain[1][1], n1))
    vecv0, vecv1 = np.meshgrid(vec0, vec1, indexing='ij')
    samples = np.vstack((vecv0.flat[:], vecv1.flat[:])).transpose()
else:
    samples = calculateP.emulate_iid_lebesgue(lam_domain=lam_domain,
                                              num_l_emulate=n_samples)


# QoI function
def QoI(x, y, lam1, lam2):
    z = np.sin(m.pi * x * lam1) * np.sin(m.pi * y * lam2)
    return z  #np.vstack(z.flat[:]).transpose()


'''
Suggested changes for user:

Try setting QoI_num = 2.  

Play around with the x1, y1, and/or, x2, y2 values to try and
"optimize" the QoI to give the highest probability region